-
-
Notifications
You must be signed in to change notification settings - Fork 77
Fix method overwriting error during precompilation on Apple Silicon #769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Resolves #768 by making extension method signatures more specific The issue was that the BLIS extension method for preallocated cache was dispatching on any type A, causing method signature conflicts with the base fallback methods during precompilation. The fix makes the preallocated BLIS method dispatch on the exact type (Matrix{Float64}) that matches the preallocated cache, while keeping the base fallback methods for when extensions aren't loaded. Changes: - BLIS extension: Change from `A` to `A::Matrix{Float64}` for preallocated method - Metal extension: Keep `A::AbstractArray` (already correct for dynamic computation) - CUDA extension: Already correct with `A::AbstractArray` - Base methods: Restored individual fallback methods 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
78d9c64 to
6ad73fc
Compare
Comment on lines
+206
to
208
| function LinearSolve.init_cacheval(alg::BLISLUFactorization, A::Matrix{Float64}, b, u, Pl, Pr, | ||
| maxiters::Int, abstol, reltol, verbose::Bool, | ||
| assumptions::OperatorAssumptions) |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| function LinearSolve.init_cacheval(alg::BLISLUFactorization, A::Matrix{Float64}, b, u, Pl, Pr, | |
| maxiters::Int, abstol, reltol, verbose::Bool, | |
| assumptions::OperatorAssumptions) | |
| function LinearSolve.init_cacheval( | |
| alg::BLISLUFactorization, A::Matrix{Float64}, b, u, Pl, Pr, | |
| maxiters::Int, abstol, reltol, verbose::Bool, | |
| assumptions::OperatorAssumptions) |
| default_alias_b(::MetalLUFactorization, ::Any, ::Any) = false | ||
|
|
||
| function LinearSolve.init_cacheval(alg::MetalLUFactorization, A, b, u, Pl, Pr, | ||
| function LinearSolve.init_cacheval(alg::MetalLUFactorization, A::AbstractArray, b, u, Pl, Pr, |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| function LinearSolve.init_cacheval(alg::MetalLUFactorization, A::AbstractArray, b, u, Pl, Pr, | |
| function LinearSolve.init_cacheval( | |
| alg::MetalLUFactorization, A::AbstractArray, b, u, Pl, Pr, |
ChrisRackauckas
commented
Sep 3, 2025
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.
Summary
Fixes #768 by resolving method overwriting errors during precompilation when adding
LinearSolveAutotuneon Apple Silicon.Problem
The issue occurred because the BLIS extension's method for preallocated cache was dispatching on
A(any type), creating the same method signature as the base fallback method, causing Julia to report method overwriting during precompilation.Root Cause
init_cacheval(::BLISLUFactorization, A, ...)init_cacheval(alg::BLISLUFactorization, A, ...)(same signature)A, causing conflictSolution
Made the BLIS extension method more specific to match the actual type of its preallocated cache:
BLIS Extension: Changed from
AtoA::Matrix{Float64}for the preallocated method, sincePREALLOCATED_BLIS_LUis created withrand(0, 0)which producesMatrix{Float64}.Other Extensions:
A::AbstractArray(does dynamic computation)A::AbstractArrayBase Methods: Restored individual fallback methods that return
nothingwhen extensions aren't loaded.Dispatch Hierarchy
Now the dispatch works correctly:
init_cacheval(::BLISLUFactorization, ::Matrix{Float64}, ...)→ BLIS extension (preallocated)init_cacheval(::BLISLUFactorization, ::AbstractMatrix{Union{Float32,ComplexF32,ComplexF64}}, ...)→ BLIS extension (specialized)init_cacheval(::BLISLUFactorization, A, ...)→ Base fallback (any other type)Test plan
🤖 Generated with Claude Code