JuliaSIMD / JuliaSIMD/LoopVectorization.jl

TypeError in typeassert in loop with view

Open
#365 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
789
Forks
73
PR merge metrics
No merged PRs in 30d

Description

This MWE
```julia
using LoopVectorization

A = [iz*1e2 + iy*1e1 + ix for ix=1:7, iy=1:5, iz=1:6];
sendbuf = zeros(size(A,2), size(A,3));
ix, iy, iz = 2, 1:size(A,2), 1:size(A,3);

dst = view(sendbuf,:);
src = view(view(A,ix, :, :),:);

@tturbo for ix = 1:length(dst)
dst[ix] = src[ix]
end
```
produces the following error:
```julia
julia> using LoopVectorization

julia> A = [iz*1e2 + iy*1e1 + ix for ix=1:7, iy=1:5, iz=1:6];

julia> sendbuf = zeros(size(A,2), size(A,3));

julia> ix, iy, iz = 2, 1:size(A,2), 1:size(A,3);

julia> dst = view(sendbuf,:);

julia> src = view(view(A,ix, :, :),:);

julia> @tturbo for ix = 1:length(dst)
dst[ix] = src[ix]
end
ERROR: TypeError: in typeassert, expected Tuple{Int64}, got a value of type Nothing
Stacktrace:
[1] (ArrayInterface.StrideIndex{1, nothing, nothing, S, O} where {S, O})(s::Tuple{Static.StaticInt{1}}, o::Tuple{Static.StaticInt{1}})
@ ArrayInterface ~/.julia/packages/ArrayInterface/W1AVE/src/array_index.jl:197
[2] (ArrayInterface.StrideIndex{1, nothing, nothing, S, O} where {S, O})(a::SubArray{Float64, 1, Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}}, Tuple{Base.Slice{Base.OneTo{Int64}}}, true})
@ ArrayInterface ~/.julia/packages/ArrayInterface/W1AVE/src/array_index.jl:200
[3] ArrayInterface.StrideIndex(a::SubArray{Float64, 1, Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}}, Tuple{Base.Slice{Base.OneTo{Int64}}}, true})
@ ArrayInterface ~/.julia/packages/ArrayInterface/W1AVE/src/array_index.jl:203
[4] bytestrideindex
@ ~/.julia/packages/LayoutPointers/fHXhH/src/stridedpointers.jl:61 [inlined]
[5] stridedpointer_preserve(A::SubArray{Float64, 1, Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}}, Tuple{Base.Slice{Base.OneTo{Int64}}}, true})
@ LayoutPointers ~/.julia/packages/LayoutPointers/fHXhH/src/stridedpointers.jl:73
[6] top-level scope
@ ./REPL[7]:1
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.