Skip to content

Commit 1d7c2c1

Browse files
committed
Add vadd1 and simplify maybeaddref! for loop gradients example.
1 parent 78fdc68 commit 1d7c2c1

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
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.8.21"
4+
version = "0.8.22"
55

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

src/LoopVectorization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using SIMDPirates: VECTOR_SYMBOLS, evadd, evsub, evmul, evfdiv, vrange,
1616
reduced_add, reduced_prod, reduce_to_add, reduced_max, reduced_min, vsum, vprod, vmaximum, vminimum,
1717
sizeequivalentfloat, sizeequivalentint, vadd!, vsub!, vmul!, vfdiv!, vfmadd!, vfnmadd!, vfmsub!, vfnmsub!,
1818
vfmadd231, vfmsub231, vfnmadd231, vfnmsub231, sizeequivalentfloat, sizeequivalentint, #prefetch,
19-
vmullog2, vmullog10, vdivlog2, vdivlog10, vmullog2add!, vmullog10add!, vdivlog2add!, vdivlog10add!, vfmaddaddone
19+
vmullog2, vmullog10, vdivlog2, vdivlog10, vmullog2add!, vmullog10add!, vdivlog2add!, vdivlog10add!, vfmaddaddone, vadd1
2020
using SLEEFPirates: pow
2121
using Base.Broadcast: Broadcasted, DefaultArrayStyle
2222
using LinearAlgebra: Adjoint, Transpose

src/add_loads.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
function maybeaddref!(ls::LoopSet, op, ref)
1+
function maybeaddref!(ls::LoopSet, op)
2+
ref = op.ref
23
id = findfirst(r -> r == ref, ls.refs_aliasing_syms)
34
# try to CSE
45
if isnothing(id)
@@ -12,8 +13,7 @@ end
1213

1314
function add_load!(ls::LoopSet, op::Operation, actualarray::Bool = true, broadcast::Bool = false)
1415
@assert isload(op)
15-
ref = op.ref
16-
if (id = maybeaddref!(ls, op, ref)) > 0 # try to CSE
16+
if (id = maybeaddref!(ls, op)) > 0 # try to CSE
1717
opp = ls.opdict[ls.syms_aliasing_refs[id]] # throw an error if not found.
1818
return isstore(opp) ? getop(ls, first(parents(opp))) : opp
1919
end

src/costs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ const COST = Dict{Symbol,InstructionCost}(
130130
:(*) => InstructionCost(4,0.5),
131131
:(/) => InstructionCost(13,4.0,-2.0),
132132
:vadd => InstructionCost(4,0.5),
133+
:vadd1 => InstructionCost(4,0.5),
133134
:add_fast => InstructionCost(4,0.5),
134135
:vsub => InstructionCost(4,0.5),
135136
:sub_fast => InstructionCost(4,0.5),

0 commit comments

Comments
 (0)