Skip to content

Instantly share code, notes, and snippets.

@tkf
Last active February 10, 2019 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkf/738d14c7c4cc61548686201aef751d88 to your computer and use it in GitHub Desktop.
Save tkf/738d14c7c4cc61548686201aef751d88 to your computer and use it in GitHub Desktop.
using Test
module SparseXX
const VE = Base.VecElement
struct Vec{N,T}
elts::NTuple{N,T}
end
struct VecRange{N}
i::Int
end
@inline Base.:+(idx::VecRange{N}, j::Integer) where N = VecRange{N}(idx.i + j)
function fmul_shared_simd!()
X1 = nothing
lane = VecRange{4}(0)
j = 1
# let idx = Vec((VE(0), VE(0), VE(0), VE(0))), # this does not assert
let idx = Vec((VE(1), VE(1), VE(1), VE(1))) #=,
j = j =#
# Uncommenting #= ... =# above avoids the segfault but the
# test/assert still fails.
(function()
J = lane + j
@show J.i # required
eq = J.i == j
# @assert J.i == j
@show X1 # required
@show idx # required
return eq
end)()
end
end
end # module
fmul_shared_simd! = SparseXX.fmul_shared_simd!
@test fmul_shared_simd!()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment