MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / scaled_mxfp8_quant

Function scaled_mxfp8_quant

lightx2v_kernel/python/lightx2v_kernel/gemm.py:84–94  ·  view source on GitHub ↗
(input: torch.Tensor)

Source from the content-addressed store, hash-verified

82
83
84def scaled_mxfp8_quant(input: torch.Tensor):
85 m, n = input.shape
86 block_size = 32
87 device = input.device
88
89 output = torch.empty((m, n), device=device, dtype=torch.uint8)
90 output_scale = torch.empty(((m + 128 - 1) // 128 * 128, (n // block_size + 4 - 1) // 4), device=device, dtype=torch.int32)
91
92 torch.ops.lightx2v_kernel.scaled_mxfp8_quant_sm120.default(output, input, output_scale)
93 output_scale = output_scale.view(torch.float8_e8m0fnu)
94 return output, output_scale
95
96
97def scaled_mxfp8_gelu_quant(input: torch.Tensor):

Calls 1

defaultMethod · 0.45