-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
For views of more than 2 dimensions, DiskIndex
is not inferred, which then spreads - so even getindex
becomes Any
.
I think this is because of the recursive call to _resolve_indices
(there are multiple dispatches, in the case of the MWE below it is this one):
DiskArrays.jl/src/diskindex.jl
Lines 52 to 56 in 716f509
function _resolve_indices(chunks, i, indices_pre::DiskIndex, strategy::BatchStrategy) | |
inow = first(i) | |
indices_new, chunksrem = process_index(inow, chunks, strategy) | |
_resolve_indices(chunksrem, tail(i), merge_index(indices_pre, indices_new), strategy) | |
end |
MWE:
import DiskArrays
using DiskArrays.TestTypes
a = AccessCountDiskArray(reshape(1:24, 2, 3, 4), chunksize=(2, 2, 2))
a_view = @view a[:,1:2,2]
a_view2= @view a[:,1:2,2:4]
@code_warntype DiskArrays.DiskIndex(a_view, (1:1,1:1), DiskArrays.NoBatch()) # all good
@code_warntype DiskArrays.DiskIndex(a_view2, (1:1,1:1,1:1), DiskArrays.NoBatch()) #DiskArrays.DiskIndex
@code_warntype a_view[1:1,1:1] # All good
@code_warntype a_view2[1:1,1:1] # Any
I've tried just adding an @inline
and a Base.@constprop :aggressive
but those didn't work.
@lupemba ran into this one in JuliaGeo/CommonDataModel.jl#35
Metadata
Metadata
Assignees
Labels
No labels