Skip to content

Commit

Permalink
Add vadd1 and simplify maybeaddref! for loop gradients example.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Aug 2, 2020
1 parent 78fdc68 commit 1d7c2c1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LoopVectorization"
uuid = "bdcacae8-1622-11e9-2a5c-532679323890"
authors = ["Chris Elrod <[email protected]>"]
version = "0.8.21"
version = "0.8.22"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down
2 changes: 1 addition & 1 deletion src/LoopVectorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using SIMDPirates: VECTOR_SYMBOLS, evadd, evsub, evmul, evfdiv, vrange,
reduced_add, reduced_prod, reduce_to_add, reduced_max, reduced_min, vsum, vprod, vmaximum, vminimum,
sizeequivalentfloat, sizeequivalentint, vadd!, vsub!, vmul!, vfdiv!, vfmadd!, vfnmadd!, vfmsub!, vfnmsub!,
vfmadd231, vfmsub231, vfnmadd231, vfnmsub231, sizeequivalentfloat, sizeequivalentint, #prefetch,
vmullog2, vmullog10, vdivlog2, vdivlog10, vmullog2add!, vmullog10add!, vdivlog2add!, vdivlog10add!, vfmaddaddone
vmullog2, vmullog10, vdivlog2, vdivlog10, vmullog2add!, vmullog10add!, vdivlog2add!, vdivlog10add!, vfmaddaddone, vadd1
using SLEEFPirates: pow
using Base.Broadcast: Broadcasted, DefaultArrayStyle
using LinearAlgebra: Adjoint, Transpose
Expand Down
6 changes: 3 additions & 3 deletions src/add_loads.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function maybeaddref!(ls::LoopSet, op, ref)
function maybeaddref!(ls::LoopSet, op)
ref = op.ref
id = findfirst(r -> r == ref, ls.refs_aliasing_syms)
# try to CSE
if isnothing(id)
Expand All @@ -12,8 +13,7 @@ end

function add_load!(ls::LoopSet, op::Operation, actualarray::Bool = true, broadcast::Bool = false)
@assert isload(op)
ref = op.ref
if (id = maybeaddref!(ls, op, ref)) > 0 # try to CSE
if (id = maybeaddref!(ls, op)) > 0 # try to CSE
opp = ls.opdict[ls.syms_aliasing_refs[id]] # throw an error if not found.
return isstore(opp) ? getop(ls, first(parents(opp))) : opp
end
Expand Down
1 change: 1 addition & 0 deletions src/costs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const COST = Dict{Symbol,InstructionCost}(
:(*) => InstructionCost(4,0.5),
:(/) => InstructionCost(13,4.0,-2.0),
:vadd => InstructionCost(4,0.5),
:vadd1 => InstructionCost(4,0.5),
:add_fast => InstructionCost(4,0.5),
:vsub => InstructionCost(4,0.5),
:sub_fast => InstructionCost(4,0.5),
Expand Down

0 comments on commit 1d7c2c1

Please sign in to comment.