[FlashInfer v0.6.13] Use CuTe DSL backend for FlashInfer per-token NVFP4 quantization (#28220)
This commit is contained in:
@@ -964,6 +964,7 @@ def fused_experts_none_to_flashinfer_trtllm_fp4(
|
|||||||
1.0 / (e4m3_max * 6.0),
|
1.0 / (e4m3_max * 6.0),
|
||||||
sfLayout=SfLayout.layout_linear,
|
sfLayout=SfLayout.layout_linear,
|
||||||
per_token_activation=True,
|
per_token_activation=True,
|
||||||
|
backend="cute-dsl",
|
||||||
)
|
)
|
||||||
|
|
||||||
seq_len, hidden_size = hidden_states.shape
|
seq_len, hidden_size = hidden_states.shape
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ class ModelOptNvFp4OnlineFusedMoEMethod(ModelOptNvFp4FusedMoEMethod):
|
|||||||
weight.contiguous(),
|
weight.contiguous(),
|
||||||
1.0 / weight_scale_2,
|
1.0 / weight_scale_2,
|
||||||
sfLayout=SfLayout.layout_linear,
|
sfLayout=SfLayout.layout_linear,
|
||||||
backend="cuda",
|
backend="cute-dsl",
|
||||||
)
|
)
|
||||||
rows, cols = weight.shape
|
rows, cols = weight.shape
|
||||||
weight_sf = weight_sf.view(torch.float8_e4m3fn).reshape(rows, cols // 16)
|
weight_sf = weight_sf.view(torch.float8_e4m3fn).reshape(rows, cols // 16)
|
||||||
|
|||||||
@@ -817,10 +817,7 @@ class DefaultModelLoader(BaseModelLoader):
|
|||||||
if is_nvfp4_online:
|
if is_nvfp4_online:
|
||||||
# Scope exact FP4 quantization math to load-time conversion only;
|
# Scope exact FP4 quantization math to load-time conversion only;
|
||||||
# restore the original environment before serving starts.
|
# restore the original environment before serving starts.
|
||||||
with temp_set_env(
|
with temp_set_env(FLASHINFER_DISABLE_FP4_QUANT_FAST_MATH="1"):
|
||||||
TRTLLM_DISABLE_FP4_QUANT_FAST_MATH="1",
|
|
||||||
FLASHINFER_DISABLE_FP4_QUANT_FAST_MATH="1",
|
|
||||||
):
|
|
||||||
model.load_weights(weights)
|
model.load_weights(weights)
|
||||||
if target_device.type == "cuda":
|
if target_device.type == "cuda":
|
||||||
torch.cuda.synchronize()
|
torch.cuda.synchronize()
|
||||||
|
|||||||
Reference in New Issue
Block a user