Add Qwen3 component harness: torch reference, equivalence helper, microbench helper#265
Closed
chhwang wants to merge 1 commit into
Closed
Add Qwen3 component harness: torch reference, equivalence helper, microbench helper#265chhwang wants to merge 1 commit into
chhwang wants to merge 1 commit into
Conversation
…ence-test helper, and microbench helper under examples/qwen3/
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #265 +/- ##
=======================================
Coverage 85.70% 85.70%
=======================================
Files 129 129
Lines 6457 6457
=======================================
Hits 5534 5534
Misses 923 923 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Closing without merging. The harness code (torch reference, equivalence + microbench helpers under examples/qwen3/) is retained on branch qwen3-q3-harness and carried by the component PRs that build on it; not landing it as a standalone PR. |
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.
Add Qwen3 component harness: torch reference, equivalence helper, microbench helper
Shared scaffolding under
examples/qwen3/for Q4–Q8 component work.Torch reference (
qwen3_ref.py): pure-torch Qwen3-8B forward —RMSNorm, RoPE (θ=1e6), QK-norm, GQA (32q/8kv, head_dim 128), SwiGLU MLP
(intermediate 12288), TransformerBlock, full model. Random-weight init with
fixed seed, fp16. No ARK dependency.
Config (
qwen3_config.py): parameterizedQwen3Configdataclass with8B defaults. All fields overridable for future 32B stretch.
Equivalence helper (
equiv.py):assert_close()wrappingtorch.testing.assert_closewith shape, max abs/rel error, and per-tensorstatistics on mismatch.
Microbench helper (
microbench.py): L2-flush buffer (128 MB),CUDA-graph capture, pilot-driven iteration tuning,
torch.profilertiming.Returns
{"mean_us", "std_us", "n_iters"}.Tests (
test_harness.py): 9 tests, all gated with@skipif(not torch.cuda.is_available()). Coverage: reference forward shape,RMSNorm unit-RMS check, causal mask validation, RoPE non-identity,
equivalence pass/fail/shape-mismatch, microbench eager + CUDA-graph.
Files are non-overlapping with Q1 (
bench/) and Q2 (PROFILE.md).