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

Function scaled_mxfp4_quant

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

Source from the content-addressed store, hash-verified

56
57
58def scaled_mxfp4_quant(input: torch.Tensor):
59 m, n = input.shape
60 block_size = 32
61 device = input.device
62
63 output = torch.empty((m, n // 2), device=device, dtype=torch.uint8)
64 output_scale = torch.zeros(((m + 128 - 1) // 128 * 128, (n // block_size + 4 - 1) // 4), device=device, dtype=torch.int32)
65
66 torch.ops.lightx2v_kernel.scaled_mxfp4_quant_sm120.default(output, input, output_scale)
67 output_scale = output_scale.view(torch.float8_e8m0fnu)
68 return output, output_scale
69
70
71def scaled_mxfp6_quant(input: torch.Tensor):

Callers 8

load_mxfp4_weightMethod · 0.90
load_mxfp4Method · 0.90
act_quant_mxfp4Method · 0.90
test_accuracyMethod · 0.90
load_fp4_weightMethod · 0.90
act_quant_fp4Method · 0.90
load_mxfp4Method · 0.85
act_quant_mxfp4Method · 0.85

Calls 1

defaultMethod · 0.45

Tested by 3

test_accuracyMethod · 0.72
load_fp4_weightMethod · 0.72
act_quant_fp4Method · 0.72