Repository navigation
Use GPUToolbox's shared throw overrides, including for throw_domerr_powbysq - #781
Merged
Merged
Conversation
Julia 1.10 formats the message of the error that `Rational` throws for a typemin denominator, and Julia 1.10 and 1.11 that of negating a typemin numerator, which fails to compile for the device. That breaks every kernel that constructs a rational with a negative denominator or negates one. GPUToolbox 3.6's `throw_overrides` throw these errors with a constant message instead.
GPUToolbox's shared overrides throw through `Overlays.device_throw`, with a constant exception type and message. Report them with `@gputhrow`, so that these exceptions report their type and message like oneAPI's own quirks, instead of as an exception of unknown type.
oneAPI overlaid `throw_domerr_powbysq` for `::Any`, `::Integer` and `::AbstractMatrix` bases. When Julia 1.12+ loads a package image, it only trusts a kernel's edge to an overlay that no more specific method of the same table intersects, and verifies the others against the global method table, which doesn't have the overlay. The narrower overlays shadowed the `::Any` one, so every kernel computing an integer power was dropped from the image and compiled again in each session (fixed upstream by JuliaLang/julia#64727). GPUToolbox 3.7's `throw_overrides` has a single override, which reports the same exception through `device_throw`, so drop oneAPI's.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #781 +/- ##
========================================
Coverage 86.00% 86.01%
========================================
Files 55 55
Lines 5475 5084 -391
========================================
- Hits 4709 4373 -336
+ Misses 766 711 -55 ☔ 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.
Requires GPUToolbox 3.7 (JuliaRegistries/General#177697). Supersedes #764, whose two commits are rebased here onto the throw-site reporting of #768.
oneAPI overlaid
Base.throw_domerr_powbysqthree times, for::Any,::Integerand::AbstractMatrixbases, with identical bodies. When Julia 1.12 or 1.13 loads a package image, it only trusts a kernel's edge to an overlay method that no more specific method of the same table intersects, and verifies other edges against the global method table, which doesn't have the overlay. The narrower overlays shadowed the::Anyone, so every kernel computing an integer power was dropped from the image and compiled again in each session. JuliaLang/julia#64727 fixes that upstream; JuliaGPU/GPUToolbox.jl#46 adds a single shared override toGPUToolbox.Overlays.throw_overrides, like the other back-ends use.This PR:
throw_overridesbelow oneAPI's own tables (with and without Float64 support), which also makesRationalarithmetic compile on Julia 1.10 and 1.11, where Base formats some of its error messages at run time;GPUToolbox.Overlays.device_throwwith@gputhrow, so that the shared overrides' exceptions report their type and reason like oneAPI's own quirks;throw_domerr_powbysqoverlays in favor of the shared one.Checked on macOS by compiling kernels through GPUCompiler with a device-independent config (both SPIR-V back-ends, with and without Float64): with
debug_level=1,a[1]^pregisters aDomainErrorsite with reason "Cannot raise an integer to a negative power" on Julia 1.10, 1.12 and 1.13, and on Julia 1.10 theRationalkernels register the shared overrides'ArgumentErrorandOverflowError. On Julia 1.12 and 1.13, no method of oneAPI's or SPIRVIntrinsics' method table has interferences. The new tests in test/execution.jl passed on an Iris Xe with Julia 1.10 and 1.12.