Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wgsl: Convert all AbstractFloat tests with non-simple errors to using f32 intervals #3493

Merged
merged 8 commits into from
Mar 14, 2024

Conversation

zoddicus
Copy link
Contributor

@zoddicus zoddicus commented Mar 13, 2024

A number of existing tests for AF expressions were incorrectly implemented via performing the accuracy calculations as f64. These need to be converted to using the f32 interval calculations, because absolute, ULP, and inherited AF errors should be as accurate as f32.

This changes additition, cross, determinant, degrees, division, dot, fma, mix, radians, remainder, and various forms of matrix multiplication.

See https://www.w3.org/TR/WGSL/#abstract-float-accuracy for details on why this change is needed.


Requirements for PR author:

  • All missing test coverage is tracked with "TODO" or .unimplemented().
  • New helpers are /** documented */ and new helper files are found in helper_index.txt.
  • Test behaves as expected in a WebGPU implementation. (If not passing, explain above.)
  • Test have be tested with compatibility mode validation enabled and behave as expected. (If not passing, explain above.)

Requirements for reviewer sign-off:

  • Tests are properly located in the test tree.
  • Test descriptions allow a reader to "read only the test plans and evaluate coverage completeness", and accurately reflect the test code.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Helpers and types promote readability and maintainability.

When landing this PR, be sure to make any necessary issue status updates.

@zoddicus zoddicus added enhancement New feature or request wgsl labels Mar 13, 2024
@zoddicus zoddicus requested review from ben-clayton and dneto0 March 13, 2024 20:17
@zoddicus zoddicus self-assigned this Mar 13, 2024
@zoddicus
Copy link
Contributor Author

PTAL, I have broken this up into a series of different commits on the PR for easier review, but will be squash them on commit.

Copy link
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -15,7 +15,8 @@ const mat_vec_cases = ([2, 3, 4] as const)
sparseMatrixF64Range(cols, rows),
sparseVectorF64Range(cols),
'finite',
FP.abstract.multiplicationMatrixVectorInterval
// Matrix-vector multiplication has an inherited accuracy, so abstract is only expected to be as accurate as f32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for these comments. They very much clarify the issue for a future reader.

@zoddicus zoddicus merged commit 3a56acd into gpuweb:main Mar 14, 2024
1 check passed
@zoddicus zoddicus deleted the fixAFInherited branch March 14, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wgsl
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants