Skip to content

Commit d64de59

Browse files
authored
Fix lint error (sgl-project#427)
1 parent cbc0409 commit d64de59

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

python/sgl_kernel_npu/sgl_kernel_npu/mamba/mamba_state_update_triton.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,12 @@ def move_intermediate_cache(
113113
dst_layer_stride, dst_size_stride = int(ssm_states.stride()[0]), int(
114114
ssm_states.stride()[1]
115115
)
116-
assert len(dst_indices_tensor) == len(last_steps_tensor), "Destination indices lengths must match"
117-
assert len(src_indices_tensor) == len(last_steps_tensor), "Source indices lengths must match"
116+
assert len(dst_indices_tensor) == len(
117+
last_steps_tensor
118+
), "Destination indices lengths must match"
119+
assert len(src_indices_tensor) == len(
120+
last_steps_tensor
121+
), "Source indices lengths must match"
118122

119123
# Grid: one thread per valid index
120124
grid = (len(dst_indices_tensor),)

tests/python/sgl_kernel_npu/test_mamba_state_update.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ def test_move_intermediate_cache(
139139
valid_indices = random.sample(population, num_valid)
140140
last_step_pos = [random.randint(0, D - 1) for _ in range(num_valid)]
141141
dst_indices_tensor = torch.tensor(valid_indices, device=device, dtype=torch.int32)
142-
src_indices_tensor = torch.arange(dst_indices_tensor.shape[0], device=device, dtype=torch.int32)
142+
src_indices_tensor = torch.arange(
143+
dst_indices_tensor.shape[0], device=device, dtype=torch.int32
144+
)
143145
last_steps_tensor = torch.tensor(last_step_pos, device=device, dtype=torch.int32)
144146

145147
valid_mask = last_steps_tensor >= 0
@@ -151,6 +153,12 @@ def test_move_intermediate_cache(
151153
:, src_state_indices, valid_last_steps
152154
]
153155

154-
move_intermediate_cache(dst_cache_clone, src_cache, dst_indices_tensor, src_indices_tensor, last_steps_tensor)
156+
move_intermediate_cache(
157+
dst_cache_clone,
158+
src_cache,
159+
dst_indices_tensor,
160+
src_indices_tensor,
161+
last_steps_tensor,
162+
)
155163

156164
assert_close("move_cache", dst_cache, dst_cache_clone, 1e-3)

0 commit comments

Comments
 (0)