test: cover Compressor overlap and non-overlap windowing (PRPUNDIT-25) - #1085
test: cover Compressor overlap and non-overlap windowing (PRPUNDIT-25)#1085jiagaoxiang wants to merge 2 commits into
Conversation
Dedicated CPU behavioral oracle for CSA (ratio=4) and HCA (ratio=128), kept out of the FP32-policy suite so a stitching bug cannot hide behind shape/dtype checks.
There was a problem hiding this comment.
🟢 Approval recommended
The PR is test-only and the new tests accurately mirror the production windowing/pooling/RMSNorm logic while adding concrete coverage for overlap vs non-overlap behavior and a key input-shape guard.
Pull request overview
Adds a focused CPU unit test suite that validates primus.backends.megatron.core.transformer.compressor.Compressor.forward behavior for both CSA overlap (ratio=4) and HCA non-overlap (ratio=128) by comparing against an independent, hand-derived windowing + softmax-pool + RMSNorm oracle.
Changes:
- Introduces
tests/unit_tests/backends/megatron/test_compressor_forward.pywith a manual reference implementation for overlap and non-overlap window construction. - Adds behavioral assertions that (a) forward matches the independent oracle, (b) overlap window 0 uses causal zero padding (no predecessor leakage), and (c) contiguous-mode forward asserts when
S % ratio != 0.
File summaries
| File | Description |
|---|---|
| tests/unit_tests/backends/megatron/test_compressor_forward.py | New CPU behavioral tests that independently validate overlap/non-overlap windowing semantics and forward output against a manual oracle. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Linxwang's PRPUNDIT-25 note also asked for the fuse-proj split and the non-divisible sequence guard alongside the windowing oracle.
There was a problem hiding this comment.
🟢 Approval recommended
The new tests are consistent with the current Compressor implementation and meaningfully close the stated behavioral test gap without introducing risky production changes.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
TestIntel PR Steward: Checked the The image build itself completes fine (all layers cached, image tagged This comes from the This is a repo-wide CI/secrets-config issue, not something introduced by this test-only change (the diff only adds The two Copilot reviews are both "approval recommended" with zero comments, so there's nothing to address there. Still waiting on a human approval and a passing/waived |
|
TestIntel PR Steward: Checked in on this PR after the poll flagged failed CI + reviews.
No code changes needed on my end right now. Will keep watching for a human review and for the |
|
Superseded by same-repo PR #1098 (head |
This PR was created by dougljia via Test Gap Resolver.
Summary
Compressor.forwardintests/unit_tests/backends/megatron/test_compressor_forward.py, not the FP32-policy suite (test_v4_keep_in_fp32.py) and not the fused-pool kernel suite (test_compressor_pool.py).ratio=4) and HCA non-overlap (ratio=128): windowiis[half_a[i], half_b[i-1]]with zeros on window 0, or a contiguousratioslice, then eager softmax-pool + RMSNorm.PRIMUS_COMPRESS_FUSE_PROJ) and the sequence-not-divisible-by-ratio guard, per linxwang's PRPUNDIT-25 note.Closes test gap PRPUNDIT-25.
Test plan
PYTHONPATH=. pytest tests/unit_tests/backends/megatron/test_compressor_forward.py(8 passed, CPU)black --checkon the new file