# Tullio 0.3.3 fails in Julia 1.7.2

**URL:** https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453
**Category:** General Usage
**Tags:** tullio
**Created:** [February 14, 2022, 6:59pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453 "2022-02-14T18:59:05Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![00shiv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00shiv/32/8903_2.png) [@00shiv](https://discourse.julialang.org/u/00shiv)
#### Post date: [February 14, 2022, 6:59pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/1 "2022-02-14T18:59:05Z")

</div>

I have some Tullio 0.3.3.) code that works in 1.7.1 but not 1.7.2. I get a fairly large error message which I attach at the bottom. Before I try to produce a MWE I was wondering if someone knows something already. Thanks.  
–shiv–

ERROR: MethodError: no method matching vconvert(::Type{VectorizationBase.VecUnroll{N, 16, Float32, VectorizationBase.Vec{16, Float32}} where N}, ::VectorizationBase.VecUnroll{7, 16, Float32, VectorizationBase.Vec{16, Float32}}) Closest candidates are: vconvert(::Type{VectorizationBase.VecUnroll{N, W, T, V}}, ::VectorizationBase.VecUnroll{N, W, T} where {W, T}) where {N, W, T, V} at C:\Users\00shi.julia\packages\VectorizationBase\yDGcX\src\llvm\_intrin\conversion.jl:137 vconvert(::Type{VectorizationBase.VecUnroll{N, W, T, V}}, ::VectorizationBase.VecUnroll{N, W, T, V}) where {N, W, T, V} at C:\Users\00shi.julia\packages\VectorizationBase\yDGcX\src\llvm\_intrin\conversion.jl:140 vconvert(::Type{V}, ::VectorizationBase.VecUnroll{N, W, T, V}) where {N, W, T, V\<:VectorizationBase.AbstractSIMDVector} at C:\Users\00shi.julia\packages\VectorizationBase\yDGcX\src\llvm\_intrin\conversion.jl:107 … Stacktrace: [1] convert @ C:\Users\00shi.julia\packages\VectorizationBase\yDGcX\src\base\_defs.jl:154 [inlined] [2] \_promote @ .\promotion.jl:327 [inlined] [3] promote @ .\promotion.jl:350 [inlined] [4] add\_fast @ C:\Users\00shi.julia\packages\VectorizationBase\yDGcX\src\base\_defs.jl:88 [inlined] [5] macro expansion @ C:\Users\00shi.julia\packages\LoopVectorization\ndGJi\src\reconstruct\_loopset.jl:713 [inlined] [6] _turbo_!(::Val{(false, 0, 0, 0, false, 16, 64, 32, 64, 49152, 1310720, 12582912, 0x0000000000000001)}, ::Val{(Symbol(“##DROPPED#CONSTANT##”), Symbol(“##DROPPED#CONSTANT##”), LoopVectorization.OperationStruct(0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, LoopVectorization.constant, 0x0001, 0x00), Symbol(“##GLOBAL##CONSTANT##”), :nothing, LoopVectorization.OperationStruct(0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, LoopVectorization.constant, 0x0002, 0x00), Symbol(“##DROPPED#CONSTANT##”), Symbol(“##DROPPED#CONSTANT##”), LoopVectorization.OperationStruct(0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, LoopVectorization.constant, 0x0003, 0x00), :numericconstant, Symbol(“###zero###8###”), LoopVectorization.OperationStruct(0x00000000000000000000000000000001, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, LoopVectorization.constant, 0x0004, 0x00), :LoopVectorization, :conditionalload, LoopVectorization.OperationStruct(0x00000000000000000000000000000001, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000006, 0x00000000000000000000000000000000, LoopVectorization.memload, 0x0005, 0x01), :LoopVectorization, :LOOPCONSTANTINSTRUCTION, LoopVectorization.OperationStruct(0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, LoopVectorization.constant, 0x0006, 0x00), :LoopVectorization, :getindex, LoopVectorization.OperationStruct(0x00000000000000000000000000000654, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, LoopVectorization.memload, 0x0007, 0x02), :LoopVectorization, :getindex, LoopVectorization.OperationStruct(0x00000000000000000000000000654132, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, LoopVectorization.memload, 0x0008, 0x03), :LoopVectorization, :sub\_fast, LoopVectorization.OperationStruct(0x00000000000000000000000000654132, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000070008, 0x00000000000000000000000000000000, LoopVectorization.compute, 0x0009, 0x00), :LoopVectorization, :abs, LoopVectorization.OperationStruct(0x00000000000000000000000000654132, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000009, 0x00000000000000000000000000000000, LoopVectorization.compute, 0x000a, 0x00), :numericconstant, Symbol(“###reduction##zero###41###”), LoopVectorization.OperationStruct(0x00000000000000000000000000000001, 0x00000000000000000000000000000000, 0x00000000000000000000000000065432, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, LoopVectorization.constant, 0x000b, 0x00), :LoopVectorization, :add\_fast, LoopVectorization.OperationStruct(0x00000000000000000000000000654132, 0x00000000000000000000000000065432, 0x00000000000000000000000000000000, 0x000000000000000000000000000b000a, 0x00000000000000000000000000000000, LoopVectorization.compute, 0x000b, 0x00), :LoopVectorization, :reduced\_add, LoopVectorization.OperationStruct(0x00000000000000000000000000000001, 0x00000000000000000000000000065432, 0x00000000000000000000000000000000, 0x000000000000000000000000000c0005, 0x00000000000000000000000000000000, LoopVectorization.compute, 0x0005, 0x00), :LoopVectorization, :setindex!, LoopVectorization.OperationStruct(0x00000000000000000000000000000001, 0x00000000000000000000000000065432, 0x00000000000000000000000000000000, 0x0000000000000000000000000000000d, 0x00000000000000000000000000000000, LoopVectorization.memstore, 0x000c, 0x01))}, ::Val{(LoopVectorization.ArrayRefStruct{:ℛ, Symbol(“##vptr##\_ℛ”)}(0x00000000000000000000000000000001, 0x00000000000000000000000000000001, 0x00000000000000000000000000000000, 0x00000000000000000000000000000001), LoopVectorization.ArrayRefStruct{:tileij, Symbol(“##vptr##\_tileij”)}(0x00000000000000000000000000010101, 0x00000000000000000000000000060504, 0x00000000000000000000000000000000, 0x00000000000000000000000000010101), LoopVectorization.ArrayRefStruct{:filtData, Symbol(“##vptr##\_filtData”)}(0x00000000000000000000010101010101, 0x00000000000000000000060504010302, 0x00000000000000000000000000000000, 0x00000000000000000000010101010101))}, ::Val{(0, (), (1, 3, 6), (), (), ((4, LoopVectorization.IntOrFloat), (11, LoopVectorization.IntOrFloat)), ())}, ::Val{(:n, :j, :i, :ch, :s, :r)}, ::Val{Tuple{NTuple{6, ArrayInterface.OptionallyStaticUnitRange{Static.StaticInt{0}, Int64}}, Tuple{LayoutPointers.GroupedStridedPointers{Tuple{Ptr{Float32}, Ptr{Float32}, Ptr{Float32}}, (1, 1, 1), (0, 0, 0), ((1,), (1, 2, 3), (1, 2, 3, 4, 5, 6)), ((1,), (2, 3, 4), (5, 6, 7, 8, 9, 10)), Tuple{Static.StaticInt{4}, Static.StaticInt{4}, Int64, Int64, Static.StaticInt{4}, Int64, Int64, Int64, Int64, Int64}, NTuple{10, Static.StaticInt{0}}}, Bool}}}, ::Int64, ::Int64, ::Int64, ::Int64, ::Int64, ::Int64, ::Ptr{Float32}, ::Ptr{Float32}, ::Ptr{Float32}, ::Int64, ::Int64, ::Int64, ::Int64, ::Int64, ::Int64, ::Int64, ::Bool) @ LoopVectorization C:\Users\00shi.julia\packages\LoopVectorization\ndGJi\src\reconstruct\_loopset.jl:713 [7] 𝒜𝒸𝓉! @ C:\Users\00shi.julia\packages\Tullio\u7Tk0\src\macro.jl:1094 [inlined] [8] tile\_halves(fun!::Main.Tst.DownDraw.var"#𝒜𝒸𝓉!#35" , ::Type{Array{Float32}}, As::Tuple{Vector{Float32}, Array{Float32, 3}, Array{Float32, 6}}, Is::Tuple{UnitRange{Int64}}, Js::NTuple{5, UnitRange{Int64}}, keep::Nothing, final::Bool) @ Tullio C:\Users\00shi.julia\packages\Tullio\u7Tk0\src\threads.jl:139 [9] tile\_halves @ C:\Users\00shi.julia\packages\Tullio\u7Tk0\src\threads.jl:136 [inlined] [10] thread\_halves(fun!::Main.Tst.DownDraw.var"#𝒜𝒸𝓉!#35" , ::Type{Array{Float32}}, As::Tuple{Vector{Float32}, Array{Float32, 3}, Array{Float32, 6}}, Is::Tuple{UnitRange{Int64}}, Js::NTuple{5, UnitRange{Int64}}, threads::Int64, keep::Nothing) @ Tullio C:\Users\00shi.julia\packages\Tullio\u7Tk0\src\threads.jl:128 [11] thread\_halves(fun!::Main.Tst.DownDraw.var"#𝒜𝒸𝓉!#35" , ::Type{Array{Float32}}, As::Tuple{Vector{Float32}, Array{Float32, 3}, Array{Float32, 6}}, Is::Tuple{UnitRange{Int64}}, Js::NTuple{5, UnitRange{Int64}}, threads::Int64, keep::Nothing) (repeats 2 times) @ Tullio C:\Users\00shi.julia\packages\Tullio\u7Tk0\src\threads.jl:125 [12] threader @ C:\Users\00shi.julia\packages\Tullio\u7Tk0\src\threads.jl:63 [inlined]

---

<div class="post-metadata">

### Author: ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)
#### Post date: [February 14, 2022, 7:05pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/2 "2022-02-14T19:05:49Z")

</div>

The following [search](https://github.com/search?o=desc&q=VectorizationBase&s=updated&type=Issues) doesn’t show any meaningful results (yet;).

---

<div class="post-metadata">

### Author: ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)
#### Post date: [February 14, 2022, 7:12pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/3 "2022-02-14T19:12:42Z")

</div>

VectorizationBase is part of LoopVectorization, it’s possible that @elrod can see what’s wrong from the stack trace? The versions of those two packages would also be useful.

From Tullio you can write `avx=false` to disable LoopVectorization, in case this helps work around it for now.

---

<div class="post-metadata">

### Author: ![00shiv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00shiv/32/8903_2.png) [@00shiv](https://discourse.julialang.org/u/00shiv)
#### Post date: [February 14, 2022, 7:12pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/4 "2022-02-14T19:12:54Z")

</div>

I should add that the offending line of code seems to be:  
@tullio dists[n] := abs( img[r, s, ch] - data[r, s, ch, n, i, j] )  
where i, j are for-loop variables that contain this statement.  
Thanks.  
–shiv–

---

<div class="post-metadata">

### Author: ![00shiv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00shiv/32/8903_2.png) [@00shiv](https://discourse.julialang.org/u/00shiv)
#### Post date: [February 14, 2022, 7:15pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/5 "2022-02-14T19:15:55Z")

</div>

LoopVectorization is at 0.12.101. I could not find a package called VectorizationBase.

---

<div class="post-metadata">

### Author: ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)
#### Post date: [February 14, 2022, 7:17pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/6 "2022-02-14T19:17:34Z")

</div>

[https://github.com/JuliaSIMD/VectorizationBase.jl](https://github.com/JuliaSIMD/VectorizationBase.jl)

---

<div class="post-metadata">

### Author: ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)
#### Post date: [February 14, 2022, 7:19pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/7 "2022-02-14T19:19:34Z")

</div>

```julia
ERROR: MethodError: no method matching vconvert(::Type{VectorizationBase.VecUnroll{N, 16, Float32, VectorizationBase.Vec{16, Float32}} where N}, ::VectorizationBase.VecUnroll{7, 16, Float32, VectorizationBase.Vec{16, Float32}}) Closest candidates are: 

```

Perhaps 1.7.2 is type unstable where 1.7.1 was type unstable, resulting in the generation of the call

```julia
vconvert(::Type{VectorizationBase.VecUnroll{N, 16, Float32, VectorizationBase.Vec{16, Float32}} where N}, ::VectorizationBase.VecUnroll{7, 16, Float32, VectorizationBase.Vec{16, Float32}}) 

```

instead of

```julia
vconvert(::Type{VectorizationBase.VecUnroll{7, 16, Float32, VectorizationBase.Vec{16, Float32}}}, ::VectorizationBase.VecUnroll{7, 16, Float32, VectorizationBase.Vec{16, Float32}}) 

```

But I’d need a reproducer.

---

<div class="post-metadata">

### Author: ![00shiv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00shiv/32/8903_2.png) [@00shiv](https://discourse.julialang.org/u/00shiv)
#### Post date: [February 14, 2022, 7:34pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/8 "2022-02-14T19:34:42Z")

</div>

Interesting. VectorizationBase was not installed on either of my machines even though both had LoopVectorization. I added VectorizationBase 0.21.24 but the code continues to fail. Actually it seems to fail on 1.7.1 but for different sizes of the array. I will try to come up with a MWE now.

---

<div class="post-metadata">

### Author: ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)
#### Post date: [February 14, 2022, 7:44pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/9 "2022-02-14T19:44:50Z")

</div>

I can reproduce this on a recent nightly, and check that it works fine on 1.7.0. With the code from `@tullio verbose=2`:

```julia
julia> using Tullio

julia> img = rand(Float32, 7,7,7); data = rand(Float32, 7,7,7,7,7,7);

julia> @tullio dists[n] := abs( img[r, s, ch] - data[r, s, ch, n, i, j] )
7-element Vector{Float32}:
 5559.8164
 5539.7
 5532.371
 5556.563
 5537.142
 5556.714
 5561.525

julia> using LoopVectorization

julia> @tullio dists[n] := abs( img[r, s, ch] - data[r, s, ch, n, i, j] )
ERROR: MethodError: no method matching vconvert(::Type{VectorizationBase.VecUnroll{N, 4, Float32, VectorizationBase.Vec{4, Float32}} where N}, ::VectorizationBase.VecUnroll{7, 4, Float32, VectorizationBase.Vec{4, Float32}})

julia> VERSION # works fine on 1.7.0
v"1.8.0-DEV.1491"

julia> out = zeros(Float32, 7);

julia> function act!(ℛ::AbstractArray{𝒯}, img, data, 𝒶𝓍n=1:7, 𝒶𝓍r=1:7, 𝒶𝓍s=1:7, 𝒶𝓍ch=1:7, 𝒶𝓍i=1:7, 𝒶𝓍j=1:7, ♻️ = nothing, 💀 = true) where 𝒯
       LoopVectorization.@avx unroll = 0 for n = 𝒶𝓍n
               𝒜𝒸𝒸 = if ♻️ === nothing
                       zero(𝒯)
                   else
                       ℛ[n]
                   end
               for j = 𝒶𝓍j
                   for i = 𝒶𝓍i
                       for ch = 𝒶𝓍ch
                           for s = 𝒶𝓍s
                               for r = 𝒶𝓍r
                                   𝒜𝒸𝒸 = 𝒜𝒸𝒸 + abs(img[r, s, ch] - data[r, s, ch, n, i, j])
                               end
                           end
                       end
                   end
               end
               ℛ[n] = 𝒜𝒸𝒸
           end
           ℛ
       end
act! (generic function with 9 methods)

julia> act!(out, img, data)
ERROR: MethodError: no method matching vconvert(::Type{VectorizationBase.VecUnroll{N, 4, Float32, VectorizationBase.Vec{4, Float32}} where N}, ::VectorizationBase.VecUnroll{7, 4, Float32, VectorizationBase.Vec{4, Float32}})

```

---

<div class="post-metadata">

### Author: ![00shiv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00shiv/32/8903_2.png) [@00shiv](https://discourse.julialang.org/u/00shiv)
#### Post date: [February 14, 2022, 7:58pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/10 "2022-02-14T19:58:11Z")

</div>

For me i and j were fixed variables set inside an outer for loop:  
for j=1:10, i=1:10  
@tullio dists[n] := abs( img[r, s, ch] - data[r, s, ch, n, i, j] )  
…  
end  
I still need to produce a MWE…

---

<div class="post-metadata">

### Author: ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)
#### Post date: [February 14, 2022, 8:05pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/11 "2022-02-14T20:05:23Z")

</div>

If you want it to look for `i, j` from outside, not regard them as its own loop variables, you need to add a dollar sign. This appears to avoid the above problem:

```julia
julia> res = 0.0;

julia> for j=1:7, i=1:7
       @tullio dists[n] := abs( img[r, s, ch] - data[r, s, ch, n, $i, $j] )
       res += sum(dists)
       end
       res
38843.843200683594

```

---

<div class="post-metadata">

### Author: ![00shiv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00shiv/32/8903_2.png) [@00shiv](https://discourse.julialang.org/u/00shiv)
#### Post date: [February 14, 2022, 8:10pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/12 "2022-02-14T20:10:42Z")

</div>

So this does not crash but it does seem to produce a bug when it runs. Note that each iteration of the for loop should print a different random number, but in 1.7.2 it produces the same constant number for me:

```julia
using Tullio
img = randn( Float32, 10, 10, 3 )
data = randn( Float32, 10, 10, 3, 100, 20, 20 )
for j = 1:10, 1 = 1:10
  @tullio dists[n] := abs( img[r, s, ch] - data[r, s, ch, n, i, j] )
  println( minimum( dists ) )
end

```

---

<div class="post-metadata">

### Author: ![00shiv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00shiv/32/8903_2.png) [@00shiv](https://discourse.julialang.org/u/00shiv)
#### Post date: [February 14, 2022, 8:11pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/13 "2022-02-14T20:11:28Z")

</div>

Thanks. Let me try that.

---

<div class="post-metadata">

### Author: ![00shiv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00shiv/32/8903_2.png) [@00shiv](https://discourse.julialang.org/u/00shiv)
#### Post date: [February 14, 2022, 8:44pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453/14 "2022-02-14T20:44:41Z")

</div>

Putting $i, $j rather than i, j seems to fix the crash. But I guess now the crash itself remains a mystery!  
Thanks for all the help!
