Expand description
Activation kernels: ReLU, GELU, SiLU.
Matches activation-kernel-v1.yaml.
Each function provides one of three backends:
fn {name}_scalar(...)— Pure Rust scalar reference (ground truth)unsafe fn {name}_avx2(...)— AVX2 SIMD implementationfn {name}_ptx() -> &'static str— PTX assembly source string
Functions§
- gelu_
avx2 ⚠ - AVX2
GELU— delegates to scalar (no hardwaretanhin AVX2). - gelu_
ptx - PTX assembly for the
GELUkernel. - gelu_
scalar GELU: 0.5 * x * (1 + tanh(sqrt(2/pi) * (x + 0.044715 * x^3)))- relu_
avx2 ⚠ - AVX2
ReLU:_mm256_max_ps(x, zero)with scalar tail. - relu_
ptx - PTX assembly for the
ReLUkernel (elementwise, 1 thread per element). - relu_
scalar ReLU: max(0, x)- silu_
avx2 ⚠ - AVX2
SiLU— delegates to scalar (no hardwareexpin AVX2). - silu_
ptx - PTX assembly for the
SiLU(Swish) kernel. - silu_
scalar SiLU(Swish): x / (1 + exp(-x))