Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
fix: remove LV handling for bias_activation
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Oct 16, 2024
1 parent bae63e2 commit a37aef0
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions src/impl/bias_activation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,27 +194,10 @@ end

function bias_activation_cpu!(y::AbstractArray{yT, 3}, ::False, σ::F,
x::AbstractArray{xT, 3}, bias::AbstractVector) where {F, xT, yT}
if !LV.check_args(y, x, bias)
bias_activation_simd_loop!(y, σ, x, bias)
return
end
bias_activation_loop!(y, σ, x, bias)
bias_activation_simd_loop!(y, σ, x, bias)
return
end

function bias_activation_loop!(y::AbstractArray{yT, 3}, σ::F, x::AbstractArray{xT, 3},
bias::AbstractVector) where {F, xT, yT}
if size(y, 1) == 1
@tturbo for K in indices(x, 3), J in indices((x, bias), (2, 1))
y[1, J, K] = σ(x[1, J, K] + bias[J])
end
else
@tturbo for K in indices(x, 3), J in indices((x, bias), (2, 1)), I in indices(y, 1)
y[I, J, K] = σ(x[I, J, K] + bias[J])
end
end
end

function bias_activation_simd_loop!(y::AbstractArray{yT, 3}, σ::F, x::AbstractArray{xT, 3},
bias::AbstractVector) where {F, xT, yT}
if size(y, 1) == 1
Expand All @@ -233,8 +216,6 @@ function bias_activation_simd_loop!(y::AbstractArray{yT, 3}, σ::F, x::AbstractA
return
end

@enzyme_alternative bias_activation_loop! bias_activation_simd_loop!

function bias_add!(y::AbstractArray{yT, N}, ::AbstractInternalArrayOpMode,
x::AbstractArray{xT, N}, bias::AbstractVector) where {N, xT, yT}
broadcast!(+, y, x, reshape_bias(x, bias))
Expand Down

0 comments on commit a37aef0

Please sign in to comment.