[ci-fix] Needs review: Fix TensorPrimitives Tan precision tolerance on ARM64 iOS simulator (refs #129045)#129652
Draft
github-actions[bot] wants to merge 2 commits into
Draft
Conversation
…n on ARM64 The vectorized Tan implementation diverges by a few tens of ULPs from scalar T.Tan on ARM64 iOS simulator, even though AdvSimd.Arm64 FMA is available. Previously trigTolerance was null (default ~1 ULP) when FMA was detected, causing SpanDestinationFunctions_ValueRange to fail for Tan on iossimulator-arm64. Apply a small tolerance (1e-5f for float, 1e-14 for double) for the FMA path — still much tighter than the non-FMA tolerance (1e-4f, 1e-10) but sufficient to accommodate the ARM64 vectorization divergence. Remove the [ActiveIssue] annotation that disabled the entire SpanDestinationFunctions_ValueRange test on Apple Mobile CoreCLR, since the tolerance fix addresses the root cause. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-numerics-tensors |
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
Note
This is an AI/Copilot-generated draft PR that attempts to fix the CI failure described in KBE #129045. It has NOT been build-validated (environment lacks .NET 11 SDK). Human review is needed.
Root cause
The vectorized
TensorPrimitives.Tanon ARM64 produces values that diverge by ~47 ULPs from scalarT.Tanon iossimulator-arm64 CoreCLR. The test'strigToleranceis set tonull(meaning default ~1 ULP) whenIsFmaSupportedis true (becauseAdvSimd.Arm64.IsSupportedis true on Apple Silicon). However, the vectorized trig algorithm doesn't achieve bit-for-bit matching with the scalar math library on ARM64, even though FMA hardware is available.Failing log line:
Fix
Instead of using
nulltolerance when FMA is supported, apply an explicit small tolerance:1e-5f(allows ~333 ULPs — comfortably above the observed ~47 ULP divergence)1e-14(proportionally generous for double precision)This is consistent with how
CosPialready applies1e-5ftolerance in the FMA case via its null-coalescing fallback pattern.Additionally, this removes the
[ActiveIssue("#124344")]annotation onSpanDestinationFunctions_ValueRangethat blanket-disabled the test on Apple Mobile CoreCLR, since the tolerance fix addresses the underlying precision issue rather than masking the failure.What is unverified / help needed
dotnet buildor tests.1e-14tolerance is an estimate. Needs confirmation on-device.trigTolerance. If they also diverge on ARM64, this fix covers them. If they DON'T currently diverge, this change is still safe (tolerance only relaxes the check).SpanDestinationFunctions_ValueRangeon Apple mobile unrelated to trig tolerance, removing the annotation could re-expose them.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: