-
Notifications
You must be signed in to change notification settings - Fork 44
Closed
JuliaPackaging/Yggdrasil
#11881Description
The original issue uncovered in #347:
julia> using OpenCL, pocl_jll
julia> function atomic_arrayset(A::AbstractArray{T}, I::Integer, op::Function, val) where {T}
ptr = pointer(A, I)
old = Base.unsafe_load(ptr, 1)
while true
cmp = old
new = convert(T, op(old, val))
old = OpenCL.SPIRVIntrinsics.atomic_cmpxchg!(ptr, cmp, new)
(old == cmp) && return new
end
end
atomic_arrayset (generic function with 1 method)
julia> function foo(a)
atomic_arrayset(a, 1, +, 1)
return
end
foo (generic function with 1 method)
julia> a = OpenCL.zeros(Int64)
0-dimensional CLArray{Int64, 0, OpenCL.cl.UnifiedDeviceMemory}:
0
julia> @opencl global_size=1000 foo(a)
error: line 53: OpPhi's result type <id> '9[%ulong]' does not match incoming value <id> '35[%35]' type <id> '12[%uint]'.
%value_phi = OpPhi %ulong %33 %top %35 %L8
ERROR: Failed to validate generated SPIR-V.
If you think this is a bug, please file an issue and attach /tmp/jl_87gxwPQ5yh.bc and /tmp/jl_cdmHQxoFiF.spv.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/spirv.jl:163 [inlined]
[3] mcgen(job::GPUCompiler.CompilerJob{…}, mod::LLVM.Module, format::LLVM.API.LLVMCodeGenFileType)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/utils.jl:134
[4] macro expansion
@ ~/.julia/packages/Tracy/slmNc/src/tracepoint.jl:163 [inlined]
[5] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:406 [inlined]
[6] macro expansion
@ ~/.julia/packages/Tracy/slmNc/src/tracepoint.jl:163 [inlined]
[7] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:403 [inlined]
[8] emit_asm(job::GPUCompiler.CompilerJob, ir::LLVM.Module, format::LLVM.API.LLVMCodeGenFileType)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/utils.jl:116
[9] compile_unhooked(output::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:115
[10] compile_unhooked
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:80 [inlined]
[11] compile(target::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:67
[12] compile
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:55 [inlined]
[13] #36
@ ~/.julia/dev/OpenCL/src/compiler/compilation.jl:62 [inlined]
[14] JuliaContext(f::OpenCL.var"#36#37"{GPUCompiler.CompilerJob{…}}; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:34
[15] JuliaContext(f::Function)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:25
[16] compile(job::GPUCompiler.CompilerJob)
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/compilation.jl:61
[17] actual_compilation(cache::Dict{…}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{…}, compiler::typeof(OpenCL.compile), linker::typeof(OpenCL.link))
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:245
[18] cached_compilation(cache::Dict{…}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{…}, compiler::Function, linker::Function)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:159
[19] macro expansion
@ ~/.julia/dev/OpenCL/src/compiler/execution.jl:186 [inlined]
[20] macro expansion
@ ./lock.jl:273 [inlined]
[21] clfunction(f::typeof(foo), tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}}; kwargs::@Kwargs{})
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:181
[22] clfunction(f::typeof(foo), tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}})
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:177
[23] top-level scope
@ ~/.julia/dev/OpenCL/src/compiler/execution.jl:66
caused by: failed process: Process(setenv(`/home/simeon/.julia/artifacts/954f1d0245f593658ca964009b1b0c17834a59a7/bin/spirv-val /tmp/jl_cdmHQxoFiF.spv`,["P9K_SSH=0", "PATH=/home/simeon/.julia/artifacts/954f1d0245f593658ca964009b1b0c17834a59a7/bin:/home/simeon/.local/bin:/home/simeon/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/cli-bin:/home/simeon/.juliaup/bin:/home/simeon/.cargo/bin:/home/simeon/.juliaup/bin:/usr/share/Modules/bin:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/home/simeon/.config/Code/User/globalStorage/github.copilot-chat/debugCommand", "EDITOR=vim", "NO_AT_BRIDGE=1", "POCL_ARGS_CLANG=-fuse-ld=lld;--ld-path=/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/bin/lld;-L;/home/simeon/.julia/artifacts/335e91adc50bc361682926789360ef6150603b44/share/lib;-L;/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/lib", "LD_LIBRARY_PATH=/home/simeon/.julia/artifacts/954f1d0245f593658ca964009b1b0c17834a59a7/lib:/home/simeon/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/bin/../lib/julia:/home/simeon/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/bin/../lib", "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus", "MANPATH=/usr/share/man:", "MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles", "DEBUGINFOD_IMA_CERT_PATH=/etc/keys/ima:" … "HISTCONTROL=ignoredups", "ORIGINAL_XDG_CURRENT_DESKTOP=GNOME", "MAIL=/var/spool/mail/simeon", "JOURNAL_STREAM=9:22034", "KDEDIRS=/usr", "JULIA_NUM_PRECOMPILE_TASKS=4", "POCL_PATH_LLVM_SPIRV=/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/bin/llvm-spirv", "GIO_LAUNCHED_DESKTOP_FILE_PID=24479", "LS_COLORS=", "OPENBLAS_MAIN_FREE=1"]), ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error
@ ./process.jl:598 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base ./process.jl:513
[3] run
@ ./process.jl:510 [inlined]
[4] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/spirv.jl:161 [inlined]
[5] mcgen(job::GPUCompiler.CompilerJob{…}, mod::LLVM.Module, format::LLVM.API.LLVMCodeGenFileType)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/utils.jl:134
[6] macro expansion
@ ~/.julia/packages/Tracy/slmNc/src/tracepoint.jl:163 [inlined]
[7] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:406 [inlined]
[8] macro expansion
@ ~/.julia/packages/Tracy/slmNc/src/tracepoint.jl:163 [inlined]
[9] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:403 [inlined]
[10] emit_asm(job::GPUCompiler.CompilerJob, ir::LLVM.Module, format::LLVM.API.LLVMCodeGenFileType)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/utils.jl:116
[11] compile_unhooked(output::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:115
[12] compile_unhooked
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:80 [inlined]
[13] compile(target::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:67
[14] compile
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:55 [inlined]
[15] #36
@ ~/.julia/dev/OpenCL/src/compiler/compilation.jl:62 [inlined]
[16] JuliaContext(f::OpenCL.var"#36#37"{GPUCompiler.CompilerJob{…}}; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:34
[17] JuliaContext(f::Function)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:25
[18] compile(job::GPUCompiler.CompilerJob)
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/compilation.jl:61
[19] actual_compilation(cache::Dict{…}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{…}, compiler::typeof(OpenCL.compile), linker::typeof(OpenCL.link))
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:245
[20] cached_compilation(cache::Dict{…}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{…}, compiler::Function, linker::Function)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:159
[21] macro expansion
@ ~/.julia/dev/OpenCL/src/compiler/execution.jl:186 [inlined]
[22] macro expansion
@ ./lock.jl:273 [inlined]
[23] clfunction(f::typeof(foo), tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}}; kwargs::@Kwargs{})
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:181
[24] clfunction(f::typeof(foo), tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}})
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:177
[25] top-level scope
@ ~/.julia/dev/OpenCL/src/compiler/execution.jl:66
Some type information was truncated. Use `show(err)` to see complete types.
Trying to reduce this further I stumbled upon another error, not sure it's the same root cause:
julia> function bar(a)
OpenCL.SPIRVIntrinsics.atomic_cmpxchg!(pointer(a), 0, 1)
return
end
bar (generic function with 1 method)
julia> @opencl global_size=1000 bar(a)
error: line 35: AtomicCompareExchange: 64-bit atomics require the Int64Atomics capability
%24 = OpAtomicCompareExchange %uint %23 %uint_2 %uint_0 %uint_0 %ulong_1 %14
ERROR: Failed to validate generated SPIR-V.
If you think this is a bug, please file an issue and attach /tmp/jl_YrsN2NK3yp.bc and /tmp/jl_4PwzOnCRyH.spv.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/spirv.jl:163 [inlined]
[3] mcgen(job::GPUCompiler.CompilerJob{…}, mod::LLVM.Module, format::LLVM.API.LLVMCodeGenFileType)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/utils.jl:134
[4] macro expansion
@ ~/.julia/packages/Tracy/slmNc/src/tracepoint.jl:163 [inlined]
[5] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:406 [inlined]
[6] macro expansion
@ ~/.julia/packages/Tracy/slmNc/src/tracepoint.jl:163 [inlined]
[7] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:403 [inlined]
[8] emit_asm(job::GPUCompiler.CompilerJob, ir::LLVM.Module, format::LLVM.API.LLVMCodeGenFileType)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/utils.jl:116
[9] compile_unhooked(output::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:115
[10] compile_unhooked
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:80 [inlined]
[11] compile(target::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:67
[12] compile
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:55 [inlined]
[13] #36
@ ~/.julia/dev/OpenCL/src/compiler/compilation.jl:62 [inlined]
[14] JuliaContext(f::OpenCL.var"#36#37"{GPUCompiler.CompilerJob{…}}; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:34
[15] JuliaContext(f::Function)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:25
[16] compile(job::GPUCompiler.CompilerJob)
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/compilation.jl:61
[17] actual_compilation(cache::Dict{…}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{…}, compiler::typeof(OpenCL.compile), linker::typeof(OpenCL.link))
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:245
[18] cached_compilation(cache::Dict{…}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{…}, compiler::Function, linker::Function)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:159
[19] macro expansion
@ ~/.julia/dev/OpenCL/src/compiler/execution.jl:186 [inlined]
[20] macro expansion
@ ./lock.jl:273 [inlined]
[21] clfunction(f::typeof(bar), tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}}; kwargs::@Kwargs{})
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:181
[22] clfunction(f::typeof(bar), tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}})
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:177
[23] top-level scope
@ ~/.julia/dev/OpenCL/src/compiler/execution.jl:66
caused by: failed process: Process(setenv(`/home/simeon/.julia/artifacts/954f1d0245f593658ca964009b1b0c17834a59a7/bin/spirv-val /tmp/jl_4PwzOnCRyH.spv`,["P9K_SSH=0", "PATH=/home/simeon/.julia/artifacts/954f1d0245f593658ca964009b1b0c17834a59a7/bin:/home/simeon/.local/bin:/home/simeon/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/cli-bin:/home/simeon/.juliaup/bin:/home/simeon/.cargo/bin:/home/simeon/.juliaup/bin:/usr/share/Modules/bin:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/home/simeon/.config/Code/User/globalStorage/github.copilot-chat/debugCommand", "EDITOR=vim", "NO_AT_BRIDGE=1", "POCL_ARGS_CLANG=-fuse-ld=lld;--ld-path=/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/bin/lld;-L;/home/simeon/.julia/artifacts/335e91adc50bc361682926789360ef6150603b44/share/lib;-L;/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/lib", "LD_LIBRARY_PATH=/home/simeon/.julia/artifacts/954f1d0245f593658ca964009b1b0c17834a59a7/lib:/home/simeon/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/bin/../lib/julia:/home/simeon/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/bin/../lib", "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus", "MANPATH=/usr/share/man:", "MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles", "DEBUGINFOD_IMA_CERT_PATH=/etc/keys/ima:" … "HISTCONTROL=ignoredups", "ORIGINAL_XDG_CURRENT_DESKTOP=GNOME", "MAIL=/var/spool/mail/simeon", "JOURNAL_STREAM=9:22034", "KDEDIRS=/usr", "JULIA_NUM_PRECOMPILE_TASKS=4", "POCL_PATH_LLVM_SPIRV=/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/bin/llvm-spirv", "GIO_LAUNCHED_DESKTOP_FILE_PID=24479", "LS_COLORS=", "OPENBLAS_MAIN_FREE=1"]), ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error
@ ./process.jl:598 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base ./process.jl:513
[3] run
@ ./process.jl:510 [inlined]
[4] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/spirv.jl:161 [inlined]
[5] mcgen(job::GPUCompiler.CompilerJob{…}, mod::LLVM.Module, format::LLVM.API.LLVMCodeGenFileType)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/utils.jl:134
[6] macro expansion
@ ~/.julia/packages/Tracy/slmNc/src/tracepoint.jl:163 [inlined]
[7] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:406 [inlined]
[8] macro expansion
@ ~/.julia/packages/Tracy/slmNc/src/tracepoint.jl:163 [inlined]
[9] macro expansion
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:403 [inlined]
[10] emit_asm(job::GPUCompiler.CompilerJob, ir::LLVM.Module, format::LLVM.API.LLVMCodeGenFileType)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/utils.jl:116
[11] compile_unhooked(output::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:115
[12] compile_unhooked
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:80 [inlined]
[13] compile(target::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:67
[14] compile
@ ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:55 [inlined]
[15] #36
@ ~/.julia/dev/OpenCL/src/compiler/compilation.jl:62 [inlined]
[16] JuliaContext(f::OpenCL.var"#36#37"{GPUCompiler.CompilerJob{…}}; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:34
[17] JuliaContext(f::Function)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/driver.jl:25
[18] compile(job::GPUCompiler.CompilerJob)
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/compilation.jl:61
[19] actual_compilation(cache::Dict{…}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{…}, compiler::typeof(OpenCL.compile), linker::typeof(OpenCL.link))
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:245
[20] cached_compilation(cache::Dict{…}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{…}, compiler::Function, linker::Function)
@ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:159
[21] macro expansion
@ ~/.julia/dev/OpenCL/src/compiler/execution.jl:186 [inlined]
[22] macro expansion
@ ./lock.jl:273 [inlined]
[23] clfunction(f::typeof(bar), tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}}; kwargs::@Kwargs{})
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:181
[24] clfunction(f::typeof(bar), tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}})
@ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:177
[25] top-level scope
@ ~/.julia/dev/OpenCL/src/compiler/execution.jl:66
Some type information was truncated. Use `show(err)` to see complete types.
This is even though my device definitely supports extended Int64 atomics:
julia> cl.device().extensions
26-element Vector{String}:
"cl_khr_byte_addressable_store"
"cl_khr_global_int32_base_atomics"
"cl_khr_global_int32_extended_atomics"
"cl_khr_local_int32_base_atomics"
"cl_khr_local_int32_extended_atomics"
"cl_khr_3d_image_writes"
"cl_ext_float_atomics"
"cl_intel_unified_shared_memory"
"cl_ext_buffer_device_address"
"cl_pocl_svm_rect"
"cl_pocl_command_buffer_svm"
"cl_khr_command_buffer"
"cl_khr_command_buffer_multi_device"
"cl_khr_command_buffer_mutable_dispatch"
"cl_pocl_command_buffer_host_buffer"
"cl_khr_subgroups"
"cl_khr_subgroup_ballot"
"cl_khr_subgroup_shuffle"
"cl_intel_subgroups"
"cl_intel_subgroups_short"
"cl_intel_subgroups_char"
"cl_intel_required_subgroup_size"
"cl_khr_il_program"
"cl_khr_fp64"
"cl_khr_int64_base_atomics"
"cl_khr_int64_extended_atomics"
Are the capabilities perhaps not passed through to the validation pass correctly?
Metadata
Metadata
Assignees
Labels
No labels