Last active
February 10, 2019 06:26
-
-
Save tkf/738d14c7c4cc61548686201aef751d88 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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