JuliaGPU / JuliaGPU/AMDGPU.jl

-O0 flag broken

Open
#195 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug intrinsics upstream
Dominant language
Julia
Stars
344
Forks
79
Avg merge
2d 23h
Merged PRs (30d)
27

Description

using AMDGPU
kernel() = (AMDGPU.trap(); nothing)
AMDGPU.@device_code_llvm wait(@roc kernel())

This runs fine with default julia flags but segfaults using no optimization -O0. @device_code_llvm output is the same in both cases:

# default flags and -O0
; CompilerJob of kernel kernel() for GPUCompiler.GCNCompilerTarget
;  @ /gpfs/alpine/csc359/scratch/mschanen/julia_depot_crusher/dev/AMDGPU/mwe.jl:4 within `kernel`
define amdgpu_kernel void @_Z16julia_kernel_968() local_unnamed_addr #1 {
entry:
; ┌ @ /gpfs/alpine/csc359/scratch/mschanen/julia_depot_crusher/dev/AMDGPU/src/device/llvm.jl:3 within `trap`
   call void @llvm.trap()
; └
  unreachable
}

This is on branch ms/julia-1.8 and

Julia Version 1.8.0-DEV.1490
Commit 94bbfd45f9 (2022-02-10 14:02 UTC)
Platform Info:
  OS: Linux (x86_64-suse-linux)
  CPU: AMD EPYC 7A53 64-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.0 (ORCJIT, znver3)
Environment:
  LD_LIBRARY_PATH = /opt/rocm-4.5.0/lib64:/opt/rocm-4.5.0/lib:/opt/rocm-4.5.0/hsa/lib:/opt/rocm-4.5.0/llvm/lib:/opt/cray/pe/papi/6.0.0.12/lib64:/opt/cray/libfabric/1.13.0.0/lib64
  JULIA_FOLDER = /gpfs/alpine/scratch/mschanen/csc359/julia
  JULIA_AMDGPU_DISABLE_ARTIFACTS = 1
  JULIA_DEPOT_PATH = /gpfs/alpine/scratch/mschanen/csc359/julia_depot_crusher
  JULIA_MPI_PATH = /opt/cray/pe/mpich/8.1.12/ofi/amd/4.4
Project AMDGPU v0.2.17
Status `/gpfs/alpine/csc359/scratch/mschanen/julia_depot_crusher/dev/AMDGPU/Project.toml`
  [621f4979] AbstractFFTs v1.1.0
  [79e6a3ab] Adapt v3.3.3
  [b99e7846] BinaryProvider v0.5.10
  [fa961155] CEnum v0.4.1
  [e2ba6199] ExprTools v0.1.8
  [0c68f7d7] GPUArrays v8.2.1
  [61eb1bfa] GPUCompiler v0.13.11
  [929cbde3] LLVM v4.7.1
  [1914dd2f] MacroTools v0.5.9
  [ae029012] Requires v1.3.0
⌅ [efcf1570] Setfield v0.7.1
  [276daf66] SpecialFunctions v2.1.2
  [2696aab5] HIP_jll v4.2.0+0
  [873c0968] ROCmDeviceLibs_jll v4.2.0+0
  [dd59ff1a] hsa_rocr_jll v4.2.0+1
  [a6151927] rocRAND_jll v4.2.0+0
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [44cfe95a] Pkg v1.8.0
  [de0858da] Printf
  [9a3f8284] Random
  [10745b16] Statistics
Info Packages marked with ⌅ have new versions available but cannot be upgraded. To see why use `status --outdated`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducer in mwe.jl: run the kernel with Julia's default optimization and with -O0, then inspect the @device_code_llvm output shown in the issue. Trace the AMDGPU.@roc execution path and determine why the identical LLVM output segfaults only under -O0; done means the reproducer no longer segfaults with no optimization.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.