Use GPUToolbox's Float64-free math overrides on devices without fp64 - #497
Merged
Merged
Conversation
Base computes some single-precision math in double precision, e.g., `div` on Float32 (on Julia 1.12 and 1.13), `sind` and `cosd`, or inversion of ComplexF32. On devices that don't support Float64, stack GPUToolbox.Overlays.float64_overrides underneath SPIRVIntrinsics' method table to keep these computations in single precision.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #497 +/- ##
==========================================
+ Coverage 84.26% 84.32% +0.05%
==========================================
Files 14 14
Lines 1106 1110 +4
==========================================
+ Hits 932 936 +4
Misses 174 174 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Several Base methods compute single-precision results in double precision, so they fail to compile for devices without Float64 support:
div,fldandcldof Float32 values on Julia 1.12 and 1.13,sindand friends, inversion and division ofComplexF32,sincospi/cispi, and comparisons between Float32/Float16 values and 32-bit integers. On such devices, this stacksGPUToolbox.Overlays.float64_overrides(JuliaGPU/GPUToolbox.jl#21, GPUToolbox 3.1) underneath SPIRVIntrinsics' method table, which replaces them with Float64-free implementations. Devices that support Float64, like PoCL, keep using Base's more accurate implementations.Since PoCL supports Float64, the new test compiles
div,sindandinv(::ComplexF32)kernels for a copy of the device's target withsupports_fp64=false, which makes the compiler reject any use of Float64.pocl/intrinsicspasses locally.