This commit is contained in:
@@ -121,6 +121,12 @@ class BlockTable:
|
||||
self.num_blocks_per_row[row_idx] = 0
|
||||
self.append_row(block_ids, row_idx)
|
||||
|
||||
def clear_row(self, row_idx: int) -> None:
|
||||
num_blocks = self.num_blocks_per_row[row_idx]
|
||||
if num_blocks > 0:
|
||||
self.block_table.np[row_idx, :num_blocks] = 0
|
||||
self.num_blocks_per_row[row_idx] = 0
|
||||
|
||||
def move_row(self, src: int, tgt: int) -> None:
|
||||
num_blocks = self.num_blocks_per_row[src]
|
||||
block_table_np = self.block_table.np
|
||||
@@ -275,6 +281,10 @@ class MultiGroupBlockTable:
|
||||
for i, block_table in enumerate(self.block_tables):
|
||||
block_table.add_row(block_ids[i], row_idx)
|
||||
|
||||
def clear_row(self, row_idx: int) -> None:
|
||||
for block_table in self.block_tables:
|
||||
block_table.clear_row(row_idx)
|
||||
|
||||
def move_row(self, src: int, tgt: int) -> None:
|
||||
for block_table in self.block_tables:
|
||||
block_table.move_row(src, tgt)
|
||||
|
||||
Reference in New Issue
Block a user