Skip to content
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

Unexpected behavior of deepcopy of an OffsetArray{<:Any, <:Any, <:MtlArray} #523

Open
simone-silvestri opened this issue Jan 22, 2025 · 0 comments

Comments

@simone-silvestri
Copy link

Playing around with Metal I can across some unexpected behavior with OffsetArrays of MtlArrays concerning deepcopy:

julia> a = MtlArray(zeros(Float32, 2));

julia> a = OffsetArray(a, -1);

julia> b = deepcopy(a);

julia> fill!(b, 1);

julia> a
2-element OffsetArray(::MtlVector{Float32, Metal.PrivateStorage}, 0:1) with eltype Float32 with indices 0:1:
 1.0
 1.0

Note that this does not happen on pure MtlArrays

julia> a = MtlArray(zeros(Float32, 2));

julia> b = deepcopy(a);

julia> fill!(b, 1);

julia> a
4-element OffsetArray(::MtlVector{Float32, Metal.PrivateStorage}, 0:3) with eltype Float32 with indices 0:3:
 0.0
 0.0

Nor with OffsetArrays of other types:

julia> a = OffsetArray(zeros(2), -1);

julia> b = deepcopy(a);

julia> fill!(b, 1);

julia> a
2-element OffsetArray(::Vector{Float64}, 0:1) with eltype Float64 with indices 0:1:
 0.0
 0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant