fix: searchsorted right=True for correct expert assignment

This commit is contained in:
2026-05-17 07:57:00 +00:00
parent ddffb7d8df
commit a1e6f5f891

View File

@@ -186,7 +186,7 @@ class CuTeDSLMoERunner:
total_rows = x_sf.shape[0]
row_indices = torch.arange(total_rows, device=x_sf.device)
expert_assign = torch.searchsorted(
expert_offsets[1:], row_indices, right=False
expert_offsets[1:], row_indices, right=True
).clamp(max=num_experts - 1)
local_row = row_indices - expert_offsets[expert_assign]
dst_rows = padded_expert_offsets[expert_assign] + local_row