[ci-fix] Needs review: Widen Tan tolerance for ARM64 iOS simulator precision (refs #129045)#130016
Draft
github-actions[bot] wants to merge 2 commits into
Draft
[ci-fix] Needs review: Widen Tan tolerance for ARM64 iOS simulator precision (refs #129045)#130016github-actions[bot] wants to merge 2 commits into
github-actions[bot] wants to merge 2 commits into
Conversation
The previous fix (PR #129652) set trigTolerance to 1e-5f/1e-14 for float/double when FMA is supported, but the test still fails on iossimulator-arm64 (153/201 items for Single, 123/201 for Double). Tan = Sin/Cos amplifies range-reduction rounding errors for large radian inputs (-100 to 100), requiring a wider tolerance than Sin or Cos individually. Use the non-FMA tolerance values (1e-4f/1e-10) specifically for Tan, matching the pattern used by SinPi. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-numerics |
This was referenced Jun 30, 2026
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.
Workflow artifact: ci-fix
Artifact kind: help
Linked KBE: #129045
Root cause
PR #129652 (merged June 22) changed
trigTolerancefromnullto1e-5f/1e-14for float/double when FMA is supported, and removed the[ActiveIssue]that was skipping the test on Apple Mobile CoreCLR. However, the test still fails — 16 hits in the past 7 days, 31 in the past month, all after the fix was merged.The issue is that
Tan = Sin/Cosamplifies range-reduction rounding errors. For large radian inputs (the test sweeps -100 to 100), the vectorized range reduction on ARM64 differs from scalar, and these differences compound through the division. While1e-5ffor float is sufficient forSinandCosindividually, it is too tight forTan.Failing log line (build 1449088):
Fix
Give
Tanits own wider tolerance instead of sharingtrigTolerancewithSin/Cos:1e-4f(was1e-5f) — matches the non-FMA trig tolerance andSinPi's float tolerance1e-10(was1e-14) — matches the non-FMA trig toleranceThis follows the existing pattern where functions with known wider precision divergence have their own inline tolerance (e.g.,
SinPiat line 508,Cbrtat line 474).What is unverified / help needed
dotnet buildor tests.1e-4ffloat tolerance is the same as the non-FMA case. It may be more generous than strictly needed, but it is safe (it only relaxes the check). If on-device testing shows tighter bounds work, the tolerance can be reduced.1e-10double tolerance is also the non-FMA value. The actual required tolerance for double Tan on ARM64 may be tighter, but we don't have the actual double diff values from the KBE.Suggested reviewers / area contacts
@tannergooding(area-System.Numerics.Tensors owner)Validation
dotnet build src/libraries/System.Numerics.Tensors/tests/System.Numerics.Tensors.Tests.csprojEvidence
Filed by
ci-failure-fix, which attempts validated fixes for[ci-scan]Known Build Errors and otherwise loops in owners. Comment here or on the workflow file to suggest changes;ci-failure-scan-feedbackreads in-scope feedback daily and opens (or updates) a PR with prompt edits.Note
🔒 Integrity filter blocked 2 items
The following items were blocked because they don't meet the GitHub integrity level.
issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: