Fix sub_materialize for GPU arrays#261
Merged
dlfivefifty merged 6 commits intoJuliaLinearAlgebra:masterfrom Oct 6, 2025
Merged
Fix sub_materialize for GPU arrays#261dlfivefifty merged 6 commits intoJuliaLinearAlgebra:masterfrom
sub_materialize for GPU arrays#261dlfivefifty merged 6 commits intoJuliaLinearAlgebra:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #261 +/- ##
=======================================
Coverage 89.52% 89.52%
=======================================
Files 11 11
Lines 1938 1938
=======================================
Hits 1735 1735
Misses 203 203 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jishnub
approved these changes
Jul 3, 2025
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.
Currently,
sub_materialize(throughsub_materialize_axes) falls back to materializing on CPU. This PR generalizes that logic by determining the output destination withsimilar, which helps to support non-Array types like GPU arrays. As a stand-in for other GPU arrays, I test this using JLArrays.JLArray, which is a reference implementation for the GPUArrays.jl interface that runs on CPU.An alternative design would be to define memory layouts for GPU arrays (i.e. #9), which would allow more customizability for GPU array backends, however I think it is helpful to have fallbacks that "just work" if reasonable parts of the Base AbstractArray interface are implemented.
I hit this issue because I was testing out
BlockArrays.BlockedArraywrapping a GPU array and noticed that callingA[Block(1, 1)]to access a block instantiated the block on CPU, this PR fixes that issue.