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:
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.
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:Furthermore, we currently need the
WrappedArray
dispatch rules, but once we haveBase.AbstractWrappedArray
(https://github.com/JuliaLang/julia/pull/31563) we should investigate using this.