Replace with Flatten.jl
- Dominant language
- Julia
- Stars
- 120
- Forks
- 29
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 1
Description
Turns out Flatten.jl has something similar: `Flatten.modify(CuArray, obj, Array)`. Doesn't use rules, instead eagerly tries to reconstruct objects by calling constructure. That doesn't always work of course:
```
julia> Flatten.modify(CuArray, view(rand(2,2),:,:), Array)
ERROR: MethodError: no method matching SubArray(::CuArray{Float64,2}, ::Tuple{Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}}}, ::Int64, ::Int64)
```
Furthermore, we currently need the `WrappedArray` dispatch rules, but once we have `Base.AbstractWrappedArray` (https://github.com/JuliaLang/julia/pull/31563) we should investigate using this.
Contributor guide
No contributing guide indexed for this repository
Research direction
No file or test is named. Start by comparing the current Adapt.jl handling of WrappedArray with Flatten.modify(CuArray, obj, Array), including the SubArray failure shown in the issue, and review the referenced Base.AbstractWrappedArray Julia pull request. Done means determining whether Flatten.jl can replace the existing dispatch rules without relying on reconstruction that fails for views.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100