Skip to content

Use GPUToolbox's Float64-free math overrides on devices without fp64 - #497

Merged
maleadt merged 1 commit into
mainfrom
tb/gputoolbox-math
Sep 23, 2026
Merged

maleadt merged 1 commit into
mainfrom
tb/gputoolbox-math

Conversation

@maleadt

@maleadt maleadt commented Sep 23, 2026

Copy link
Copy Markdown
Member

Several Base methods compute single-precision results in double precision, so they fail to compile for devices without Float64 support: div, fld and cld of Float32 values on Julia 1.12 and 1.13, sind and friends, inversion and division of ComplexF32, sincospi/cispi, and comparisons between Float32/Float16 values and 32-bit integers. On such devices, this stacks GPUToolbox.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, sind and inv(::ComplexF32) kernels for a copy of the device's target with supports_fp64=false, which makes the compiler reject any use of Float64. pocl/intrinsics passes locally.

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

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.32%. Comparing base (84f8d26) to head (345f512).
⚠️ Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maleadt
maleadt merged commit 7380d47 into main Sep 23, 2026
15 checks passed
@maleadt
maleadt deleted the tb/gputoolbox-math branch September 23, 2026 14:12
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.

1 participant