Skip to content

Commit cb444f0

Browse files
committed
datadeps: Fix aliasing for degenerate views
1 parent 6b7b35c commit cb444f0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/memory-spaces.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,16 @@ end
453453
function aliasing(x::SubArray{T,N,A}) where {T,N,A<:Array}
454454
if isbitstype(T)
455455
S = CPURAMMemorySpace
456-
return StridedAliasing{T,ndims(x),S}(RemotePtr{Cvoid}(pointer(parent(x))),
456+
p = parent(x)
457+
NA = ndims(p)
458+
raw_inds = parentindices(x)
459+
inds = ntuple(i->raw_inds[i] isa Integer ? (raw_inds[i]:raw_inds[i]) : UnitRange(raw_inds[i]), NA)
460+
sz = ntuple(i->length(inds[i]), NA)
461+
return StridedAliasing{T,NA,S}(RemotePtr{Cvoid}(pointer(p)),
457462
RemotePtr{Cvoid}(pointer(x)),
458-
parentindices(x),
459-
size(x), strides(x))
463+
inds,
464+
sz,
465+
strides(p))
460466
else
461467
# FIXME: Also ContiguousAliasing of container
462468
#return IteratedAliasing(x)

0 commit comments

Comments
 (0)