Module nvfp4_detect

Module nvfp4_detect 

Source
Expand description

2026-09-25: Detection of the on-disk weight format (Nvfp4Variant) and the variant-dispatching quantized-weight loaders.

Owner: model-layers (weight loading). Invariants:

  • A variant declared by config.quantization_config wins over tensor-name sniffing.
  • Detection reads only layer 0 and the whole name list, never a layer chosen by EP rank.

Structs§

QuantizeCtx
2026-09-25: Kernels and stream for load-time NVFP4 quantization (quantize_to_nvfp4).

Functions§

config_declared_variant
2026-09-25: Step (1) of detect_nvfp4_variant: the variant the config declares, answered without a WeightStore, so the pre-load residency prediction (qwen35_dense::predicted_residency) asks the same question as the loader. None means the config does not say; the sniffing half of detect_nvfp4_variant then decides.
detect_nvfp4_variant
2026-09-25: Detect the on-disk weight format.
quantized_any
2026-09-25: Load a weight [n, k] as NVFP4 whatever its on-disk format.
quantized_auto
2026-09-25: Load a pre-quantized NVFP4 weight by variant: quantized for Standard, quantized_v2 for CompressedTensors. Panics for Fp8Dequanted and Bf16Raw, which need quantized_any.
quantized_from_fp8
2026-09-25: Dequantize a block-scaled FP8 weight [n, k] to BF16, quantize it to NVFP4, and free the BF16 intermediate.