Files
llama.cpp/ggml/src/ggml-cuda
PascalandAman Gupta 58e68df0f9 cuda: fuse snake activation (mul, sin, sqr, mul, add) (#22667)
* cuda: fuse snake activation (mul, sin, sqr, mul, add)

Add ggml_cuda_op_snake_fused with F32 / F16 / BF16 templates. The
matcher recognizes the naive 5 op decomposition emitted by audio
decoders (BigVGAN, Vocos) for snake activation
y = x + sin(a*x)^2 * inv_b and rewrites it to a single elementwise
kernel.

Add test_snake_fuse comparing CPU naive vs CUDA fused across
F32 / F16 / BF16.

* cuda: address review feedback from @am17an

Use ggml_cuda_cast for F32/F16/BF16 conversions and rename
kernel_snake to snake_kernel to match upstream conventions.

* cuda: snake fusion fastdiv on T_len, Suggested-by: @am17an

* Update tests/test-backend-ops.cpp

Co-authored-by: Aman Gupta <amangupta052@gmail.com>

* cuda: snake fusion check add->type matches x->type

Address review feedback from @am17an

* cuda: snake fusion check add->type matches x->type

Moved for readability (equivalent)
Address review feedback from @am17an

---------

Co-authored-by: Aman Gupta <amangupta052@gmail.com>
2026-05-08 17:44:09 +08:00
..
2025-08-20 10:17:37 +08:00
2025-08-05 22:10:36 +03:00
2026-04-10 10:24:09 +08:00
2026-04-10 10:24:09 +08:00
2025-06-20 09:50:24 +08:00
2025-06-20 09:50:24 +08:00
2025-08-28 20:33:03 +02:00
2026-04-15 18:38:38 +02:00
2025-12-09 20:28:57 +01:00
2025-12-09 20:28:57 +01:00
2025-12-08 21:10:12 +08:00
2025-06-22 12:39:54 +08:00
2026-01-29 11:10:53 +01:00
2026-01-29 11:10:53 +01:00
2025-07-29 14:45:18 +08:00
2025-07-29 14:45:18 +08:00
2026-02-08 15:12:51 +02:00
2025-11-13 08:50:01 +08:00
2025-07-29 14:22:03 +02:00
2025-07-29 14:22:03 +02:00
2025-03-31 18:05:13 +02:00
2025-06-22 12:39:54 +08:00
2026-04-23 10:28:56 +08:00
2026-04-23 10:28:56 +08:00
2025-11-30 21:57:31 +01:00