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

Optimize some checkElements* implementations #3123

Merged
merged 5 commits into from
Nov 2, 2023

Conversation

kainino0x
Copy link
Collaborator

webgpu:api,operation,command_buffer,copyTextureToTexture:* accounts for a huge chunk of the api,operation test time (maybe 25%). This makes it almost 40% faster on my machine (13.5s -> 8.5s).

Most of the speedup is just from splitting the failure case code out into a different function. This must impact inlining or something in V8; unfortunately I suspect the improvement wouldn't translate directly to other JS engines.

Those tests could probably also use some parameterization reduction, but I'll do that separately.

Issue: None


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.

@kainino0x kainino0x requested a review from lokokung November 1, 2023 00:00
@@ -44,7 +44,28 @@ export function checkElementsEqual(
): ErrorWithExtra | undefined {
assert(actual.constructor === expected.constructor, 'TypedArray type mismatch');
assert(actual.length === expected.length, 'size mismatch');
return checkElementsEqualGenerated(actual, i => expected[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm... I would be interested to see if the change here where instead of creating an additional generator, we are now just comparing the arrays is the real culprit of the speed up? (Sort of the only thing that seems to really have changed functionally?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I measured these changes separately - see the commit messages. The largest speedup was from just splitting the check function in half.

@kainino0x kainino0x enabled auto-merge (squash) November 2, 2023 00:51
@kainino0x kainino0x merged commit eb70aaf into gpuweb:main Nov 2, 2023
2 checks passed
@kainino0x kainino0x deleted the checkElements-optimizations branch November 2, 2023 03:09
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