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

bytesPerBlock refactors; generalize validation,image_copy,buffer_related over aspects #3490

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kainino0x
Copy link
Collaborator

@kainino0x kainino0x commented Mar 13, 2024

Removes two uses of the deprecated .bytesPerBlock.

  • Test a few depth/stencil formats that weren't in kSizedTextureFormats
    (depth24plus-stencil8 stencil, depth32float-stencil8 depth+stencil)
  • Parameterize over aspect (depth-only/stencil-only/all)
  • Reduce some overparameterization to make up for it (net ~3x faster)

Issue: Part 7 of #2495


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.

- Test a few depth/stencil formats that weren't in kSizedTextureFormats
  (depth24plus-stencil8 stencil, depth32float-stencil8 depth+stencil)
- Parameterize over aspect (depth-only/stencil-only/all)
- Reduce some overparameterization to make up for it (net ~3x faster)

Removes a use of the deprecated .bytesPerBlock.
@kainino0x
Copy link
Collaborator Author

I've been sending all these reviews to @lokokung, but at this point I can rebalance them. @shrekshao could you PTAL?

Copy link
Contributor

@shrekshao shrekshao left a comment

Choose a reason for hiding this comment

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

LGTM with comments
For RROR: Tests missing from listing_meta.json. Please add the new tests (See docs/adding_timing_metadata.md):, you may add it manually, or run cts with dawn-node which will automatically generate for you (Ben's slides can be found at https://sites.google.com/corp/google.com/webgpu/projects/cts?authuser=0)

(!!info.depth || !!info.stencil) && p.copyHeightInBlocks !== p._textureHeightInBlocks
);
})
.unless(p => p._aspectKey !== 'color' && p.copyHeightInBlocks !== p._textureHeightInBlocks)
Copy link
Contributor

Choose a reason for hiding this comment

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

The only p.copyHeightInBlocks !== p._textureHeightInBlocks case is p.copyHeightInBlocks = 0, p._textureHeightInBlocks = 1 which can be a no-op. I think it's better expand _textureHeightInBlocks with [p.copyHeightInBlocks, pp.copyHeightInBlocks + 1] for > 0 cases?

_aspectKey: 'color' | 'depth' | 'stencil';
}> {
const info = kTextureFormatInfo[format];
if (info.color?.bytes) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: why is here info.color?.bytes instead of info.color

} from '../../../format_info.js';
import { align } from '../../../util/math.js';
import { ImageCopyType } from '../../../util/texture/layout.js';
import { ValidationTest } from '../validation_test.js';

export const kReducedFormatsList = [
'r8unorm',
Copy link
Contributor

Choose a reason for hiding this comment

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

For testing compat copyT2B workaround impl purporse I'd like to also include ['r8snorm', 'rg8snorm', 'bgra8unorm']

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