-
Notifications
You must be signed in to change notification settings - Fork 335
Query API: Pipeline Statistics Query #691
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
Conversation
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.
LGTM although we should have a plan for what form the pipeline statistics are returned as, and a plan for extensibility of the pipeline statistics (what if we add tessellation and want to return the number of patches processed?)
Also I'm not 100% sure how used this feature is in practice. We can have it for now and figure out later down the line if it is useful in WebGPU's MVP or not.
The results returned by pipeline statistics query will be the number of vertex shader invocations, the number of primitives sent to the clip stage, the number of primitives out by the clip stage, the number of fragment shader invocations, the number of compute shader invocations in order. Because all query data stored in the QuerySet will be resolved into a buffer, we just copy the common parts supported by all backends to the destination buffer, so if we want to expand the results, just add the corresponding copy items. For usage scenarios, we can use these pipeline statistics results to measure the relative complexity of different parts of applications, which can help to find bottlenecks while performance tuning. |
Yes, the question to know in which order they are written in the buffer when you resolve the query, and with what format (u64, u32). The other question is that right now only a few, say 4, of the pipeline statistics can be non-zero. But tomorrow, for example when WebGPU gain tessellation shaders, where are we going to write the additional data? It will be weird to users if without doing anything the amount of data written increases. |
On Vulkan, it allows users to decide which data of pipeline statistics to query by setting VkQueryPoolCreateInfo::pipelineStatistics when creating query sets (always querying all pipeline statistics data on D3D12 and Metal), maybe we can add a GPUPipelineStatisticFlags in GPUQuerySetDescriptor such as:
|
That addresses part of the question, which is how we could deal with extensibility. But the other part is, can you describe what format and in which order will the different statistics be returned depending on that flag? For example if I ask a pipeline statistic query with
|
The results in the resolve buffer will be stpred in the first format:
Only the pipeline statistics of the specified flags will be wrote to resolve buffer, and the order of results is not affected by the order of flags, it will always write in this order:
which does the same with Vulkan. Do I need to add these notes to the PR now? |
Thanks, we need to have at least the IDL for |
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.
LGTM
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.
LGTM with nits
@kainino0x @kvark @JusSn, @haoxli addressed all comments, can this be merged? |
Would be nice to get a thumbs up from Apple or Microsoft. |
@litherum, @RafaelCintron Do you have any comments about pipeline statistics queries? |
* Query API: Pipeline Statistics Query * Add GPUPipelineStatisticBit and more instructions * Use array of enum insead of bitfield in pipeline statistics * Fix nits
* Query API: Pipeline Statistics Query * Add GPUPipelineStatisticBit and more instructions * Use array of enum insead of bitfield in pipeline statistics * Fix nits
If the texture format is depth/stencil format, it must be a full copy for copies resource(s).
Add extension and entrypoints for pipeline statistics query according to #614.
Preview | Diff