Tullio with LoopVectorization fails with upgrade to 1.6.0

The following code runs fine on Julia 1.5.3, but fails on 1.6.0. It fails on the Tullio line with error

ERROR: LoadError: BoundsError: attempt to access 2-element Vector{Any} at index [0]

If I disable LoopVectorization then it works fine. Any hints?

using Tullio, LoopVectorization


function dome()
    R = 100; J = 10; d = 3
    w = ones(R)
    M = randn(R,J)
    H = zeros(d,d)
    ji = 5
    Δ = randn(R,J,d)
    @tullio H[k,t] += w[r] * M[r,$ji] * M[r,v] * Δ[r,v,k] * Δ[r,v,t]
end


dome()

It seems to run fine on Julia Version 1.6.0 / Win 10:

julia> dome()
3×3 Matrix{Float64}:
 68.0793   22.3252  -9.93758
 22.3252   25.8297  68.9513
 -9.93758  68.9513  57.6872

Intriguing @rafael.guerra . I’m on Ubuntu/AMD. Surprised that would make a difference.

I get the same BoundsError on my machine with v1.6.0. I am on MX Linux+MKL, MX Linux is Debian-based.

1 Like

It also happens on my Ubuntu/Intel laptop.

1 Like

This fails for me too:

(jl_lL2fPA) pkg> st LoopVectorization
      Status `/private/var/folders/yq/4p2zwd614y59gszh7y9ypyhh0000gn/T/jl_lL2fPA/Project.toml`
  [bdcacae8] LoopVectorization v0.12.10

julia> dome()
ERROR: BoundsError: attempt to access 2-element Vector{Any} at index [0]
Stacktrace:
  [1] setindex!
    @ ./essentials.jl:458 [inlined]
  [2] add_prefetches!(q::Expr, ls::LoopVectorization.LoopSet, op::LoopVectorization.Operation, td::LoopVectorization.UnrollArgs, prefetchind::Int64)
    @ LoopVectorization ~/.julia/packages/LoopVectorization/x1yTo/src/codegen/lower_load.jl:99
  [3] lower_load_no_optranslation!(q::Expr, ls::LoopVectorization.LoopSet, op::LoopVectorization.Operation, td::LoopVectorization.UnrollArgs, mask::Bool, inds_calc_by_ptr_offset::Vector{Bool})
    @ LoopVectorization ~/.julia/packages/LoopVectorization/x1yTo/src/codegen/lower_load.jl:147
...

julia> versioninfo()
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, westmere)
Environment:
  JULIA_NUM_THREADS = 4

but works on an older LV version:

julia> dome()
3×3 Matrix{Float64}:
 261.142     -6.82707  -69.5494
  -6.82707  244.834     62.9904
 -69.5494    62.9904   175.976

(@v1.6) pkg> st LoopVectorization
      Status `~/.julia/environments/v1.6/Project.toml`
  [bdcacae8] LoopVectorization v0.10.0

@rafael.guerra which LV version are you on?

1 Like

@mcabbott, Tullio v0.2.13 and LoopVectorization v0.12.10

I have the same versions of Tullio and LoopVectorization but on Ubuntu

I opened an issue: An error with v0.12 · Issue #225 · JuliaSIMD/LoopVectorization.jl · GitHub

3 Likes

Thanks!!

@mcabbott And to confirm: downgrading LoopVectorization to 0.11.2 fixes the problem in my original (much larger) problem as well.

1 Like

Bug has been fixed in #master. Confirmed. Should hit the main repository soon. Thanks as always for your help @mcabbott !