Skip to content

[CI] Speed up quantization test group - #53291

Merged
mgoin merged 19 commits into
vllm-project:mainfrom
fxmarty-amd:speed-up-quantization-tests
Sep 1, 2026
Merged

mgoin merged 19 commits into
vllm-project:mainfrom
fxmarty-amd:speed-up-quantization-tests

Conversation

@fxmarty-amd

@fxmarty-amd fxmarty-amd commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Disclosure

AI assistance was used. The changes were reviewed and tested manually.

Purpose

Speed up quantization test group, this PR fixes #51142.

After all models are cached / compilation done (i.e., second run):

Branch Device Number of tests run Testing time
This branch (4ee2808) local MI350 579 (512 passed, 67 skipped) 0:21:56
main (9f295fe) local MI350 586 (515 passed, 71 skipped) 0:56:09
This branch (c91679e) local MI300 504 passed, 76 skipped 0:17:41
main (d9fbe52) local MI300 506 passed, 80 skipped 0:50:11
Branch Device Number of tests run Testing time
This branch (c91679e) hosted MI350 513 passed, 67 skipped 0:26:17
main (d9fbe52) hosted MI350 515 passed, 71 skipped 0:57:52
This branch (c91679e) hosted MI300 509 passed, 71 skipped 0:34:05
main (d9fbe52) hosted MI300 511 passed, 75 skipped 1:23:02

Common changes to many tests:

  • avoid to instantiate a vllm runner when the tests do not require it. Instantiating vllm runner / cleaning it up is too slow for simple integration tests.
  • Use hf_override on num_hidden_layers (to a smaller number, e.g. 3)

Three accuracy tests are move to

- label: ":amd: (MI300) LM Eval Large Models" # TBD
and
- label: ":amd: (MI355) LM Eval Large Models" # TBD

Remaining:

See e.g. on main + MI355 https://buildkite.com/vllm/amd-ci/builds/12275/list?sid=01a01e66-70c8-42cb-8d84-bfea236686e4&tab=output that has:

===================================================================== slowest 25 durations =====================================================================
122.48s call     tests/quantization/test_quark.py::test_nvfp4_wikitext_correctness[1]
103.76s call     tests/quantization/test_quark.py::test_ocp_mx_wikitext_correctness[tp_size:1-config:AccuracyTestConfig(model_name='fxmarty/qwen1.5_moe_a2.7b_chat_w_fp4_a_fp6_e2m3', excepted_value=11.3)]
97.75s call     tests/quantization/test_quark.py::test_ocp_mx_wikitext_correctness[tp_size:1-config:AccuracyTestConfig(model_name='fxmarty/qwen1.5_moe_a2.7b_chat_w_fp6_e3m2_a_fp6_e3m2', excepted_value=10.6)]
95.28s call     tests/quantization/test_quark.py::test_quark_w4a8_fp8_moe[1]
89.16s call     tests/quantization/test_quark.py::test_ocp_mx_wikitext_correctness[tp_size:1-config:AccuracyTestConfig(model_name='fxmarty/qwen_1.5-moe-a2.7b-mxfp4', excepted_value=12.45)]
87.37s call     tests/quantization/test_cpu_offload.py::test_cpu_offload_fp8
80.44s call     tests/quantization/test_cpu_offload.py::test_cpu_offload_awq
69.00s call     tests/quantization/test_compressed_tensors.py::test_compressed_tensors_no_enforce_eager
68.46s call     tests/quantization/test_torchao.py::test_qwenvl_int8wo_model_loading_with_params
67.06s call     tests/quantization/test_fp8.py::test_online_quant_peak_mem
59.53s call     tests/quantization/test_compressed_tensors.py::test_w4a16_moe_torch_compile
56.93s call     tests/quantization/test_online.py::test_online_quant_peak_mem
56.44s call     tests/quantization/test_compressed_tensors.py::test_compressed_tensors_w8a8_logprobs[True-10-4-neuralmagic/Llama-3.2-1B-quantized.w8a8]
55.48s call     tests/quantization/test_online.py::test_online_quantization[True-fp8_per_block-None-Fp8PerBlockOnlineLinearMethod-Fp8PerBlockOnlineMoEMethod]
52.44s call     tests/quantization/test_online.py::test_online_quantization[True-mxfp4-None-Mxfp4OnlineLinearMethod-Mxfp4OnlineMoEMethod]
48.90s call     tests/quantization/test_quark.py::test_quark_fp8_parity
47.36s call     tests/quantization/test_online.py::test_online_quantization[True-online-online_quant_args2-Fp8PerBlockOnlineLinearMethod-Fp8PerTensorOnlineMoEMethod]
46.98s call     tests/quantization/test_online.py::test_online_quantization[False-mxfp4-None-Mxfp4OnlineLinearMethod-Mxfp4OnlineMoEMethod]
46.74s call     tests/quantization/test_compressed_tensors.py::test_compressed_tensors_fp8
46.26s call     tests/quantization/test_online.py::test_online_quantization[True-fp8_per_tensor-None-Fp8PerTensorOnlineLinearMethod-Fp8PerTensorOnlineMoEMethod]
45.52s call     tests/quantization/test_auto_awq.py::test_auto_awq_quantization_method[Qwen/Qwen2-1.5B-Instruct-AWQ]
45.04s call     tests/quantization/test_online.py::test_online_quantization[True-fp8_per_tensor-online_quant_args3-Fp8PerTensorOnlineLinearMethod-Fp8PerTensorOnlineMoEMethod]
43.70s call     tests/quantization/test_quark.py::test_quark_int8_w_per_tensor_a_per_tensor[1]
43.62s call     tests/quantization/test_compressed_tensors.py::test_compressed_tensors_w8a8_logprobs[False-10-4-neuralmagic/Llama-3.2-1B-quantized.w8a8]
43.33s call     tests/quantization/test_online.py::test_online_quantization[False-online-online_quant_args2-Fp8PerBlockOnlineLinearMethod-Fp8PerTensorOnlineMoEMethod]

Test Plan

- VLLM_TEST_FORCE_LOAD_FORMAT=auto pytest -v -s quantization/ --ignore quantization/test_blackwell_moe.py

run locally.

Additional gsm8k tests, run through:

cat > tests/evals/gsm8k/configs/tests_refactor.txt << 'EOF'
Qwen-1.5-MOE-W-MXFP4-A-MXFP6.yaml
Qwen-1.5-MOE-W-MXFP6-A-MXFP6.yaml
Qwen3-30B-A3B-NVFP4-quark.yaml
EOF

and

pytest -s -v tests/evals/gsm8k/test_gsm8k_correctness.py --config-list-file=tests/evals/gsm8k/configs/tests_refactor.txt

Test Results

VLLM_TEST_FORCE_LOAD_FORMAT=auto HIP_VISIBLE_DEVICES=1 nohup pytest -vvvvv -s --durations=50 tests/quantization/ --ignore tests/quantization/test_blackwell_moe.py on 1xMI350, after all model download:

  • On this branch at 4ee2808: 512 passed, 67 skipped, 28 warnings in 1317.00s (0:21:56)
  • On main at 9f295fe: 515 passed, 71 skipped, 23 warnings in 3369.39s (0:56:09)

Signed-off-by: Felix Marty <Felix.Marty@amd.com>
@fxmarty-amd fxmarty-amd changed the title speed up test_online_quantization [CI] Speed up quantization test group Aug 21, 2026
@mergify mergify Bot added the quantization label Aug 21, 2026
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
@mergify

mergify Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--53291.org.readthedocs.build/en/53291/

@mergify mergify Bot added the documentation Improvements or additions to documentation label Aug 24, 2026
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
excepted_value=10.6,
),
AccuracyTestConfig(
model_name="fxmarty/qwen_1.5-moe-a2.7b-mxfp4", excepted_value=12.45

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case is dropped as covered by other gsm8k yaml configs.

Signed-off-by: Felix Marty <Felix.Marty@amd.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@AndreasKaratzas

Copy link
Copy Markdown
Member

@fxmarty-amd How much is the speedup? Can you share here a mi300/mi355 before and after table?

@AndreasKaratzas

Copy link
Copy Markdown
Member

/amd-ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite AMD CI #12348 for commit 4ee280832afe.

@fxmarty-amd

fxmarty-amd commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

@fxmarty-amd How much is the speedup? Can you share here a mi300/mi355 before and after table?

It was ongoing, done now, see Test Results / updated PR description

I could break it down per-test, if necessary.

@fxmarty-amd

Copy link
Copy Markdown
Contributor Author

Remaining slow tests (some addressed in #53585, others I'd prefer to do later):

111.22s call     tests/quantization/test_cpu_offload.py::test_cpu_offload_fp8
93.07s call     tests/quantization/test_cpu_offload.py::test_cpu_offload_awq
73.39s call     tests/quantization/test_compressed_tensors.py::test_compressed_tensors_w8a8_logprobs[True-10-4-neuralmagic/Llama-3.2-1B-quantized.w8a8]
63.56s call     tests/quantization/test_compressed_tensors.py::test_compressed_tensors_no_enforce_eager
55.06s call     tests/quantization/test_compressed_tensors.py::test_compressed_tensors_w8a8_logprobs[False-10-4-neuralmagic/Llama-3.2-1B-quantized.w8a8]
50.64s call     tests/quantization/test_fp8.py::test_online_quant_peak_mem
43.61s call     tests/quantization/test_compressed_tensors.py::test_w4a16_moe_torch_compile
38.68s call     tests/quantization/test_fp8.py::test_online_quantization[True-False-fp8]
37.66s call     tests/quantization/test_register_quantization_config.py::test_custom_quant[meta-llama/Llama-3.2-1B-Instruct]
35.97s call     tests/quantization/test_fp8.py::test_online_quant_load_format_dummy
35.81s call     tests/quantization/test_fp8.py::test_online_quantization[True-False-auto]
33.46s call     tests/quantization/test_torchao.py::test_pre_quantized_model
32.48s call     tests/quantization/test_modelopt.py::test_modelopt_fp8_pc_pt_checkpoint_setup
31.75s call     tests/quantization/test_online.py::test_online_quant_load_format_dummy
31.62s call     tests/quantization/test_online.py::test_online_quant_peak_mem
30.57s call     tests/quantization/test_fp8.py::test_online_quantization[False-False-fp8]

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite AMD CI #12364 for commit c91679e660fc.

@BowenBao BowenBao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes seem fair to me. The unittests affected mostly are doing simple checks that don't need vllm_runner, and the ones that need are covered by model eval tests.

My only concern is over robustness of load_model_without_vllm_runner

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, we have more coverage with shorter test time!

@fxmarty-amd fxmarty-amd Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, the nvfp4/mxfp4 tests

122.48s call     tests/quantization/test_quark.py::test_nvfp4_wikitext_correctness[1]
103.76s call     tests/quantization/test_quark.py::test_ocp_mx_wikitext_correctness[tp_size:1-config:AccuracyTestConfig(model_name='fxmarty/qwen1.5_moe_a2.7b_chat_w_fp4_a_fp6_e2m3', excepted_value=11.3)]
97.75s call     tests/quantization/test_quark.py::test_ocp_mx_wikitext_correctness[tp_size:1-config:AccuracyTestConfig(model_name='fxmarty/qwen1.5_moe_a2.7b_chat_w_fp6_e3m2_a_fp6_e3m2', excepted_value=10.6)]
89.16s call     tests/quantization/test_quark.py::test_ocp_mx_wikitext_correctness[tp_size:1-config:AccuracyTestConfig(model_name='fxmarty/qwen_1.5-moe-a2.7b-mxfp4', excepted_value=12.45)]

are moved to respectively:

- label: ":amd: (MI300) LM Eval Large Models" # TBD

- label: ":amd: (MI355) LM Eval Large Models" # TBD

and now use gsm8k instead of wikitext, that is not available in https://github.com/vllm-project/vllm/tree/main/tests/evals, unfortunately.

Alternatively, we could have a test_quark_eval.py that uses actual lm-eval lib + wikitext, and register it as part of the groups above.

For the record,

cat > tests/evals/gsm8k/configs/tests_refactor.txt << 'EOF'
Qwen-1.5-MOE-W-MXFP4-A-MXFP6.yaml
Qwen-1.5-MOE-W-MXFP6-A-MXFP6.yaml
Qwen3-30B-A3B-NVFP4-quark.yaml
EOF

and

pytest -s -v tests/evals/gsm8k/test_gsm8k_correctness.py --config-list-file=tests/evals/gsm8k/configs/tests_refactor.txt

takes:

  • on 1xMI350: 3 passed, 14 warnings in 345.70s (0:05:45)
  • on 1xMI300: 3 passed, 14 warnings in 429.37s (0:07:09)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this coverage is moved to model eval test

@fxmarty-amd fxmarty-amd Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is moved to test_online.py parametrized test

dtype="bfloat16",
enforce_eager=True,
) as llm:
output = llm.generate_greedy(["The capital of France is"], max_tokens=4)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not checking generate output for reasonable content anyways (only does assert output), seems fair to simplify the test for shorter run time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

In this PR, we call a single forward with attention/KV cache instead of calling generate. The generate output was not checked in the modified tests.

Note that we use monkeypatch.setattr(Attention, "forward", lambda _, q, k, v: q.contiguous()) to be able to call model forward without KV cache allocation.

I think for simple integration tests it is reasonable

model.load_weights = load_weights


def load_model_without_vllm_runner(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this potentially break if vllm runner is updated?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, right, it duplicates DefaultModelLoader.load_model, which is not ideal.

Simplified in 9ed1b8f to rely purely on DefaultModelLoader.load_model instead, which this load_model_without_vllm_runner function wraps.

Signed-off-by: Felix Marty <Felix.Marty@amd.com>
@fxmarty-amd

Copy link
Copy Markdown
Contributor Author

Let's retrigger the CI once approved by maintainers.

@AndreasKaratzas

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #86387 for commit 8b4d51de5567.

@fxmarty-amd

Copy link
Copy Markdown
Contributor Author

/amd-ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite AMD CI #12479 for commit 8b4d51de5567.

@mgoin

mgoin commented Aug 31, 2026

Copy link
Copy Markdown
Member

@fxmarty-amd this nan failure definitely seems related

FAILED quantization/test_quark.py::test_quark_int8_w8a8_moe - AssertionError: assert tensor(False, device='cuda:0')
 +  where tensor(False, device='cuda:0') = <built-in method all of Tensor object at 0x7f544a4fe2b0>()
 +    where <built-in method all of Tensor object at 0x7f544a4fe2b0> = tensor([[False, False, False,  ..., False, False, False],\n        [False, False, False,  ..., False, False, False],\n        [False, False, False,  ..., False, False, False],\n        [False, False, False,  ..., False, False, False]], device='cuda:0').all
 +      where tensor([[False, False, False,  ..., False, False, False],\n        [False, False, False,  ..., False, False, False],\n        [False, False, False,  ..., False, False, False],\n        [False, False, False,  ..., False, False, False]], device='cuda:0') = <built-in method isfinite of type object at 0x7f60f87f4f20>(tensor([[nan, nan, nan,  ..., nan, nan, nan],\n        [nan, nan, nan,  ..., nan, nan, nan],\n        [nan, nan, nan,  ..., nan, nan, nan],\n        [nan, nan, nan,  ..., nan, nan, nan]], device='cuda:0',\n       dtype=torch.bfloat16))
 +        where <built-in method isfinite of type object at 0x7f60f87f4f20> = torch.isfinite

@AndreasKaratzas AndreasKaratzas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait for green CI first -- @fxmarty-amd check the failure on NV that is there.

@fxmarty-amd

Copy link
Copy Markdown
Contributor Author

I am not able to reproduce this failure on H100 and H200, this passes locally. It definitely seem related given that test_quark_int8_w8a8_moe was modified here to:

    monkeypatch.setattr(Attention, "forward", lambda _, q, k, v: q.contiguous())
    input_ids = torch.tensor([1, 2, 3, 4], device=DEVICE_TYPE)
    positions = torch.arange(input_ids.numel(), device=DEVICE_TYPE)
    with (
        set_current_vllm_config(vllm_config),
        set_forward_context(None, vllm_config, num_tokens=input_ids.numel()),
    ):
        hidden_states = model(input_ids, positions, None)
        logits = model.compute_logits(hidden_states)
    assert torch.isfinite(logits).all()

Could we try /ci retry ?

Alternatively, is there an easy way to rerun in the exact same docker environment as CI? I'll try to look for that.

@mergify

mergify Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @fxmarty-amd.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 1, 2026
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
@mergify mergify Bot removed the needs-rebase label Sep 1, 2026
@fxmarty-amd

fxmarty-amd commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

I can not reproduce either on H200 using:

export IMAGE=public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:8b4d51de5567cf952282d25dd0655c3ce47c25b3
docker pull "$IMAGE"

docker run --rm -td --init --name felix_repro_h200 \
    --gpus all \
    --volume /dev/shm:/dev/shm \
    --env HF_TOKEN \
    --env NCCL_CUMEM_HOST_ENABLE=0 \
    --env PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False \
    --env VLLM_USAGE_SOURCE=ci-test \
    --env VLLM_USE_V2_MODEL_RUNNER=0 \
    --env VLLM_GPU_SYNC_CHECK=error \
    -v $(pwd)/scratch/felmarty:/felmarty \
    "$IMAGE" \
    /bin/bash


pip uninstall vllm
apt install curl wget
pip install setuptools_scm setuptools_rust tblib
pip install torchao==0.17.0 --index-url https://download.pytorch.org/whl/cu130
pip install conch-triton-kernels
git config --global --add safe.directory /felmarty/repos/vllm
VLLM_USE_PRECOMPILED=1 pip install -vvv --editable . --no-build-isolation

VLLM_TEST_FORCE_LOAD_FORMAT=auto pytest tests/quantization/test_quark.py -vvvvv -s -k "test_quark_int8_w8a8"

VLLM_TEST_FORCE_LOAD_FORMAT=auto \
    pytest tests/quantization/ -vvvvv -s \
      --ignore quantization/test_blackwell_moe.py \
      -k "not test_compressed_tensors_w4a8_fp8" \
      --shard-id=3 --num-shards=4

(from

- VLLM_TEST_FORCE_LOAD_FORMAT=auto pytest -v -s quantization/ --ignore quantization/test_blackwell_moe.py -k 'not test_compressed_tensors_w4a8_fp8' --shard-id=$$BUILDKITE_PARALLEL_JOB --num-shards=$$BUILDKITE_PARALLEL_JOB_COUNT
)

@mgoin

mgoin commented Sep 1, 2026

Copy link
Copy Markdown
Member

/ci run

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #86639 for commit ce767ed5a91a.

@mgoin
mgoin enabled auto-merge (squash) September 1, 2026 18:14
@mgoin
mgoin merged commit d1c15e5 into vllm-project:main Sep 1, 2026
90 checks passed
mylibrar pushed a commit to tanyuqian/vllm that referenced this pull request Sep 3, 2026
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
sheralskumar pushed a commit to sheralskumar/vllm that referenced this pull request Sep 8, 2026
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation quantization ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][CI] Speed up Quantization mi300/mi355 test groups

4 participants