@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 2ad1029233
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 5, 04:45 UTC

[Bug] Fix batch invariance nvfp4 support (#39820)

Signed-off-by: yewentao256 <zhyanwentao@126.com>

Wentao Ye committed Apr 14, 2026 at 17:08 UTC 2ad10292339c045db0cb3998a76240a459cc83a7
2 files changed +8 -1
.buildkite/test_areas/misc.yaml
+1
@@ -224,6 +224,7 @@ steps:
224 - pytest -v -s v1/determinism/test_rms_norm_batch_invariant.py
225 - VLLM_TEST_MODEL=deepseek-ai/DeepSeek-V2-Lite-Chat pytest -v -s v1/determinism/test_batch_invariance.py::test_v1_generation_is_deterministic_across_batch_sizes_with_needle[TRITON_MLA]
226 - VLLM_TEST_MODEL=Qwen/Qwen3-30B-A3B-Thinking-2507-FP8 pytest -v -s v1/determinism/test_batch_invariance.py::test_v1_generation_is_deterministic_across_batch_sizes_with_needle[FLASH_ATTN]
227 + - pytest -v -s v1/determinism/test_nvfp4_batch_invariant.py
228
229 - label: Acceptance Length Test (Large Models) # optional
230 timeout_in_minutes: 25
vllm/model_executor/kernels/linear/__init__.py
+7 -1
@@ -601,7 +601,13 @@ def init_nvfp4_linear_kernel() -> NvFp4LinearKernel:
601
602 # Env-var overrides.
603 force_kernel: type[NvFp4LinearKernel] | None = None
604 - if envs.VLLM_USE_FBGEMM:
604 + if envs.VLLM_BATCH_INVARIANT:
605 + logger.info_once(
606 + "VLLM_BATCH_INVARIANT forces NVFP4 linear to use the "
607 + "emulation backend for deterministic execution."
608 + )
609 + force_kernel = EmulationNvFp4LinearKernel
610 + elif envs.VLLM_USE_FBGEMM:
611 force_kernel = FbgemmNvFp4LinearKernel
612 elif envs.VLLM_USE_NVFP4_CT_EMULATIONS:
613 force_kernel = EmulationNvFp4LinearKernel