Views
No views yet
x + residual) with RMSNorm in a single kernel.1y = x + residual
2hidden_state = rms_norm(y, weight, eps)
3out = y + some_op(hidden_state)1hidden_state, y = fused_add_rms_norm(x, residual, weight, eps)
2out = y + some_op(hidden_state)1y = poly_norm(x, weight, bias, eps)
2out = y * aout = fused_mul_poly_norm(x, a, weight, bias, eps)1for i, expert in enumerate(experts):
2 out[start:end] = fused_mul_poly_norm(x[start:end], mul[start:end], weight[i], bias[i], eps)1out = fused_mul_grouped_poly_norm(x, mul, weight, bias, offsets, eps,
2 scores=scores, hidden_clamp=10.0)1# Local CUDA build (development)
2pip install --no-build-isolation -e .1import torch
2import activation
3
4torch.set_default_device("cuda")
5poly_norm = activation.layers.PolyNorm(eps=1e-6)
6x = torch.randn(10, 10)
7
8print(poly_norm(x))



[!NOTE]
For fusion case performance, the non-fused baseline was implemented with our custom kernels.








[!NOTE]
For fusion case performance, the non-fused baseline was implemented with our custom kernels.




[!NOTE] This kernel is implemented in CUDA C++ (compiled via setup.py). Benchmarks compare three variants: Naive (raw PyTorch reference), Compiled (torch.compile'd reference), and CUDA (fused CUDA kernel). Benchmark dimension: 1280, 384 experts.Training profile (B200, motif3_seq, lbs=8, seqlen=4K):
CUDA kernel torch.compile Speedup Forward 0.7 ms 2.1 ms 3.0x Backward 1.4 ms 3.7 ms 2.6x
pip install pre-commit pre-commit install--style=file)pre-commit run --all-files pre-commit run isort --all-files