Repository navigation
CUDA: fix Float64 add and float swap on device - #81
Merged
Merged
Conversation
Two paths of the new CUDA extension did not compile in kernels: - The Float64 add checked `compute_capability() >= v"6.0"`, comparing against a `VersionNumber`, which is not GPU compatible (dynamic `isless`). Compare the major component of the SimpleVersion instead. - The float swap looked up the integer type through `CUDA.inttype`, leaving `reinterpret` with a dynamic type. Spell out the Float32/UInt32 and Float64/UInt64 methods. Tests now cover float swap on every backend and Float64 on CUDA and OpenCL, which is what caught this in KernelAbstractions' CI. Assisted-by: Claude Code (Fable 5.1)
vchuravy
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 9, 2026
Atomix 1.2.0's CUDA extension does not compile Float64 `@atomic +=` or float `@atomicswap` inside kernels (JuliaConcurrent/Atomix.jl#81), so require 1.2.1. The "Supported operations" table gains the atomic load, store and swap forms that Atomix 1.2 made portable, and a note on how memory orderings are treated on GPU backends. Assisted-by: Claude Code (Fable 5.1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #80. KernelAbstractions' CI (JuliaGPU/KernelAbstractions.jl#737) ran the new float atomics on CUDA and found two paths of the CUDA extension that do not compile in kernels:
compute_capability() >= v"6.0", comparing aSimpleVersionagainst aVersionNumber. That is a dynamicislesson device (InvalidIRError: unsupported dynamic function invocation (call to isless); aMethodErroron 1.13). It now compares the major component of theSimpleVersion.CUDA.inttype, which leftreinterpretwith a dynamic type. The Float32/UInt32 and Float64/UInt64 methods are now spelled out.The #80 tests only covered Float32 and integer swap, which is why this slipped through. Every backend's test file now also swaps a float, and the CUDA and OpenCL files gain a Float64 testset mirroring the Float32 one.
Verified locally on Julia 1.10: Atomix
--CUDA(CUDA v6.3.1, cc 7.5) 9/9 testsets,--OpenCL(pocl) 9/9, and KernelAbstractions' atomics testsuite onOpenCLBackend36/36.This needs a 1.2.1 release; 1.2.0's CUDA extension fails on any Float64
@atomic +=and any float@atomicswap.🤖 Generated with Claude Code
https://claude.ai/code/session_01DnYMbgSmZQr7KtRUwei63a