Skip to content

Commit 18943a6

Browse files
committed
Fix 106 by assigning consistent names to keep arrays identifiable.
1 parent 8c37cae commit 18943a6

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LoopVectorization"
22
uuid = "bdcacae8-1622-11e9-2a5c-532679323890"
33
authors = ["Chris Elrod <[email protected]>"]
4-
version = "0.7.7"
4+
version = "0.7.8"
55

66
[deps]
77
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"

src/memory_ops_common.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
dottosym(x) = x
2+
dottosym(x::Expr) = Symbol(dottosym(x.args[1]), "###extractarray###", x.args[2].value)
13
function extract_array_symbol_from_ref!(ls::LoopSet, ex::Expr, offset1::Int)::Symbol
24
ar = ex.args[1 + offset1]
35
if isa(ar, Symbol)
46
return ar
57
elseif isa(ar, Expr) && ar.head === :(.)
6-
s = gensym(:extractedarray)
8+
s = dottosym(ar)
79
pushprepreamble!(ls, Expr(:(=), s, ar))
810
return s
911
else

test/miscellaneous.jl

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -622,14 +622,19 @@ using Test
622622
c_re
623623
end
624624

625-
function MatCalcWtD(m)
625+
626+
function MatCalcWtDW!(m)
626627
l, n = size(m.Wt)
627-
@avx for j in 1:n
628-
for i in 1:l
629-
m.WtD[i, j] = m.Wt[i, j] * m.d[j]
630-
end
631-
end
628+
fill!(m.Wt_D_W, 0)
629+
@avx for k in 1: n
630+
for j in 1:l
631+
for i in 1:l
632+
m.Wt_D_W[i, j] += m.Wt[i, k] * m.Wt[j, k] * m.d[k]
633+
end
634+
end
635+
end
632636
end
637+
633638

634639
for T (Float32, Float64)
635640
@show T, @__LINE__
@@ -816,9 +821,15 @@ using Test
816821
multiple_unrolls_split_depchains_avx!(c_re_2, a_re, b_re, a_im, b_im) # [1 1; 1 1]
817822
@test c_re_1 c_re_2
818823

819-
mh = (WtD = rand(T, 15,23), Wt = rand(T, 15,23), d = rand(T, 23))
820-
MatCalcWtD(mh)
821-
@test mh.WtD mh.Wt .* mh.d'
824+
mh = (
825+
Wt_D_W = Matrix{T}(undef, 181, 181),
826+
Wt = rand(T, 181, 191),
827+
d = rand(T, 191)
828+
)
829+
Wt_D_W = similar(mh.Wt_D_W)
830+
831+
MatCalcWtDW!(mh)
832+
@test mh.Wt_D_W mh.Wt * Diagonal(mh.d) * mh.Wt'
822833

823834

824835
end

0 commit comments

Comments
 (0)