Repository navigation
Build the reduced float Reduce test reference from the rounded inputs - #206820
pablo-garay wants to merge 1 commit into
Conversation
FunctionalTestsReducedFloat.Reduce generates float inputs, rounds them to BFloat16/Half for the vectorized path, and compares against a float reference computed from the unrounded inputs. The reduced float reduce helpers (reduce_all, map*_reduce_all in functional_bfloat16.h) convert to float and do all of the math in float, so the only real difference between the two results is the input rounding. Summed over up to N terms (66 for AVX512 BFloat16) that rounding error is on the order of 0.01, while the tolerance is 0.01 + 1% of the result, which fails whenever the sum cancels to near zero. This happened on CI with seed 1795644424012988038: map3_reduce_all, Length: 49; fp32: -0.0549982; bf16: -0.0659196. Build the float reference inputs from the rounded values instead, so the comparison measures the vectorized reduction rather than the input quantization. The tolerances are unchanged. Test Plan: A numpy model of the test (same ValueGen distribution, AVX512 BFloat16 sizes, all four reductions) fails about 0.7% of seeds with the old construction and none of 20000 seeds with the new one. No local build was available to run the C++ test itself. ``` python3 sim_reduce.py ``` Signed-off-by: Pablo Garay <[email protected]>
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - Ready for human review:
Findings (1): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/206820
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 1 Unclassified FailureAs of commit 6f56673 with merge base deaabcc ( NEW FAILURE - The following job has failed:
UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Warning: Unknown label
Please add the new label to .github/pytorch-probot.yml |
There was a problem hiding this comment.
Automated review of 6f56673: nothing blocking; ready for human review.
This PR changes the FunctionalTestsReducedFloat.Reduce test so its float reference is built from the BFloat16/Half-rounded inputs, not the unrounded ones. The fix looks right and old seeds still reproduce, but this comes from reading the code only. Recommendation: Approve, with one non-blocking point.
⚪ 1 non-blocking finding is attached to the code below, collapsed.
This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review
| x_f2[i] = RT(x_b2[i]); | ||
| x_f3[i] = RT(x_b3[i]); | ||
| } | ||
| float atol = 0.01f; |
There was a problem hiding this comment.
⚪ Non-blocking: the test could be stricter now.
This is a follow-up idea; the PR loosens nothing. The old atol = rtol = 0.01 was sized to absorb input-rounding noise in the reference, and this PR removes that noise. cmp takes VT val, so the float results of reduce_all and map*_reduce_all are rounded to BFloat16/Half before the comparison. Together, that rounding and the old tolerance leave much more slack than the float result needs. A regression such as accumulating in BFloat16 inside functional_bfloat16.h might still pass for many seeds (plausible from the arithmetic, not demonstrated). Suggestion: compare y2 as a float against y1 with a tighter tolerance to sharpen those four checks. This wouldn't help reduce2_all, which rounds to scalar_t internally before returning (functional_bfloat16.h:181, :185, :225).
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 2 checks: Auto Request Review, trunk / macos-py3-arm64 / test (default, 2, 3, macos-m1-stable) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
spin fixlint)Linked issue or supporting maintainer
Supported by @jeffdaily
Tracking issue: https://github.com/jithunnair-amd/sandbox/issues/11666
BC-breaking?
No
Summary (human written only)
vec_test_all_types_AVX512FunctionalTestsReducedFloat/0.Reduce(BFloat16) failed on the ROCm MI350 default job with seed 1795644424012988038 (map3_reduce_all, Length: 49; fp32: -0.0549982; bf16: -0.0659196, failing job) and passed when rerun with a new seed. The test compares the reduced float reductions against a float reference computed from the unrounded inputs, while the vectorized path gets the inputs rounded to BFloat16/Half. Sincereduce_allandmap*_reduce_allinfunctional_bfloat16.hconvert to float and do all the math in float, the only real difference is the input rounding, and summed over up to 66 terms it can exceed the0.01 + 1%tolerance whenever the result cancels to near zero. This builds the float reference inputs from the rounded values, so the test checks the vectorized reduction instead of input quantization. The tolerances are unchanged.Agent details
An AI coding agent did the CI log analysis and wrote the change and this description. No local PyTorch build was available, so the C++ test was not compiled or run, and nothing was run on a GPU (the test itself is CPU-only). A numpy model of the test (same
ValueGendistribution and AVX512 BFloat16 sizes, all four reductions) fails about 0.7% of seeds with the current reference and none of 20000 seeds with the reference built from the rounded inputs.