Repository navigation
[HLSL] Allow rounding error in LinAlg float multiply tests - #9096
Draft
Jack Elliott (JoeCitizen) wants to merge 1 commit into
Draft
Jack Elliott (JoeCitizen) wants to merge 1 commit into
Jack Elliott (JoeCitizen) wants to merge 1 commit into
Conversation
The LinAlg float matrix multiply and MatVec tests compared results exactly. Proposal 0035 does not require correctly rounded results or a particular accumulation order, and some hardware returns results a few units off even when the exact result is representable (for example -2.9999993 for -3.0 in an F32 accumulator). The larger shapes added in microsoft#8939 exposed this. The spec owner has confirmed that correctly rounded results are not required. - Add a bounded comparison mode to the matrix oracle. Each element is checked against a reference computed in double, within (K + 2) * u * (sum |a*b| + |acc|) plus the smallest normal, where u is the result type's unit roundoff. - Use it for F16 and F32 multiply results at Wave and ThreadGroup scope, and for F16/F32 MatVec and MatVecMulAdd results, including FP8 inputs. - Use sparse -1/0/1 patterns for F16-accumulator multiplies so the bound stays below 1 up to K = 256 and a single wrong term still fails. - Integer multiplies, element-wise accumulate, outer product, transfers and conversions stay exact. - Add a host-side self-test for the bound and every pattern the device tests use. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f05f926c-8544-4ea3-87aa-307088e1622a
This branch has not been deployed
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.
The LinAlg float matrix multiply and MatVec tests compared results exactly. Proposal 0035 doesn't require correctly rounded results or a particular accumulation order, and some hardware returns results a few units off even when the exact result is representable (for example −2.9999993 for −3.0 in an F32 accumulator). This was exposed by the larger shapes added in #8939. The spec owner has confirmed that correctly rounded results are not required.
Tested on WARP: no outcome changes. Dropping one term from the reference makes every bounded test fail.