-
Notifications
You must be signed in to change notification settings - Fork 90
Reduce number of mul! methods
#472
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
Conversation
|
Seeing the Metal.jl CI failure, I guess this is a breaking change? |
|
Sorry for seemingly abandoning this PR. I was working on JuliaLang/julia#49806, and now I'm working on including Regarding your question, this PR by itself is breaking, that is correct. But we can preempt breakage by introducing a few methods in Metal.jl first. Eventually, starting with Julia v1.10, there will be only one method overload that will handle multiplication by once-wrapped GPUArrays, where the wrappers include |
Of course, no problem; thanks for doing this! |
src/host/linalg.jl
Outdated
| transA = tA == 'N' ? identity : tA == 'T' ? transpose : adjoint | ||
| generic_matmatmul!(C, transA(A), B, a, b) | ||
| end | ||
| function LinearAlgebra.generic_matvecmul!(C::AbstractGPUVector, tA::AbstractChar, A::AbstractGPUMatrix, B::AbstractGPUVector, _add::MulAddMul = MulAddMul()) |
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.
It's not really related to this PR but I think it's a shame the the generic matmul in LinearAlgebra isn't like the one defined in this file, i.e. just three nested loops without trying to be smart about memory. The fact that it's necessary to define a "generic" version here is evidence that the version in LinearAlgebra isn't generic.
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.
Do you think this is fixable by rewriting the generic version as you say, and have a more specific signature for the smart-about-memory version?
|
Ah, a new issue with Metal.jl; a bad |
Interesting; I guess Metal.jl should protect against that to avoid an abort. |
|
Finally, all green. Let's tag things to get this out there! |
In the context of JuliaGPU/CUDA.jl#1904 I realized that between LinearAlgebra and CUDA there is yet another layer, which is this GPUArrays.jl. I believe that if we hook into the method hierarchy one level lower, many things will greatly simplify. I don't know if this should be annotated with
@inlineso that potentially constant propagation could eliminate the character fiddling. Comments welcome!