Repository navigation
Remove Metal warning, align default tol, and improve Metal gather - #91
Merged
eloualiche merged 7 commits intoNov 3, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #91 +/- ##
=======================================
Coverage ? 74.85%
=======================================
Files ? 12
Lines ? 1233
Branches ? 0
=======================================
Hits ? 923
Misses ? 310
Partials ? 0 ☔ 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.
Remove
Metal.allowscalar(false)inext/MetalExt.jl, which creates a warning and does nothing useful. Metal arrays now use default shared storage, where scalar indexing is always allowed. RemoveCUDA.allowscalar(false)inext/CUDAExt.jltoo: as a top-level call it runs during precompilation rather than when the package loads, and a package should not set this global for its users anyway. Also make the prebuilt solver methods use the documented defaulttol(1e-8 for Float64, 1e-6 for Float32, instead ofsqrt(eps(T)), which is 3.5e-4 for Float32). Float32 callers that do not passtolnow run more iterations; FixedEffectModels passes it explicitly and is unaffected. Finally, run every benchmark attol = 1e-6so that CPU and Metal timings are comparable, and update the timings, measured on Metal 1.12.0.Finally, choose the Metal gather from group sizes and row order. The old rule looked only at the number of levels, so it could use atomic adds where threads keep hitting the same coefficient. Atomics are now used only when no group exceeds 0.005% of rows and rows are not clustered by group. Otherwise each group gets a threadgroup, with a width set by the largest group relative to the number of levels. CUDA is unchanged; the constants were calibrated on an M1 Max.
Also remove the per-block forward scatter kernel: the forward
mul!, which runs once per solve, now calls the fused kernel thatbidiag_forward!uses.tol = 1e-6Small problems are still slower on Metal than on the CPU because each iteration has a fixed cost of about 1.7 ms.