[https://nvbugs/6160629][fix] AutoDeploy: Fix manual seed setting for standalone tests - #14954
Conversation
📝 WalkthroughWalkthroughTest tolerance for RoPE bfloat16 comparison is relaxed from ChangesRoPE Test Tolerance
🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/bot run |
|
PR_Github #52051 [ run ] triggered by Bot. Commit: |
|
PR_Github #52051 [ run ] completed with state
|
|
/bot run |
|
PR_Github #52087 [ run ] triggered by Bot. Commit: |
bmarimuthu-nv
left a comment
There was a problem hiding this comment.
Thanks @galagam !
…s FI rope test BF16 with only 7 mantissa bits is more numerically sensitive than FP16. Test is passing for some seeds, failing for others with small mismatches for large values. The original atol/rtol = 1e-4/1e-4 threshold is too strict. Increase to rtol to 1e-2 relaxes check for larger magnitudes. Examples: seed=23 q_hf[(0, 3, 0, 129)] = -0.0810546875 q_flash/custom_q[...] = -0.0805664062 abs diff = 0.0004882812 relative diff ~= 0.0060 seed=41 k_hf[(1, 2, 0, 189)] = 0.7148437500 k_flash/custom_k[...] = 0.7187500000 abs diff = 0.0039062500 relative diff ~= 0.0054 seed=95 q_hf[(1, 3, 0, 227)] = 1.1640625000 q_flash/custom_q[...] = 1.1718750000 abs diff = 0.0078125000 relative diff ~= 0.0067 Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
8669233 to
bb009c2
Compare
|
/bot run |
|
PR_Github #52126 [ run ] triggered by Bot. Commit: |
|
PR_Github #52087 [ run ] completed with state |
|
PR_Github #52126 [ run ] completed with state
|
The standalone-package test (test_run_unit_tests) runs the auto_deploy unit tests under pytest-xdist (-n 4). test_rope_op_variants.py seeded the RNG once at module import and never per test, so each test's inputs depended on how many RNG draws the preceding tests consumed. Under xdist, tests are distributed across workers dynamically, so that effective seed varied run-to-run. The bf16/fp16 RoPE equivalence tests use near-ULP tolerances that only hold for specific inputs, so the varying seed produced ~3% intermittent failures (e.g. test_flashinfer_custom_op_strided_interleaved[bfloat16-256]). Seed the RNG explicitly at the start of each existing test so inputs are independent of collection order, making the suite deterministic under xdist. New tests should instead pick tolerances reflecting the dtype error floor rather than relying on a fixed seed. This also reverts the earlier rtol relaxation on test_flashinfer_custom_op_and_hf_impl, which targeted a test that was not the one failing and masked the precision gap. Validated: full standalone suite passed 10/10 under pytest -n 4 (1719 passed, 0 failed each run). Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
|
/bot run |
|
PR_Github #52266 [ run ] triggered by Bot. Commit: |
|
PR_Github #52266 [ run ] completed with state |
… standalone tests (NVIDIA#14954) Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com> Signed-off-by: NVFB <186336021+NVFB@users.noreply.github.com>
… standalone tests (NVIDIA#14954) Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
Summary by CodeRabbit
Description
BF16 with only 7 mantissa bits is more numerically sensitive than FP16. Test is passing for some seeds, failing for others with small mismatches for large values. The original atol/rtol = 1e-4/1e-4 threshold is too strict.
This test was manually seeded with a fixed seed at import, which produced deterministic results on normal runs. However, within the standalone package, it runs with pytest-xdist (dynamic test distribution), rendering the seed at the module ineffective.
This PR sets the same manual seed in each of the existing test.
This is not the correct solution from a numeric POV, since we're relying on some lucky seed where the accuracy can pass instead of correctly scoping and guarding the accuracy for any given input.
However, this practice is widely used in the test suite, and this PR aims to fix the standalone verification and not improve accuracy testing overall.
Examples:
seed=23
q_hf[(0, 3, 0, 129)] = -0.0810546875
q_flash/custom_q[...] = -0.0805664062
abs diff = 0.0004882812
relative diff ~= 0.0060
seed=41
k_hf[(1, 2, 0, 189)] = 0.7148437500
k_flash/custom_k[...] = 0.7187500000
abs diff = 0.0039062500
relative diff ~= 0.0054
seed=95
q_hf[(1, 3, 0, 227)] = 1.1640625000
q_flash/custom_q[...] = 1.1718750000
abs diff = 0.0078125000
relative diff ~= 0.0067
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.