Skip to content

Commit c204d59

Browse files
committed
Make sure relu, sigmoid_fast, and tanh_fast can_Avx
1 parent 473d881 commit c204d59

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/costs.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ const COST = Dict{Symbol,InstructionCost}(
244244
:cospi_fast => InstructionCost(18,15.0,68.0,26),
245245
:sincospi_fast => InstructionCost(25,22.0,70.0,26),
246246
:tanh => InstructionCost(40,40.0,40.0,26), # FIXME
247-
# :tanh_fast => InstructionCost(25,22.0,70.0,26), # FIXME
247+
:tanh_fast => InstructionCost(25,22.0,70.0,26), # FIXME
248+
:sigmoid_fast => InstructionCost(25,22.0,70.0,26), # FIXME
248249
:identity => InstructionCost(0,0.0,0.0,0),
249250
:adjoint => InstructionCost(0,0.0,0.0,0),
250251
:conj => InstructionCost(0,0.0,0.0,0),
@@ -475,7 +476,8 @@ const FUNCTIONSYMBOLS = IdDict{Type{<:Function},Instruction}(
475476
typeof(Base.FastMath.sincos_fast) => :sincos,
476477
typeof(SLEEFPirates.sincos) => :sincos,
477478
typeof(Base.tanh) => :tanh,
478-
# typeof(SLEEFPirates.tanh_fast) => :tanh_fast,
479+
typeof(tanh_fast) => :tanh_fast,
480+
typeof(sigmoid_fast) => :sigmoid_fast,
479481
typeof(max) => :max,
480482
typeof(min) => :min,
481483
typeof(max_fast) => :max_fast,

test/can_avx.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
@test LoopVectorization.ArrayInterface.can_avx(Base.FastMath.add_fast)
1212
@test LoopVectorization.ArrayInterface.can_avx(/)
1313
@test LoopVectorization.ArrayInterface.can_avx(sqrt)
14+
@test LoopVectorization.ArrayInterface.can_avx(tanh_fast)
15+
@test LoopVectorization.ArrayInterface.can_avx(sigmoid_fast)
16+
@test LoopVectorization.ArrayInterface.can_avx(VectorizationBase.relu)
1417
@test !LoopVectorization.ArrayInterface.can_avx(clenshaw)
18+
@test !LoopVectorization.ArrayInterface.can_avx(println)
1519

1620
end
1721

0 commit comments

Comments
 (0)