Add a pass to apply fastmath attributes.#804
Merged
Merged
Conversation
Member
|
Nice this aligns with the direction I am exploring in #800 where the special lowering of |
Member
Author
|
Yep; I'll rebase that PR onto this. |
This was referenced May 20, 2026
maleadt
added a commit
to JuliaGPU/CUDA.jl
that referenced
this pull request
May 21, 2026
Building on JuliaGPU/GPUCompiler.jl#805, JuliaGPU/GPUCompiler.jl#804, JuliaGPU/GPUCompiler.jl#800, avoid some of the uses of `libdevice`'s intrinsics, instead emitting vanilla LLVM IR and having GPUCompiler.jl post-process it into what we need in PTX. This has many advantages, including (potentially) better optimization, compatibility with LLVM tools like Enzyme, etc. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
GPUCompiler.jl/CUDA.jl are currently using CUDA's libdevice in a way that's not aligned with LLVM: We use the library whenever possible, setting flags like
__CUDA_PREC_SQRTto make it behave "precisely" whenfastmath=false(the default). That's a fine way of doing things, but doesn't align with LLVM, which instead treatslibdeviceas "the fast library", never sets__CUDA_PREC_SQRT, and instead uses regular instructions (@llvm.sqrt) for the precise versions. This surfaces when switching to LLVM's NVVMReflect pass, #785, so let's align GPUCompiler.jl with LLVM.To that end, I'll be switching to LLVM intrinsics in CUDA.jl, however, that requires us setting appropriate function/instruction attributes when compiling with
fastmath=true. Which is what this PR does.cc @vchuravy