Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VectorizationBase.jl breaks StaticArrays.jl #91

Closed
ranocha opened this issue Aug 12, 2022 · 4 comments
Closed

VectorizationBase.jl breaks StaticArrays.jl #91

ranocha opened this issue Aug 12, 2022 · 4 comments

Comments

@ranocha
Copy link
Member

ranocha commented Aug 12, 2022

julia> using Pkg; Pkg.activate(temp=true); Pkg.add(["StaticArrays", "VectorizationBase"])
  Activating new project at `/tmp/jl_es7LWm`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `/tmp/jl_es7LWm/Project.toml`
  [90137ffa] + StaticArrays v1.5.2
  [3d5dd08c] + VectorizationBase v0.21.45
...

julia> using StaticArrays

julia> mutable struct HoldsAnSVector
           x::SVector{1, Float64}
       end

julia> foo = HoldsAnSVector(SVector(1.0))
HoldsAnSVector([1.0])

julia> foo.x = [2.0]
1-element Vector{Float64}:
 2.0

julia> using VectorizationBase

julia> foo.x = [3.0]
ERROR: MethodError: no method matching _offset_index(::Tuple{}, ::Tuple{StaticInt{1}})
Closest candidates are:
  _offset_index(::Tuple{}, ::Tuple{}) at ~/.julia/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:17
  _offset_index(::Tuple{I1}, ::Tuple{I2}) where {I1, I2} at ~/.julia/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:22
  _offset_index(::Tuple{I1, I2, Vararg}, ::Tuple{I3}) where {I1, I2, I3} at ~/.julia/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:20
Stacktrace:
 [1] offset_index
   @ ~/.julia/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:31 [inlined]
 [2] linear_index
   @ ~/.julia/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:32 [inlined]
 [3] _vload
   @ ~/.julia/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:41 [inlined]
 [4] vload
   @ ~/.julia/packages/VectorizationBase/sAHNI/src/llvm_intrin/memory_addr.jl:970 [inlined]
 [5] getindex
   @ ~/.julia/packages/VectorizationBase/sAHNI/src/special/misc.jl:197 [inlined]
 [6] unroll_tuple(a::Vector{Float64}, #unused#::Length{1})
   @ StaticArrays ~/.julia/packages/StaticArrays/8Dz3j/src/convert.jl:206
 [7] convert
   @ ~/.julia/packages/StaticArrays/8Dz3j/src/convert.jl:199 [inlined]
 [8] setproperty!(x::HoldsAnSVector, f::Symbol, v::Vector{Float64})
   @ Base ./Base.jl:43
 [9] top-level scope
   @ REPL[7]:1

This causes the CI failures in trixi-framework/Trixi.jl#1202 and trixi-framework/Trixi.jl#1149

@baggepinnen
Copy link

This also causes errors in Convex.jl

  MethodError: no method matching _offset_index(::Tuple{}, ::Tuple{Static.StaticInt{1}, Static.StaticInt{1}})
  Closest candidates are:
    _offset_index(::Tuple{}, ::Tuple{}) at /home/github_actions/depots/deepsea1.0/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:17
    _offset_index(::Tuple{I1}, ::Tuple{I2, I3, Vararg}) where {I1, I2, I3} at /home/github_actions/depots/deepsea1.0/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:18
    _offset_index(::Tuple{I1, I2, Vararg}, ::Tuple{I3, I4, Vararg}) where {I1, I2, I3, I4} at /home/github_actions/depots/deepsea1.0/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:28
  Stacktrace:
    [1] offset_index
      @ /home/github_actions/depots/deepsea1.0/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:31 [inlined]
    [2] linear_index
      @ /home/github_actions/depots/deepsea1.0/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:32 [inlined]
    [3] _vload
      @ /home/github_actions/depots/deepsea1.0/packages/VectorizationBase/sAHNI/src/strided_pointers/stridedpointers.jl:41 [inlined]
    [4] vload
      @ /home/github_actions/depots/deepsea1.0/packages/VectorizationBase/sAHNI/src/llvm_intrin/memory_addr.jl:970 [inlined]
    [5] getindex
      @ /home/github_actions/depots/deepsea1.0/packages/VectorizationBase/sAHNI/src/special/misc.jl:197 [inlined]
    [6] output
      @ /home/github_actions/depots/deepsea1.0/packages/Convex/ukggP/src/constant.jl:49 [inlined]

@moyner
Copy link

moyner commented Aug 12, 2022

This issue seems to break basic Julia too:

a = [1]; a[]

Running the above gives 1, but if we add VectorizationBase the no-index indexing gets broken:

using VectorizationBase
a = [1]; a[]
ERROR: MethodError: no method matching _offset_index(::Tuple{}, ::Tuple{StaticInt{1}})
Closest candidates are:
  _offset_index(::Tuple{}, ::Tuple{}) at C:\Users\olavm\.julia\packages\VectorizationBase\sAHNI\src\strided_pointers\stridedpointers.jl:17
  _offset_index(::Tuple{I1}, ::Tuple{I2}) where {I1, I2} at C:\Users\olavm\.julia\packages\VectorizationBase\sAHNI\src\strided_pointers\stridedpointers.jl:22
  _offset_index(::Tuple{I1, I2, Vararg}, ::Tuple{I3}) where {I1, I2, I3} at C:\Users\olavm\.julia\packages\VectorizationBase\sAHNI\src\strided_pointers\stridedpointers.jl:20
Stacktrace:
 [1] offset_index
   @ C:\Users\olavm\.julia\packages\VectorizationBase\sAHNI\src\strided_pointers\stridedpointers.jl:31 [inlined]
 [2] linear_index
   @ C:\Users\olavm\.julia\packages\VectorizationBase\sAHNI\src\strided_pointers\stridedpointers.jl:32 [inlined]
 [3] _vload
   @ C:\Users\olavm\.julia\packages\VectorizationBase\sAHNI\src\strided_pointers\stridedpointers.jl:41 [inlined]
 [4] vload
   @ C:\Users\olavm\.julia\packages\VectorizationBase\sAHNI\src\llvm_intrin\memory_addr.jl:970 [inlined]
 [5] getindex(::Vector{Int64})
   @ VectorizationBase C:\Users\olavm\.julia\packages\VectorizationBase\sAHNI\src\special\misc.jl:197
 [6] top-level scope
   @ REPL[3]:1

Loading the module seems to type pirate getindex for no active indices:

@which a[]
getindex(A::Array, i::VectorizationBase.AbstractSIMD...) in VectorizationBase at C:\Users\olavm\.julia\packages\VectorizationBase\sAHNI\src\special\misc.jl:196

@chriselrod
Copy link
Member

Fixed.

@ranocha
Copy link
Member Author

ranocha commented Aug 12, 2022

Thanks!

@ranocha ranocha closed this as completed Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants