Skip to content

Broken module (addrspace(1) jl_libjulia_internal_handle) compiling a Union{Missing,Bool} broadcast on CI #1149

Description

@maleadt

On the CI machines, compiling a broadcast over a Union{Missing,Bool} array aborts the process with an LLVM verifier error instead of throwing a GPUCompiler.InvalidIRError:

x = ROCArray(Union{Missing,Bool}[missing, true])
Array(x .| false)

GPUArrays 12's testsuite runs that as a probe (test/testsuite/findall.jl:105, in try/catch, to see whether the back-end supports isbits unions), so gpuarrays/reductions/any all predicates crashes its worker on #1145:

┌ Call parameter type does not match function signature!
│ ptr addrspace(1) @jl_libjulia_internal_handle
│  ptr  %ijl_alloc_string.found = call ptr @ijl_load_and_lookup(ptr inttoptr (i64 3 to ptr), ptr addrspacecast (ptr addrspace(1) @_j_str_ijl_alloc_string_4 to ptr), ptr addrspace(1) @jl_libjulia_internal_handle), !dbg !435
│ [... the same for further jl_alloc_string, jl_string_to_genericmemory and jl_genericmemory_to_string lookups ...]
│ LLVM ERROR: Broken module found, compilation aborted!
│
│ [1935] signal 6 (-6): Aborted
...
│ runJuliaPasses at LLVM.jl/deps/LLVMExtra/lib/NewPM.cpp:867
│ run_passes! at LLVM/src/passes.jl:651
│ optimize! at GPUCompiler/src/optim.jl:52
│ emit_llvm at GPUCompiler/src/driver.jl:382
│ hipcompile at AMDGPU/src/compiler/codegen.jl:379
...
│ _copyto! at GPUArrays/src/host/broadcast.jl:79

So @jl_libjulia_internal_handle ends up in addrspace(1) while the ijl_load_and_lookup calls still pass it as a generic pointer, and the module fails verification during optimization, before GPUCompiler's IR validation can report the ccalls.

Where it happens:

Where it doesn't: gfx1036 (ROCm 7.2.4, artifacts or system ROCm), Julia 1.12.7 and 1.13.1, with the same package versions (AMDGPU at #1145, GPUArrays 12.0.0, GPUCompiler 2.13.0, LLVM.jl 10.1.0). There the snippet throws InvalidIRError (also when overriding HIP.gcn_arch to gfx90a or gfx942, and under Pkg.test(; coverage=true) with the CI's environment variables), and the full test suite passes (21,399 tests). So I couldn't find what the CI machines do differently.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions