Repository navigation
test(gpu): move the excluded-device gate onto CalibrationConfig (#4868) - #4919
Merged
Merged
Conversation
tests/test_excluded_device_warmup.py::test_quantize_never_claims_the_excluded_device is the end-to-end gate for #4320/#4653, but its subprocess script still called quantize() with batch_size= and calibration_data_min_length=, both removed by #4724. Both parametrizations raised TypeError before measuring anything, so the "excluded GPU stays unclaimed" guarantee had no working test. The test is gpu/slow/integration and needs two devices, which is why CI never saw it. The script now passes CalibrationConfig(dataset=..., batch_size=1, min_length=1). tests/test_quantize_call_signature_4868.py is the CPU-only guard: it parses every module under tests/ and the Python source held in its string constants (where the broken call lived) and rejects any quantize() call that passes a keyword removed by #4724. Two extra cases keep the scan honest - it must reach the embedded gate script, and that script's quantize() must pass a CalibrationConfig. Red: 2 failed (TypeError) on the gate, 2 failed in the new guard. Green: 2 passed on the gate, 17 passed for the file, 3 passed in the guard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4868. Test-only; no library behaviour changed.
What was wrong
tests/test_excluded_device_warmup.py::test_quantize_never_claims_the_excluded_deviceis the end-to-end gate for #4320/#4653 ("an excluded GPU gets no context and no
allocations during quantize"). It runs a subprocess script, and that script
still called the pre-#4724 API:
4a871bf(#4724) removed those keywords, so both parametrizations died beforemeasuring anything:
The test is
gpu/slow/integrationand needs two devices, which is why CInever saw it. The #4653 guarantee had no working test.
Fix
min_length=1is the oldcalibration_data_min_length=1;batch_size=1wasalready the
CalibrationConfigdefault but is kept explicit so the two callsread as a straight translation.
Guard so this cannot recur
The issue suggested a cheap CPU-only check.
tests/test_quantize_call_signature_4868.pyparses every module under
tests/and the Python source held in its stringconstants, then rejects any
quantize()call that still passes a keywordremoved by #4724:
It walks string constants because the broken call lived inside
_EXCLUDED_DEVICE_SCRIPT, which a plaintests/**/*.pyscan cannot see. Twoextra cases keep the guard honest: one asserts the scan actually reaches that
embedded script, and one asserts the gate's
quantize()call passes aCalibrationConfig.Red / green
Red,
origin/main@985e5ab, gate script unchanged:Green, same host, with the fix:
The gate's own assertions are what matter here — it now reaches them:
payload["before"] is Falsepayload["peak1"] > 0payload["claimed"] is Falsepayload["peak0"] == 0Both routes pass:
compute_device_filteranddevice=("cuda:1",).Validation
ruff checkpasses on both changed files.No logic-flow diagram
This changes no control flow, selection order or tensor lifecycle: it repairs a
test's call site and adds a static check over test sources.
Claim:
agent-11788dff99fd, workload765991797ab1.