Repository navigation
Use the generic implementation for CUDA arrays - #87
Merged
Merged
Conversation
With UnsafeAtomics 0.4 and the device scope, the generic implementation emits the atomics CUDA.jl would, and also honours the ordering, which the extension ignored. CUDACore stays a weak dependency to keep older CUDA.jl versions on the extension: before 6.2 they compile with Julia's own LLVM, which can't lower all of these atomics, and before 6.5 their NVPTX back-end lowers float subtraction to a compare-and-swap loop and doesn't order atomics on Pascal GPUs.
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.
With UnsafeAtomics 0.4 (whose atomics GPUCompiler legalizes) and the device scope (previous PR), the generic implementation emits the same atomics for CUDA arrays as CUDA.jl's
atomic_*!functions, and also honours the requested ordering, which the extension ignored. The same as #85 did for Metal. For@atomic A[i] += 1f0it emitsfence.sc.gpu; atom.acquire.gpu.global.add.f32, i.e. a sequentially consistent device-scope atomic.CUDACore stays a weak dependency, with compat 6.5, so environments with an older CUDA.jl keep resolving Atomix 1.5 with the extension:
atomicrmw fadd half, fences, ordered loads);fsubto a compare-and-swap loop, and doesn't order atomics on Pascal GPUs. [NVPTX_LLVM_Backend] Backport fixes for atomics before sm_70 and for fsub JuliaPackaging/Yggdrasil#15013 fixes that, and CUDA.jl 6.5 will be released after it.Until CUDA.jl 6.5 is out, the CUDA CI job can't resolve CUDACore, and nobody can install this version together with CUDACore. With the bound relaxed, the CUDA tests pass on the generic implementation with CUDACore 6.4.2 on Julia 1.10 and 1.12 (RTX 5080), as does KernelAbstractions' histogram example.