test: relocate spec_decode_verify test into the collected suite#6
Merged
Conversation
The spec_decode_verify validation lived in a root-level test_spec_verify.py script that pytest does not collect, so it never ran in CI. Fold its coverage into TestFast.test_spec_decode_verify (oracle-checked cases across fp32/fp16/bf16, both the fused-kernel and cpu-composition paths, a randomized sweep, and the bad-shape rejection) and drop the root script.
khosravipasha
approved these changes
Jul 14, 2026
There was a problem hiding this comment.
Pull request overview
This PR relocates the spec_decode_verify validation from a non-collected root-level script into the pytest-collected Python test suite, ensuring the coverage runs in CI.
Changes:
- Removed the root-level
test_spec_verify.pystandalone validation script. - Added
test_spec_decode_verifytopython/tests/test_fast.py, porting the oracle-based checks (hand cases, CPU fallback path, randomized sweep, and shape rejection) intounittest/pytest collection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
test_spec_verify.py |
Deletes the uncollected root-level __main__ validation script. |
python/tests/test_fast.py |
Adds a collected unit test covering mx.fast.spec_decode_verify behavior across dtypes/paths plus randomized and error-path coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What
Move the
spec_decode_verifyvalidation out of the root-leveltest_spec_verify.pyscript and into
python/tests/test_fast.pyasTestFast.test_spec_decode_verify,and delete the root script.
Why
The script added in #5 sat at the repo root as a
__main__program. pytest doesnot collect it (not
test_-prefixed, not underpython/tests/), so its coveragenever actually ran in CI — it was only runnable by hand. This folds the same
checks into the collected suite.
How
test_spec_decode_verifyports the script's coverage as assertions:two batched shapes) across
fp32/fp16/bf16.and
stream=mx.cpu(the op-composition fallback).corrected-token positions.
target_logits.shape[1] != K + 1rejection.Verified the restructured harness matches the op's documented contract (greedy
argmax then prefix-match then commit) across all cases and the shape-rejection
using a reference stand-in; the underlying kernel/op is unchanged from #5.
No production code changes — test-only.