[Bugfix] Align block table for TRTLLM MLA edge-case (#39324)

Signed-off-by: Benjamin Chislett <bchislett@nvidia.com>
This commit is contained in:
Benjamin Chislett
2026-05-06 11:17:02 -07:00
committed by GitHub
parent 27702f6d08
commit 38e16678ba
2 changed files with 12 additions and 0 deletions
+5
View File
@@ -41,6 +41,11 @@ class BlockTables:
# As a result, one block on the current rank covers `block_size * cp_size`
# tokens in the full, global (unsharded) sequence.
max_num_blocks = cdiv(self.max_model_len, block_size * self.cp_size)
# Align to a multiple of (128 / block_size) as required
# by some attention backends such as TRTLLM (#39324)
if block_size <= 128:
alignment = 128 // block_size
max_num_blocks = cdiv(max_num_blocks, alignment) * alignment
block_table = StagedWriteTensor(
(self.max_num_reqs, max_num_blocks),
dtype=torch.int32,