fix(ks/auto-bench): clone reference inputs for v1 instead of re-seeding - #167
Open
Jiwangreal wants to merge 3 commits into
Open
fix(ks/auto-bench): clone reference inputs for v1 instead of re-seeding#167Jiwangreal wants to merge 3 commits into
Jiwangreal wants to merge 3 commits into
Conversation
added 3 commits
July 23, 2026 16:38
…-sdpa flag - Reseed RNG before constructing both v0 and v1 models in build_case so parameterized models start from equivalent weights. - Add --math-sdpa flag to force PyTorch SDPA to math backend, bypassing incompatible FlashAttention plugins on ROCm/DCU. - Add unit test verifying reseeded models produce identical weights.
v0/reference get_inputs is now the canonical input source. v1 receives a deep copy of the same tensors via clone_value() instead of generating its own inputs under the same seed, eliminating false correctness failures from CPU vs CUDA RNG differences. compare_case later moves both copies to the same accelerator before executing, so device placement is unaffected. Adds test_build_case_clones_reference_inputs_for_v1 to verify both value equality and independent storage (distinct data_ptr).
|
wangji seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
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.
Summary
v0/reference
get_inputsis now the canonical input source. v1 receives a deep copy of the same tensors viaclone_value()instead of generating its own inputs under the same seed, eliminating false correctness failures from CPU vs CUDA RNG differences.compare_caselater moves both copies to the same accelerator before executing either implementation, so device placement is unaffected.Changes
benchmarks/ks/auto_bench.py: Inbuild_case, v1 inputs are cloned from v0 canonical inputs instead of independently generated viaset_seed+v1_get_inputs. Removes the argument-count check (canonical data guarantees matching lengths).tests/benchmarks/test_ks_auto_bench.py: Addstest_build_case_clones_reference_inputs_for_v1verifying both value equality and independent storage (distinctdata_ptr).Verification
python3.10 -m unittest tests.benchmarks.test_ks_auto_bench -vpassed 4/4Closes the device-RNG mismatch that caused false negatives when v0 ran on CPU and v1 on CUDA (or vice versa).