[ROCm][Perf] Optimize DeepSeek V4 C4A top-k with AITER (#52882)

This commit is contained in:
Fangzhou Ai
2026-08-21 10:00:39 -07:00
committed by GitHub
parent 1baf372bfc
commit fe76112ff2
5 changed files with 611 additions and 30 deletions
@@ -750,6 +750,7 @@ class SparseAttnIndexer(CustomOp):
topk_indices_buffer: torch.Tensor,
skip_k_cache_insert: bool = False,
use_fp4_cache: bool = False,
compress_ratio: int = 1,
):
super().__init__()
self.k_cache = k_cache
@@ -762,6 +763,7 @@ class SparseAttnIndexer(CustomOp):
self.topk_indices_buffer = topk_indices_buffer
self.skip_k_cache_insert = skip_k_cache_insert
self.use_fp4_cache = use_fp4_cache
self.compress_ratio = compress_ratio
self.dense_mha_metadata_layer_name = ""
# DCP scalars are constant for the run; resolve them here (config is set
# during model construction) and pass them into the custom op, rather
@@ -873,6 +875,7 @@ class SparseAttnIndexer(CustomOp):
self.max_total_seq_len,
self.topk_indices_buffer,
skip_k_cache_insert=self.skip_k_cache_insert,
compress_ratio=self.compress_ratio,
)
raise RuntimeError(
"Sparse attention indexer ROCm path is only supported on AITER. "