Skip to content

Conversation

@simeonschaub
Copy link
Member

This doesn't work as-is, when running the tests, I get:

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

atomic_add! (Int64): Error During Test at /home/simeon/.julia/dev/OpenCL/test/atomics.jl:8
  Got exception outside of a @test
  Failed to validate generated SPIR-V.
  If you think this is a bug, please file an issue and attach /tmp/jl_0DuZYdOT2R.bc and /tmp/jl_iXehOfot6x.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{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, 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{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}}; 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{Any, Any}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, compiler::typeof(OpenCL.compile), linker::typeof(OpenCL.link))
      @ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:245
   [18] cached_compilation(cache::Dict{Any, Any}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, 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::var"#atomic_count#11", tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}}; kwargs::@Kwargs{})
      @ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:181
   [22] clfunction(f::var"#atomic_count#11", tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}})
      @ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:177
   [23] macro expansion
      @ ~/.julia/dev/OpenCL/src/compiler/execution.jl:66 [inlined]
   [24] macro expansion
      @ ~/.julia/dev/OpenCL/test/atomics.jl:10 [inlined]
   [25] macro expansion
      @ ~/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1798 [inlined]
   [26] macro expansion
      @ ~/.julia/dev/OpenCL/test/atomics.jl:8 [inlined]
   [27] macro expansion
      @ ~/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined]
   [28] top-level scope
      @ ~/.julia/dev/OpenCL/test/atomics.jl:3
  
  caused by: failed process: Process(setenv(`/home/simeon/.julia/artifacts/954f1d0245f593658ca964009b1b0c17834a59a7/bin/spirv-val /tmp/jl_iXehOfot6x.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:", "XDG_SESSION_DESKTOP=gnome", "LESS_TERMCAP_us=\e[01;36m", "__MODULES_LMINIT=module use --append /usr/share/Modules/modulefiles:module use --append /etc/modulefiles:module use --append /usr/share/modulefiles", "LESS_TERMCAP_mb=\e[01;32m", "XDG_SESSION_TYPE=wayland", "SYSTEMD_EXEC_PID=3314", "OPENBLAS_DEFAULT_NUM_THREADS=1", "USER=simeon", "QT_IM_MODULE=ibus", "JULIA_PKG_USE_CLI_GIT=1", "JULIA_EDITOR=code", "SSH_ASKPASS=/usr/bin/ksshaskpass", "GDK_BACKEND=x11", "LESS=-R", "MATHEMATICA_HOME=/usr/share/Wolfram/Documentation/14.2/en-us", "USERNAME=simeon", "GDMSESSION=gnome", "MOZ_GMP_PATH=/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed", "__MODULES_SHARE_MANPATH=:1", "XDG_DATA_DIRS=/home/simeon/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/", "LESSOPEN=||/usr/bin/lesspipe.sh %s", "JULIA_VSCODE_REPL=1", "VSCODE_GIT_ASKPASS_NODE=/usr/share/code/code", "SHELL=/usr/bin/zsh", "GJS_DEBUG_OUTPUT=stderr", "QUARTO_PYTHON=/home/simeon/.julia/conda/3/bin/python3", "XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.0IPLA3", "VSCODE_GIT_ASKPASS_EXTRA_ARGS=", "XDG_MENU_PREFIX=gnome-", "VSCODE_GIT_IPC_HANDLE=/run/user/1000/vscode-git-50f165619f.sock", "DEBUGINFOD_URLS=https://debuginfod.fedoraproject.org/ ", "MODULES_CMD=/usr/share/Modules/libexec/modulecmd.tcl", "LESS_TERMCAP_me=\e[0m", "LESS_TERMCAP_so=\e[01;47;34m", "MANAGERPID=3134", "SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/3267,unix/unix:/tmp/.ICE-unix/3267", "LESS_TERMCAP_se=\e[0m", "XMODIFIERS=@im=ibus", "GPG_TTY=not a tty", "HOME=/home/simeon", "TERM=xterm-256color", "HOSTNAME=talentix", "COLORTERM=truecolor", "LESS_TERMCAP_md=\e[01;32m", "HISTSIZE=10000", "WAYLAND_DISPLAY=wayland-0", "INVOCATION_ID=947f3eaa1c03416aa1579f2f83558813", "GIT_ASKPASS=/usr/share/code/resources/app/extensions/git/dist/askpass.sh", "XDG_CURRENT_DESKTOP=GNOME", "LANG=en_US.UTF-8", "LOGNAME=simeon", "XDG_RUNTIME_DIR=/run/user/1000", "LOADEDMODULES=", "SHLVL=0", "MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/session.slice/[email protected]/memory.pressure", "DESKTOP_SESSION=gnome", "GDM_LANG=en_US.UTF-8", "OLDPWD=/home/simeon", "SSH_AUTH_SOCK=/run/user/1000/yubikey-agent/yubikey-agent.sock", "CHROME_DESKTOP=code.desktop", "LS_OPTIONS=--color=auto", "_=/usr/share/code/code", "LESS_TERMCAP_ue=\e[0m", "POCL_PATH_CLANG=/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/bin/clang", "GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/code.desktop", "TERM_PROGRAM_VERSION=1.102.2", "MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=", "MODULESHOME=/usr/share/Modules", "PWD=/home/simeon/.julia/dev/OpenCL", "XDG_SESSION_CLASS=user", "DISPLAY=:0", "TERM_PROGRAM=vscode", "GJS_DEBUG_TOPICS=JS ERROR;JS LOG", "GNOME_SETUP_DISPLAY=:1", "VSCODE_GIT_ASKPASS_MAIN=/usr/share/code/resources/app/extensions/git/dist/askpass-main.js", "POCL_PATH_SPIRV_LINK=/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/bin/spirv_link", "HWLOC_PLUGINS_PATH=/dev/null", "MODULES_RUN_QUARANTINE=LD_LIBRARY_PATH LD_PRELOAD", "_P9K_SSH_TTY=", "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{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, 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{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}}; 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{Any, Any}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, compiler::typeof(OpenCL.compile), linker::typeof(OpenCL.link))
      @ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:245
   [20] cached_compilation(cache::Dict{Any, Any}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, 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::var"#atomic_count#11", tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}}; kwargs::@Kwargs{})
      @ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:181
   [24] clfunction(f::var"#atomic_count#11", tt::Type{Tuple{CLDeviceArray{Int64, 0, 1}}})
      @ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:177
   [25] macro expansion
      @ ~/.julia/dev/OpenCL/src/compiler/execution.jl:66 [inlined]
   [26] macro expansion
      @ ~/.julia/dev/OpenCL/test/atomics.jl:10 [inlined]
   [27] macro expansion
      @ ~/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1798 [inlined]
   [28] macro expansion
      @ ~/.julia/dev/OpenCL/test/atomics.jl:8 [inlined]
   [29] macro expansion
      @ ~/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined]
   [30] top-level scope
      @ ~/.julia/dev/OpenCL/test/atomics.jl:3
error: line 54: 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

atomic_add! (UInt64): Error During Test at /home/simeon/.julia/dev/OpenCL/test/atomics.jl:8
  Got exception outside of a @test
  Failed to validate generated SPIR-V.
  If you think this is a bug, please file an issue and attach /tmp/jl_AdSxGxARQJ.bc and /tmp/jl_AHwVqZOhMz.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{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, 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{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}}; 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{Any, Any}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, compiler::typeof(OpenCL.compile), linker::typeof(OpenCL.link))
      @ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:245
   [18] cached_compilation(cache::Dict{Any, Any}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, 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::var"#atomic_count#11", tt::Type{Tuple{CLDeviceArray{UInt64, 0, 1}}}; kwargs::@Kwargs{})
      @ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:181
   [22] clfunction(f::var"#atomic_count#11", tt::Type{Tuple{CLDeviceArray{UInt64, 0, 1}}})
      @ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:177
   [23] macro expansion
      @ ~/.julia/dev/OpenCL/src/compiler/execution.jl:66 [inlined]
   [24] macro expansion
      @ ~/.julia/dev/OpenCL/test/atomics.jl:10 [inlined]
   [25] macro expansion
      @ ~/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1798 [inlined]
   [26] macro expansion
      @ ~/.julia/dev/OpenCL/test/atomics.jl:8 [inlined]
   [27] macro expansion
      @ ~/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined]
   [28] top-level scope
      @ ~/.julia/dev/OpenCL/test/atomics.jl:3
  
  caused by: failed process: Process(setenv(`/home/simeon/.julia/artifacts/954f1d0245f593658ca964009b1b0c17834a59a7/bin/spirv-val /tmp/jl_AHwVqZOhMz.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:", "XDG_SESSION_DESKTOP=gnome", "LESS_TERMCAP_us=\e[01;36m", "__MODULES_LMINIT=module use --append /usr/share/Modules/modulefiles:module use --append /etc/modulefiles:module use --append /usr/share/modulefiles", "LESS_TERMCAP_mb=\e[01;32m", "XDG_SESSION_TYPE=wayland", "SYSTEMD_EXEC_PID=3314", "OPENBLAS_DEFAULT_NUM_THREADS=1", "USER=simeon", "QT_IM_MODULE=ibus", "JULIA_PKG_USE_CLI_GIT=1", "JULIA_EDITOR=code", "SSH_ASKPASS=/usr/bin/ksshaskpass", "GDK_BACKEND=x11", "LESS=-R", "MATHEMATICA_HOME=/usr/share/Wolfram/Documentation/14.2/en-us", "USERNAME=simeon", "GDMSESSION=gnome", "MOZ_GMP_PATH=/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed", "__MODULES_SHARE_MANPATH=:1", "XDG_DATA_DIRS=/home/simeon/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/", "LESSOPEN=||/usr/bin/lesspipe.sh %s", "JULIA_VSCODE_REPL=1", "VSCODE_GIT_ASKPASS_NODE=/usr/share/code/code", "SHELL=/usr/bin/zsh", "GJS_DEBUG_OUTPUT=stderr", "QUARTO_PYTHON=/home/simeon/.julia/conda/3/bin/python3", "XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.0IPLA3", "VSCODE_GIT_ASKPASS_EXTRA_ARGS=", "XDG_MENU_PREFIX=gnome-", "VSCODE_GIT_IPC_HANDLE=/run/user/1000/vscode-git-50f165619f.sock", "DEBUGINFOD_URLS=https://debuginfod.fedoraproject.org/ ", "MODULES_CMD=/usr/share/Modules/libexec/modulecmd.tcl", "LESS_TERMCAP_me=\e[0m", "LESS_TERMCAP_so=\e[01;47;34m", "MANAGERPID=3134", "SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/3267,unix/unix:/tmp/.ICE-unix/3267", "LESS_TERMCAP_se=\e[0m", "XMODIFIERS=@im=ibus", "GPG_TTY=not a tty", "HOME=/home/simeon", "TERM=xterm-256color", "HOSTNAME=talentix", "COLORTERM=truecolor", "LESS_TERMCAP_md=\e[01;32m", "HISTSIZE=10000", "WAYLAND_DISPLAY=wayland-0", "INVOCATION_ID=947f3eaa1c03416aa1579f2f83558813", "GIT_ASKPASS=/usr/share/code/resources/app/extensions/git/dist/askpass.sh", "XDG_CURRENT_DESKTOP=GNOME", "LANG=en_US.UTF-8", "LOGNAME=simeon", "XDG_RUNTIME_DIR=/run/user/1000", "LOADEDMODULES=", "SHLVL=0", "MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/session.slice/[email protected]/memory.pressure", "DESKTOP_SESSION=gnome", "GDM_LANG=en_US.UTF-8", "OLDPWD=/home/simeon", "SSH_AUTH_SOCK=/run/user/1000/yubikey-agent/yubikey-agent.sock", "CHROME_DESKTOP=code.desktop", "LS_OPTIONS=--color=auto", "_=/usr/share/code/code", "LESS_TERMCAP_ue=\e[0m", "POCL_PATH_CLANG=/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/bin/clang", "GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/code.desktop", "TERM_PROGRAM_VERSION=1.102.2", "MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=", "MODULESHOME=/usr/share/Modules", "PWD=/home/simeon/.julia/dev/OpenCL", "XDG_SESSION_CLASS=user", "DISPLAY=:0", "TERM_PROGRAM=vscode", "GJS_DEBUG_TOPICS=JS ERROR;JS LOG", "GNOME_SETUP_DISPLAY=:1", "VSCODE_GIT_ASKPASS_MAIN=/usr/share/code/resources/app/extensions/git/dist/askpass-main.js", "POCL_PATH_SPIRV_LINK=/home/simeon/.julia/scratchspaces/627d6b7a-bbe6-5189-83e7-98cc0a5aeadd/bin/spirv_link", "HWLOC_PLUGINS_PATH=/dev/null", "MODULES_RUN_QUARANTINE=LD_LIBRARY_PATH LD_PRELOAD", "_P9K_SSH_TTY=", "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{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, 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{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}}; 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{Any, Any}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, compiler::typeof(OpenCL.compile), linker::typeof(OpenCL.link))
      @ GPUCompiler ~/.julia/packages/GPUCompiler/Ecaql/src/execution.jl:245
   [20] cached_compilation(cache::Dict{Any, Any}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{GPUCompiler.SPIRVCompilerTarget, OpenCL.OpenCLCompilerParams}, 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::var"#atomic_count#11", tt::Type{Tuple{CLDeviceArray{UInt64, 0, 1}}}; kwargs::@Kwargs{})
      @ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:181
   [24] clfunction(f::var"#atomic_count#11", tt::Type{Tuple{CLDeviceArray{UInt64, 0, 1}}})
      @ OpenCL ~/.julia/dev/OpenCL/src/compiler/execution.jl:177
   [25] macro expansion
      @ ~/.julia/dev/OpenCL/src/compiler/execution.jl:66 [inlined]
   [26] macro expansion
      @ ~/.julia/dev/OpenCL/test/atomics.jl:10 [inlined]
   [27] macro expansion
      @ ~/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1798 [inlined]
   [28] macro expansion
      @ ~/.julia/dev/OpenCL/test/atomics.jl:8 [inlined]
   [29] macro expansion
      @ ~/.julia/juliaup/julia-1.11.6+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined]
   [30] top-level scope
      @ ~/.julia/dev/OpenCL/test/atomics.jl:3
Test Summary:          | Pass  Error  Total   Time
atomics                |    2      2      4  20.1s
  atomic_add! (Int32)  |    1             1  17.3s
  atomic_add! (UInt32) |    1             1   0.5s
  atomic_add! (Int64)  |           1      1   2.0s
  atomic_add! (UInt64) |           1      1   0.3s
ERROR: Some tests did not pass: 2 passed, 0 failed, 2 errored, 0 broken.

@simeonschaub simeonschaub marked this pull request as ready for review July 28, 2025 11:07
@simeonschaub simeonschaub changed the title WIP: Int64 atomics Int64 atomics Jul 28, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 28, 2025

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic master) to apply these changes.

Click here to view the suggested changes.
diff --git a/lib/intrinsics/src/atomic.jl b/lib/intrinsics/src/atomic.jl
index 9bbbdbe..c3027bf 100644
--- a/lib/intrinsics/src/atomic.jl
+++ b/lib/intrinsics/src/atomic.jl
@@ -63,23 +63,35 @@ end
 for as in atomic_memory_types
 @eval begin
 
-# There is native support for atomic_xchg on Float32, but not for Float64,
-# so we always reinterpret for consistency.
+        # There is native support for atomic_xchg on Float32, but not for Float64,
+        # so we always reinterpret for consistency.
 @device_function atomic_xchg!(p::LLVMPtr{Float32,$as}, val::Float32) =
-    reinterpret(Float32, atomic_xchg!(reinterpret(LLVMPtr{UInt32,$as}, p),
-                                      reinterpret(UInt32, val)))
-@device_function atomic_xchg!(p::LLVMPtr{Float64,$as}, val::Float64) =
-    reinterpret(Float64, atomic_xchg!(reinterpret(LLVMPtr{UInt64,$as}, p),
-                                      reinterpret(UInt64, val)))
+            reinterpret(
+            Float32, atomic_xchg!(
+                reinterpret(LLVMPtr{UInt32, $as}, p),
+                reinterpret(UInt32, val)
+            )
+        )
+        @device_function atomic_xchg!(p::LLVMPtr{Float64, $as}, val::Float64) =
+            reinterpret(
+            Float64, atomic_xchg!(
+                reinterpret(LLVMPtr{UInt64, $as}, p),
+                reinterpret(UInt64, val)
+            )
+        )
 
 @device_function atomic_cmpxchg!(p::LLVMPtr{Float32,$as}, cmp::Float32, val::Float32) =
     reinterpret(Float32, atomic_cmpxchg!(reinterpret(LLVMPtr{UInt32,$as}, p),
                                          reinterpret(UInt32, cmp),
                                          reinterpret(UInt32, val)))
-@device_function atomic_cmpxchg!(p::LLVMPtr{Float64,$as}, cmp::Float64, val::Float64) =
-    reinterpret(Float64, atomic_cmpxchg!(reinterpret(LLVMPtr{UInt64,$as}, p),
-                                         reinterpret(UInt64, cmp),
-                                         reinterpret(UInt64, val)))
+        @device_function atomic_cmpxchg!(p::LLVMPtr{Float64, $as}, cmp::Float64, val::Float64) =
+            reinterpret(
+            Float64, atomic_cmpxchg!(
+                reinterpret(LLVMPtr{UInt64, $as}, p),
+                reinterpret(UInt64, cmp),
+                reinterpret(UInt64, val)
+            )
+        )
 
 end
 end
@@ -256,7 +268,8 @@ for (op,impl) in [(+)      => atomic_add!,
                   Base.max => atomic_max!,
                   Base.min => atomic_min!]
     @eval @inline atomic_arrayset(A::AbstractArray{T}, I::Integer, ::typeof($op),
-                                  val::T) where {T <: Union{atomic_integer_types...}} =
+        val::T
+    ) where {T <: Union{atomic_integer_types...}} =
         $impl(pointer(A, I), val)
 end
 
diff --git a/test/atomics.jl b/test/atomics.jl
index 068e8cd..f1724bf 100644
--- a/test/atomics.jl
+++ b/test/atomics.jl
@@ -1,16 +1,16 @@
 @testset "atomics" begin
 
-function atomic_count(counter)
-    OpenCL.@atomic counter[] += 1
-    return
-end
+    function atomic_count(counter)
+        OpenCL.@atomic counter[] += 1
+        return
+    end
 
-@testset "atomic_add! ($T)" for T in [Int32, UInt32, Int64, UInt64]
-    if sizeof(T) == 4 || "cl_khr_int64_extended_atomics" in cl.device().extensions
-        a = OpenCL.zeros(T)
-        @opencl global_size=1000 atomic_count(a)
-        @test OpenCL.@allowscalar a[] == 1000
+    @testset "atomic_add! ($T)" for T in [Int32, UInt32, Int64, UInt64]
+        if sizeof(T) == 4 || "cl_khr_int64_extended_atomics" in cl.device().extensions
+            a = OpenCL.zeros(T)
+            @opencl global_size = 1000 atomic_count(a)
+            @test OpenCL.@allowscalar a[] == 1000
+        end
     end
-end
 
 end

@simeonschaub
Copy link
Member Author

Ok, it works now! I was just missing a dispatch so it previously was using the fallback CAS implementation for everything. Still, that shouldn't error, just be slow, so something else is going wrong here.

@codecov
Copy link

codecov bot commented Jul 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.86%. Comparing base (e54fc8a) to head (af17203).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #347   +/-   ##
=======================================
  Coverage   78.86%   78.86%           
=======================================
  Files          12       12           
  Lines         672      672           
=======================================
  Hits          530      530           
  Misses        142      142           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@simeonschaub
Copy link
Member Author

Any ideas why this is now failing on Windows? (and Mac?)

@maleadt
Copy link
Member

maleadt commented Jul 29, 2025

Windows is #317, macOS hangs seem related...

@maleadt
Copy link
Member

maleadt commented Jul 29, 2025

Hm, the timeouts seem to happen on #348 too. So maybe unrelated?

@simeonschaub
Copy link
Member Author

@maleadt it looks like you still need to manually approve the workflow run even if you're the one commiting 😅

@maleadt maleadt merged commit b725007 into JuliaGPU:master Jul 30, 2025
40 of 44 checks passed
@simeonschaub simeonschaub deleted the sds/atomic64 branch July 30, 2025 13:53
@maleadt
Copy link
Member

maleadt commented Jul 30, 2025

Ok, it works now! I was just missing a dispatch so it previously was using the fallback CAS implementation for everything. Still, that shouldn't error, just be slow, so something else is going wrong here.

Do you have that code around still? Would be good to have that as an issue; invalid SPIR-V codegen seems bad enough to investigate.

@simeonschaub
Copy link
Member Author

simeonschaub commented Jul 30, 2025

It was simply using the fallback definition here with an Int64 input, so that code should still reproduce it. I can try reducing it to a standalone reproducer tomorrow

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants