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 AbstractFloat mix execution tests #3087

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

zoddicus
Copy link
Contributor

Fixes #2566


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.)

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 the wgsl label Oct 24, 2023
@zoddicus zoddicus self-assigned this Oct 24, 2023
@github-actions
Copy link

Previews, as seen when this build job started (de68a79):
Run tests | View tsdoc

Copy link
Contributor

@jiangzhaoming jiangzhaoming left a comment

Choose a reason for hiding this comment

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

Generally looks good to me, with some typo

{ input: [-1.0, 1.0, 0.9], expected: 0.8 },

// Showing how precise and imprecise versions diff
// Note that this expectation is 0 in f64 as 10.0 is much smaller that f63.negative.min,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Note that this expectation is 0 in f64 as 10.0 is much smaller that f63.negative.min,
// Note that this expectation is 0 in f64 as 10.0 is much smaller that f64.negative.min,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

t.params,
cases
);
});
g.test('abstract_float_nonmatching_vec2')
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Add an empty line here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

.unimplemented();
.params(u => u.combine('inputSource', onlyConstInputSource))
.fn(async t => {
const cases = await d.get('abstract_vec3_scalar');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const cases = await d.get('abstract_vec3_scalar');
const cases = await d.get('abstract_vec4_scalar');

And also the types below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@zoddicus
Copy link
Contributor Author

FYI, I am going to delay landing this for a while, since Dawn is currently working on some CTS running issues, and I think this would just be more fuel on that fire.

@@ -5342,10 +5342,9 @@ const kMixImpreciseIntervalCases = {
{ input: [-1.0, 1.0, 0.9], expected: [reinterpretU64AsF64(0x3fe9_9999_8000_0000n), reinterpretU64AsF64(0x3fe9_9999_c000_0000n)] }, // ~0.8

// Showing how precise and imprecise versions diff
// Note that this expectation is 0 only in f32 as 10.0 is much smaller that f32.negative.min,
// Note that this expectation is 0 in f32 as 10.0 is much smaller that f32.negative.min,
// So that 10 - f32.negative.min == f32.negative.min even in f64. But for f16, there is not
Copy link
Contributor

Choose a reason for hiding this comment

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

10 - f32.negative.min is -f32.negative.min, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// So that 10 - f32.negative.min == f32.negative.min even in f64. But for f16, there is not
// a exactly-represenatble f16 value v that make v - f16.negative.min == f16.negative.min
// in f64, in fact that require v being smaller than 2**-37.
// an exactly-represenatble f16 value v that make v - f16.negative.min == f16.negative.min
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// So that 10 - f32.negative.min == f32.negative.min even in f64. But for f16, there is not
// a exactly-represenatble f16 value v that make v - f16.negative.min == f16.negative.min
// in f64, in fact that require v being smaller than 2**-37.
// an exactly-represenatble f16 value v that make v - f16.negative.min == f16.negative.min
{ input: [kValue.f32.negative.min, 10.0, 1.0], expected: 0.0 },
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to see some cases with 1.0 changed to something more than and less than 1.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@zoddicus zoddicus force-pushed the addAFMixTests branch 3 times, most recently from 5249a6d to 7fa5be9 Compare December 7, 2023 17:27
@zoddicus zoddicus merged commit 36ad3ef into gpuweb:main Dec 7, 2023
1 check passed
@zoddicus zoddicus deleted the addAFMixTests branch December 7, 2023 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wgsl: AbstractFloat execution tests for mix builtin
3 participants