Fix: scatter FP4 as uint8 (float4 doesn't support index_put)
This commit is contained in:
@@ -166,9 +166,10 @@ def main():
|
||||
slot_x_fp4, slot_x_sf, l1_gs = quantize_to_nvfp4(slot_hidden)
|
||||
print(f" L1 gs (dynamic): {l1_gs:.6f}")
|
||||
|
||||
# Scatter x_fp4 into padded layout
|
||||
padded_x_fp4 = torch.zeros(total_padded, HIDDEN_SIZE // 2, dtype=torch.uint8, device=DEVICE).view(torch.float4_e2m1fn_x2)
|
||||
padded_x_fp4[padded_dst] = slot_x_fp4
|
||||
# Scatter x_fp4 into padded layout (use uint8 for scatter, then view as float4)
|
||||
padded_x_fp4_uint8 = torch.zeros(total_padded, HIDDEN_SIZE // 2, dtype=torch.uint8, device=DEVICE)
|
||||
padded_x_fp4_uint8[padded_dst] = slot_x_fp4.view(torch.uint8)
|
||||
padded_x_fp4 = padded_x_fp4_uint8.view(torch.float4_e2m1fn_x2)
|
||||
|
||||
# For scale_a, we need to use the runner's assembly approach.
|
||||
# Use the same _assemble_scales_cudagraph_safe function
|
||||
|
||||
Reference in New Issue
Block a user