]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
ggml : recurrent state rollback for ggml_ssm_scan (#26623)
authorlnigam <redacted>
Fri, 14 Aug 2026 14:20:40 +0000 (19:50 +0530)
committerGitHub <redacted>
Fri, 14 Aug 2026 14:20:40 +0000 (17:20 +0300)
commit1692f9e50bb20fd96b963af38a282daf78feea64
tree849b53f780d78a5308e177885994e6d3aadbb904
parent4c1a0af40d88c7fbb3b15c85bf2e8016d1d5b64c
ggml : recurrent state rollback for ggml_ssm_scan (#26623)

* Initial changes for Recurrent state rollback for nemotron for cpu and cuda

* Removing CPU RS rollback. Will enable it in subsequent PRs

* addition of test case

* Removing assert and calling runtime API to check if op is supported

* removing extra API and updating the call sites for K

* replace static cuda detection to runtime fused_op api

* address review comments and fallback when SSM rollback not supprted

* Adding changes for supporting RS-rollback in CPU. Also added test-backend-ops for cpu and cuda

* removing memory manipulation as rs rollback is now supported in CPU

* removing the static probe which is not needed now

* correcting the format

* address review comments

* enabling test for all the backends, unsupported backends will fallback to CPU

* Apply suggestions from code review

Co-authored-by: Georgi Gerganov <redacted>
* choose different graph based on the result of fused_ssm_op is supported or not and also handled memory->n_rs_seq >1 case incase of op is not supported

* Support K > 1 in ssm_scan for all backends

* Fix CI Issues

---------

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: Gaurav Garg <redacted>
25 files changed:
ggml/include/ggml.h
ggml/src/ggml-cpu/ggml-cpu.cpp
ggml/src/ggml-cpu/ops.cpp
ggml/src/ggml-cuda/ggml-cuda.cu
ggml/src/ggml-cuda/ssm-scan.cu
ggml/src/ggml-et/et-kernels/src/ssm_scan_f32.c
ggml/src/ggml-et/ggml-et-ops.cpp
ggml/src/ggml-et/ggml-et-ops.h
ggml/src/ggml-metal/ggml-metal-device.m
ggml/src/ggml-metal/ggml-metal-impl.h
ggml/src/ggml-metal/ggml-metal-ops.cpp
ggml/src/ggml-metal/ggml-metal.metal
ggml/src/ggml-sycl/ssm_scan.cpp
ggml/src/ggml-vulkan/ggml-vulkan.cpp
ggml/src/ggml-vulkan/vulkan-shaders/ssm_scan.comp
ggml/src/ggml-webgpu/ggml-webgpu.cpp
ggml/src/ggml-webgpu/wgsl-shaders/ssm_scan.wgsl
ggml/src/ggml.c
src/llama-arch.cpp
src/llama-context.cpp
src/llama-model-loader.cpp
src/models/mamba-base.cpp
src/models/plamo2.cpp
tests/CMakeLists.txt
tests/test-backend-ops.cpp