-
Notifications
You must be signed in to change notification settings - Fork 335
Add some restrictions about resource usage tracking/validation #972
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
Add some restrictions about resource usage tracking/validation #972
Conversation
The revisions include: - add aspect (in addition to array layer and mip level) for subresource - add definition of atom resource, and use atom resource to replace subresource - race condition of writable storage buffer/texture in render pass is allowed - resource usages validation is done within "usage scope" - invisible usages and overwritten usages should be tracked
spec/index.bs
Outdated
of storage-buffer usages upon the same [#atom resource#] in render pass is allowed. | ||
|
||
Note that all invisible usages and overwritten usages should be counted, for example: | ||
- a resource binding attached to a shader stage with visiblity none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should talk about whether this makes any sense to allow at all, it's just a useless footgun
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. We can discuss about this if needed.
spec/index.bs
Outdated
- a resource binding attached to a shader stage with visiblity none | ||
- a resource binding attached to compute shader stage in render pass, or vice versa | ||
- a collection of bindings are set by a bind group but being overwritten within current [=usage scope=] | ||
- index or vertex buffer being overwritten within current [=usage scope=] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly here. "overwriting a vertex buffer" is confusing, since users may read this as the contents are overwritten, while you mean the bindings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
We have different opinions, but I really appreciate your review, @kvark . 👍 |
OK. To summarize the discussions above, it looks like there are 3 issues to address for resource usage tracking and validation . The latter two issues should be not that controversial though, and I'd like to propose a solution:
Alternatively, we can leave any one of these 3 issues being open before MVP/v1 and discuss them after MVP/v1 if you think it is a corner case. |
A whole render pass is a usage scope, but not a whole compute pass. In compute, just a single dispatch is a usage scope; we insert necessary synchronization between dispatches. |
IMHO yes, it adds implementation complexity to skip unused bindings, and doesn't provide value except for badly behaved applications.
Probably, even though right now WebGPU doesn't support any usecase where depth and stencil would have different usages. (read only depth or stencil has to match because of Vulkan 1.0/1.1 limitations) |
Yeah. I meant to say compute scope (per each dispatch call). |
That means a resource is used twice in the same dispatch, and that's not any worse than using the resource once in the dispatch (since it can already be written from multiple threads of the dispatch). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Richard-Yunchao sorry about the lack of clarity on what is expected here.
Would you mind removing the "atom" related naming changes from this PR, only leaving the following points in it:
- add aspect (in addition to array layer and mip level) for subresource
- race condition of writable storage buffer/texture in render pass is allowed
- invisible usages and overwritten usages should be tracked
The synchronization scopes are being clarified in #994 in the meantime. Please free to review it and/or follow-up with better description of what's going on.
430ecfb
to
62df6fe
Compare
Done, with one minor change that combine two readonly usages you added at #994 into one. Sorry for the late response, @kvark. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you!
Discussed at the 2020-08-24 meeting. |
Addressed feedback from CG meeting and spec editors' meeting on Monday. PTAL. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
The revisions include:
subresource
replace subresource
pass is allowed
Preview | Diff