Skip to content

Commit 7e88377

Browse files
committed
subset_vptr has to check for possible discontiguous indicator.
1 parent 31e640a commit 7e88377

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/memory_ops_common.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,18 @@ function append_loop_valdims!(valcall::Expr, loop::Loop)
4545
end
4646
nothing
4747
end
48+
const DISCONTIGUOUS = Symbol("##DISCONTIGUOUSSUBARRAY##")
4849
function subset_vptr!(ls::LoopSet, vptr::Symbol, indnum::Int, ind, previndices, loopindex)
4950
subsetvptr = Symbol(vptr, "_subset_$(indnum)_with_$(ind)##")
5051
valcall = Expr(:call, Expr(:curly, :Val, 1))
5152
if indnum > 1
53+
offset = first(previndices) === DISCONTIGUOUS
5254
valcall = Expr(:call, lv(:valsum), valcall)
5355
for i 1:indnum-1
5456
if loopindex[i]
55-
append_loop_valdims!(valcall, getloop(ls, previndices[i]))
57+
append_loop_valdims!(valcall, getloop(ls, previndices[i+offset]))
5658
else
57-
for loopdep loopdependencies(ls.opdict[previndices[i]])
59+
for loopdep loopdependencies(ls.opdict[previndices[i+offset]])
5860
append_loop_valdims!(valcall, getloop(ls, loopdep))
5961
end
6062
end
@@ -104,7 +106,6 @@ function checkforoffset!(
104106
end
105107
end
106108

107-
const DISCONTIGUOUS = Symbol("##DISCONTIGUOUSSUBARRAY##")
108109
function array_reference_meta!(ls::LoopSet, array::Symbol, rawindices, elementbytes::Int, var::Union{Nothing,Symbol} = nothing)
109110
vptrarray = vptr(array)
110111
add_vptr!(ls, array, vptrarray) # now, subset

0 commit comments

Comments
 (0)