-
Notifications
You must be signed in to change notification settings - Fork 345
Description
When we tried to measure the time spent on CreateShaderModule() and Create*Pipeline() on Chromium, we found these APIs were returned immediately without doing validations and calling native APIs to create pipelines on the GPU process, and we found the shader and pipeline creations would always be delayed until we met some points that may trigger Chromium to handle all of the current callback tasks, for example when MapAsync() is called. This behavior makes it hard for us to investigate the performance issues brought by shader compilations and pipeline creations, which always cost quite a lot of time when dozens of compute pipelines need to be created in the first inference with a typical machine learning model. In addition, it may also bring some misunderstandings that when we measure the time cost with performance.now() from JS side, it shows it is MapAsync() that spends quite a lot of time instead of shader and pipeline creation.
Based on the above investigation, we think it helpful for the SPEC to do below clarifications:
-
Point out that the return of CreateShaderModule() and Create*Pipeline() doesn't mean the completion of the creation of the related GPU resources.
-
Provide an API to query the shader compilation and pipeline creation time in developer mode, which will be very useful for the developers to do automated testing.
-
Point out that in both CreatePipeline() and CreatePipelineAsync(), the shader compilation and pipeline creation may all be executed asynchronously in parallel for performance optimizations.
A related discussion in chromium can be found here.