-
Notifications
You must be signed in to change notification settings - Fork 46
Implement BroadcastStyle using Adapt's unwrap_type #378
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #378 +/- ##
===========================================
- Coverage 95.70% 74.37% -21.34%
===========================================
Files 6 6
Lines 466 359 -107
===========================================
- Hits 446 267 -179
- Misses 20 92 +72 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@jishnub knows far more about the current state of the package than I do, so I'll defer to him. For the context on Adapt, my only concern was how it opened everything up for invalidation. Assuming that issue has been resolved, I don't have any objections. |
That's been fixed years ago as per your request. |
That was my understanding too. I only brought it up because of @vchuravy's mention of past concerns. |
We should probably still be careful, though. |
Yeah, that's a pretty rough |
Referring also to this discussion: julia> using CUDA
julia> a = reshape(cu(collect(1:24)), 2, 3, 4);
julia> sa = OffsetArray(a, (2, 3, 4));
julia> (@view sa[3:4,4:5,5:6]) == a[1:2,1:2,1:2]
ERROR: Scalar indexing is disallowed. ... and supposedly something similar with a julia> collect(sa)
ERROR: Scalar indexing is disallowed. These issues can be fixed as shown here, but the disadvantage is that this needs a specific dependency of the extension on I guess the first problem may be fixed in a better way by implementing extensions to |
It seems like the following definition is missing in Base? function Base.Broadcast.BroadcastStyle(W::Type{<:SubArray})
return Base.Broadcast.BroadcastStyle(Adapt.unwrap_type(W))
end At least, |
The goal here is to support GPU accelerated broadcasts of OffsetArrays.
We tried this before and @timholy had some concerns, but with
unwrap_type
we shouldbe able to implement this throughout the ecosystem correctly.
One issue for me is that it changes the behavior of a core functionailty depending on the fact if Adapt.jl
is loaded or not, I would advocate to turn Adapt.jl into a proper dependency again.
TODO