Skip to content

Conversation

@vchuravy
Copy link
Member

No description provided.

@vchuravy
Copy link
Member Author

] add Atomix#vc/unsafe_atomics UnsafeAtomics#master KernelAbstractions#vc/unsafe_atomics

@pxl-th
Copy link
Member

pxl-th commented Dec 10, 2024

Simple @atomic x[1] += 1f0, fails with error below.
Previously we'd dispatch from atomic_pointermodify to llvm_atomic_op, but now we do atomic_pointerreplace which triggers this error.

pxlth@Tower:~/.julia/dev/AMDGPU$ jl t.jl 
Precompiling AMDGPU...
  1 dependency successfully precompiled in 9 seconds. 124 already precompiled.
ERROR: LoadError: InvalidIRError: compiling MethodInstance for ker!(::AMDGPU.Device.ROCDeviceVector{Float32, 1}) resulted in invalid LLVM IR
Reason: unsupported call to an unknown function (call to ijl_get_nth_field_checked)
Stacktrace:
 [1] indexed_iterate
   @ ./namedtuple.jl:172
 [2] multiple call sites
   @ unknown:0
Reason: unsupported call to an unknown function (call to jl_f_tuple)
Stacktrace:
 [1] indexed_iterate
   @ ./namedtuple.jl:172
 [2] multiple call sites
   @ unknown:0
Reason: unsupported call to an unknown function (call to ijl_get_nth_field_checked)
Stacktrace:
 [1] atomic_pointermodify
   @ ~/.julia/packages/UnsafeAtomics/y7d6Q/ext/UnsafeAtomicsLLVM/atomics.jl:276
 [2] modify!
   @ ~/.julia/packages/UnsafeAtomics/y7d6Q/ext/UnsafeAtomicsLLVM/internal.jl:23
 [3] modify!
   @ ~/.julia/packages/UnsafeAtomics/y7d6Q/src/core.jl:11
 [4] modify!
   @ ~/.julia/packages/Atomix/2spi2/src/core.jl:33
 [5] ker!
   @ ~/.julia/dev/AMDGPU/t.jl:5
Reason: unsupported dynamic function invocation (call to atomic_pointerreplace)
Stacktrace:
 [1] atomic_pointermodify
   @ ~/.julia/packages/UnsafeAtomics/y7d6Q/ext/UnsafeAtomicsLLVM/atomics.jl:276
 [2] modify!
   @ ~/.julia/packages/UnsafeAtomics/y7d6Q/ext/UnsafeAtomicsLLVM/internal.jl:23
 [3] modify!
   @ ~/.julia/packages/UnsafeAtomics/y7d6Q/src/core.jl:11
 [4] modify!
   @ ~/.julia/packages/Atomix/2spi2/src/core.jl:33
 [5] ker!
   @ ~/.julia/dev/AMDGPU/t.jl:5

@vchuravy
Copy link
Member Author

I guess I shouldn't have removed that code xD

Can you open a PR that re-adds it and adds a test?

@pxl-th
Copy link
Member

pxl-th commented Dec 11, 2024

Yeah, will do in a bit

@vchuravy
Copy link
Member Author

Thanks Anton!

@vchuravy
Copy link
Member Author

Can you run the tests again? I am travelling right now without access to GPUs :)

@pxl-th
Copy link
Member

pxl-th commented Dec 12, 2024

Yeah, they all pass now.

@pxl-th pxl-th force-pushed the vc/unsafe_atomics branch from c046c1f to ade95fc Compare January 6, 2025 00:34
@pxl-th pxl-th marked this pull request as ready for review January 6, 2025 00:34
@pxl-th pxl-th merged commit 03ca435 into master Jan 6, 2025
3 checks passed
@pxl-th pxl-th deleted the vc/unsafe_atomics branch January 6, 2025 07:22
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.

3 participants