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: Add binary + / - / * validation tests but for matrices #3481

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

Kangz
Copy link
Collaborator

@Kangz Kangz commented Mar 12, 2024

Issue: #


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.

@Kangz Kangz requested a review from jrprice March 12, 2024 16:23
Copy link
Contributor

@jrprice jrprice left a comment

Choose a reason for hiding this comment

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

We should also add some coverage for f32/f16 expressions whose results go out of range of the type.

Doesn't have to be in this CL, but just want to make sure we don't forget (e.g. add an .unimplemented() if you're not planning on doing it soon, or leave a comment on the spreadsheet about the remaining work).

@Kangz
Copy link
Collaborator Author

Kangz commented Mar 12, 2024

We should also add some coverage for f32/f16 expressions whose results go out of range of the type.

I'm slightly surprised that out-of-range concrete type expressions would be an error ... ah ok it's because WGSL has builtin consteval of everything? How do we want to test this though? It feels like it would require a lot of range-interval computations, more akin to what we do in execution tests.

@jrprice
Copy link
Contributor

jrprice commented Mar 12, 2024

How do we want to test this though? It feels like it would require a lot of range-interval computations, more akin to what we do in execution tests.

Yes, we have helpers we can reuse (e.g. isRepresentable()). I'd take a look at the kind of thing we've done for some of the builtin validation tests, e.g. atan2. The values test generates ranges of values using helpers and then uses isRepresentable() to determine whether the result should be accepted or not.

We can't quite reuse validateConstOrOverrideBuiltinEval() for this, but we could make a similar helper for binary expressions.

As I say, don't have to do this in this PR if it turns into a bunch of extra work.

@Kangz
Copy link
Collaborator Author

Kangz commented Mar 15, 2024

Thanks for the explanation. I added an unimplemented but will relinquish further tasks as I'll be OOO for a bit.

@Kangz Kangz merged commit 271e406 into gpuweb:main Mar 15, 2024
1 check passed
@Kangz Kangz deleted the add_sub_mul1 branch March 15, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants