[Core] direct indexing on self.block_table_np in compute_slot_mapping (#22940)

Signed-off-by: linzebing <linzebing1995@gmail.com>
This commit is contained in:
Zebing Lin 2025-08-15 15:12:12 -04:00 committed by GitHub
parent df5afa82e5
commit 6e670778cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -91,8 +91,7 @@ class BlockTable:
# block_size.
block_table_indices = (req_indices * self.max_num_blocks_per_req +
positions // self.block_size)
block_table_cpu = self.get_cpu_tensor()
block_numbers = block_table_cpu.flatten()[block_table_indices].numpy()
block_numbers = self.block_table_np.ravel()[block_table_indices]
block_offsets = positions % self.block_size
np.add(block_numbers * self.block_size,
block_offsets,