Skip to content

Failure using field within AMDGPU roc kernel #22

@luraess

Description

@luraess

ROCCellArray fails when setting field(A, 1)[in] = 1 within a kernel in the following MWE (note that the CUDA analogue works as expected):

using AMDGPU
using CellArrays
using StaticArrays

function init!(A)
    in = workitemIdx().x + (workgroupIdx().x - 1) * workgroupDim().x
    field(A, 1)[in] = 1
    return
end

function mwe()
    n_l = 2
    celldims = (n_l, 1)
    n_loc = SMatrix{celldims..., Int32, prod(celldims)} # needs to be of type Int as those are indices
    A = ROCCellArray{n_loc}(undef, 1)
    AMDGPU.@sync @roc groupsize=1 init!(A)
    return
end

mwe()

with following trace:

Reason: unsupported call through a literal pointer (call to ijl_array_grow_end)
Stacktrace:
  [1] _growend!
    @ ./array.jl:1014
  [2] ensureroom
    @ ./iobuffer.jl:330
  [3] write
    @ ./iobuffer.jl:443
  [4] write
    @ ./io.jl:739
  [5] print
    @ ./char.jl:252
  [6] show_delim_array
    @ ./show.jl:1340
  [7] show_delim_array
    @ ./show.jl:1310
  [8] show
    @ ./show.jl:1343
  [9] print
    @ ./strings/io.jl:35
 [10] print_to_string
    @ ./strings/io.jl:144
 [11] string
    @ ./strings/io.jl:185
 [12] _throw_dmrs
    @ ./reshapedarray.jl:182
 [13] _reshape
    @ ./reshapedarray.jl:177
 [14] reshape
    @ ./reshapedarray.jl:112
 [15] plain
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/CellArrays/I1b1C/src/CellArray.jl:307
 [16] field
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/CellArrays/I1b1C/src/CellArray.jl:291
 [17] init!
    @ /pfs/lustrep2/scratch/project_465000557/lurass/test/ibm_mwe_amd.jl:78
Reason: unsupported call to an unknown function (call to ijl_pop_handler)
Stacktrace:
 [1] print
   @ ./strings/io.jl:35
 [2] print_to_string
   @ ./strings/io.jl:144
 [3] string
   @ ./strings/io.jl:185
 [4] _throw_dmrs
   @ ./reshapedarray.jl:182
 [5] _reshape
   @ ./reshapedarray.jl:177
 [6] reshape
   @ ./reshapedarray.jl:112
 [7] plain
   @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/CellArrays/I1b1C/src/CellArray.jl:307
 [8] field
   @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/CellArrays/I1b1C/src/CellArray.jl:291
 [9] init!
   @ /pfs/lustrep2/scratch/project_465000557/lurass/test/ibm_mwe_amd.jl:78
Hint: catch this exception as `err` and call `code_typed(err; interactive = true)` to introspect the erronous code with Cthulhu.jl
Stacktrace:
  [1] check_ir(job::GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget, AMDGPU.Compiler.HIPCompilerParams}, args::LLVM.Module)
    @ GPUCompiler /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/validation.jl:149
  [2] macro expansion
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/driver.jl:415 [inlined]
  [3] macro expansion
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/TimerOutputs/RsWnF/src/TimerOutput.jl:253 [inlined]
  [4] macro expansion
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/driver.jl:414 [inlined]
  [5] emit_llvm(job::GPUCompiler.CompilerJob; libraries::Bool, toplevel::Bool, optimize::Bool, cleanup::Bool, only_entry::Bool, validate::Bool)
    @ GPUCompiler /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/utils.jl:89
  [6] emit_llvm
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/utils.jl:83 [inlined]
  [7] codegen(output::Symbol, job::GPUCompiler.CompilerJob; libraries::Bool, toplevel::Bool, optimize::Bool, cleanup::Bool, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
    @ GPUCompiler /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/driver.jl:129
  [8] codegen
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/driver.jl:110 [inlined]
  [9] compile(target::Symbol, job::GPUCompiler.CompilerJob; libraries::Bool, toplevel::Bool, optimize::Bool, cleanup::Bool, strip::Bool, validate::Bool, only_entry::Bool)
    @ GPUCompiler /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/driver.jl:106
 [10] compile
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/driver.jl:98 [inlined]
 [11] #37
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/AMDGPU/j72HB/src/compiler/codegen.jl:122 [inlined]
 [12] JuliaContext(f::AMDGPU.Compiler.var"#37#38"{GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget, AMDGPU.Compiler.HIPCompilerParams}})
    @ GPUCompiler /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/driver.jl:47
 [13] hipcompile(job::GPUCompiler.CompilerJob)
    @ AMDGPU.Compiler /scratch/project_465000557/lurass/julia_local/julia_depot/packages/AMDGPU/j72HB/src/compiler/codegen.jl:121
 [14] actual_compilation(cache::Dict{Any, AMDGPU.HIP.HIPFunction}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{GPUCompiler.GCNCompilerTarget, AMDGPU.Compiler.HIPCompilerParams}, compiler::typeof(AMDGPU.Compiler.hipcompile), linker::typeof(AMDGPU.Compiler.hiplink))
    @ GPUCompiler /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/execution.jl:125
 [15] cached_compilation(cache::Dict{Any, AMDGPU.HIP.HIPFunction}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{GPUCompiler.GCNCompilerTarget, AMDGPU.Compiler.HIPCompilerParams}, compiler::Function, linker::Function)
    @ GPUCompiler /scratch/project_465000557/lurass/julia_local/julia_depot/packages/GPUCompiler/YO8Uj/src/execution.jl:103
 [16] macro expansion
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/AMDGPU/j72HB/src/compiler/codegen.jl:91 [inlined]
 [17] macro expansion
    @ ./lock.jl:267 [inlined]
 [18] hipfunction(f::typeof(init!), tt::Type{Tuple{CellArray{SMatrix{2, 1, Int32, 2}, 1, 0, ROCDeviceArray{Int32, 3, 1}}}}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ AMDGPU.Compiler /scratch/project_465000557/lurass/julia_local/julia_depot/packages/AMDGPU/j72HB/src/compiler/codegen.jl:85
 [19] hipfunction
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/AMDGPU/j72HB/src/compiler/codegen.jl:84 [inlined]
 [20] macro expansion
    @ /scratch/project_465000557/lurass/julia_local/julia_depot/packages/AMDGPU/j72HB/src/highlevel.jl:257 [inlined]
 [21] mwe()
    @ Main /pfs/lustrep2/scratch/project_465000557/lurass/test/ibm_mwe_amd.jl:87
 [22] top-level scope
    @ /pfs/lustrep2/scratch/project_465000557/lurass/test/ibm_mwe_amd.jl:91
 [23] include(fname::String)
    @ Base.MainInclude ./client.jl:478
 [24] top-level scope
    @ REPL[1]:1
in expression starting at /pfs/lustrep2/scratch/project_465000557/lurass/test/ibm_mwe_amd.jl:91

julia> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions