Closed Bug 1634425 Opened 1 year ago Closed 11 months ago

Add API tracing capability to WebGPU

Categories

(Core :: Graphics: WebGPU, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: kvark, Assigned: kvark)

References

Details

Attachments

(1 file)

See https://github.com/gfx-rs/wgpu/issues/289 for the initial investigation.

Depends on: 1634439

This is the logic of tracing the WebGPU API calls at the level of wgpu-core,
serialized into a folder of choosing on the user drive. Traces are extremely portable,
they can be shared (on BugZilla) and then replayed on the developer machine,
which can have a different architecture from the users machine.

The standalone player is introduced in gfx/wgpu/player, similar to WebRender's Wrench.

The output dir is controlled by "dom.webgpu.traceDir" pref. No tracing happens if it's empty.

Note that this is not the only way we could approach the general idea of API tracing. It could be done at different levels:

  • at JS level, in a browser-independent way
  • somewhere in-between wgpu and JS
  • at the C FFI level, which can be browser-independent, if we choose to use wgpu in exactly the same interface as native users
  • at the native API level

Most of these have been considered. The chosen approach stands out, because it helps to investigate the issues (some of those we have today) appearing in the layer between JS and wgpu. This layer includes JS bindings, IPC communication, and conversion between DOM and wgpu ffi. If a test case is written for wgpu-rs, by compiling it to native and to WASM, and then capturing on both native and in-browser, one can diagnose issues at this level simply by comparing the traces.

The ability to investigate traces independently, using the player binary, helps to shorten the iteration cycle. Debugging with WebRender's wrench has been an important part of the graphics team workflow, and has proven to be very efficient through years of use. wgpu-player continues this tradition.

Severity: -- → S3
Pushed by dmalyshau@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f4ed4d3e0e9e
Integrate WebGPU API tracing r=jgilbert

Backed out changeset f4ed4d3e0e9e (bug 1634425) for hazard failure on WebGPUParent.cpp

Push with failure: https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedTaskRun=LVm5NEgbRImXFuvJ1WeIUQ-0&resultStatus=testfailed%2Cbusted%2Cexception%2Csuccess%2Cretry%2Crunning%2Cpending%2Crunnable&fromchange=f4ed4d3e0e9ef8b9e53ee0f1f2ebc523bcbe44ef&searchStr=linux%2Cx64%2Cdebug%2Chazard&tochange=812652898853af5554c005b43b2bd58720476516

Backout link: https://hg.mozilla.org/integration/autoland/rev/812652898853af5554c005b43b2bd58720476516

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=303840147&repo=autoland&lineNumber=34648

[task 2020-05-26T22:00:21.844Z] 26:48.68 make[4]: Entering directory '/builds/worker/checkouts/gecko/obj-analyzed/dom/webgpu'
[task 2020-05-26T22:00:21.844Z] 26:48.68 /builds/worker/fetches/sixgill/usr/libexec/sixgill/scripts/wrap_gcc/basecc /builds/worker/fetches/sixgill/usr/libexec/sixgill/scripts/wrap_gcc/g++ -std=gnu++17 -o Unified_cpp_dom_webgpu1.o -c  -I/builds/worker/checkouts/gecko/obj-analyzed/dist/stl_wrappers -I/builds/worker/checkouts/gecko/obj-analyzed/dist/system_wrappers -include /builds/worker/checkouts/gecko/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DDEBUG=1 -DOS_POSIX=1 -DOS_LINUX=1 -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -I/builds/worker/checkouts/gecko/dom/webgpu -I/builds/worker/checkouts/gecko/obj-analyzed/dom/webgpu -I/builds/worker/checkouts/gecko/obj-analyzed/ipc/ipdl/_ipdlheaders -I/builds/worker/checkouts/gecko/ipc/chromium/src -I/builds/worker/checkouts/gecko/ipc/glue -I/builds/worker/checkouts/gecko/obj-analyzed/dist/include -I/builds/worker/checkouts/gecko/obj-analyzed/dist/include/nspr -I/builds/worker/checkouts/gecko/obj-analyzed/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /builds/worker/checkouts/gecko/obj-analyzed/mozilla-config.h -Wno-attributes -Wno-ignored-attributes -Wno-attributes -Wno-ignored-attributes -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wduplicated-cond -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wno-multistatement-macros -Wno-error=class-memaccess -Wno-error=deprecated-copy -Wformat -Wformat-overflow=2 -fno-sized-deallocation -fno-aligned-new -Wno-attributes -Wno-ignored-attributes -Wno-attributes -Wno-ignored-attributes -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -freorder-blocks -Os -fno-omit-frame-pointer -funwind-tables -Werror  -MD -MP -MF .deps/Unified_cpp_dom_webgpu1.o.pp   Unified_cpp_dom_webgpu1.cpp
[task 2020-05-26T22:00:21.844Z] 26:48.68 In file included from Unified_cpp_dom_webgpu1.cpp:110:
[task 2020-05-26T22:00:21.844Z] 26:48.68 /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp: In member function 'mozilla::ipc::IPCResult mozilla::webgpu::WebGPUParent::RecvTextureCreateView(mozilla::webgpu::RawId, const mozilla::webgpu::ffi::WGPUTextureViewDescriptor&, const nsCString&, mozilla::webgpu::RawId)':
[task 2020-05-26T22:00:21.844Z] 26:48.68 /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp:269:34: error: variable 'desc' set but not used [-Werror=unused-but-set-variable]
[task 2020-05-26T22:00:21.844Z] 26:48.68   269 |   ffi::WGPUTextureViewDescriptor desc = aDesc;
[task 2020-05-26T22:00:21.844Z] 26:48.69       |                                  ^~~~
[task 2020-05-26T22:00:21.844Z] 26:48.69 /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp: In member function 'mozilla::ipc::IPCResult mozilla::webgpu::WebGPUParent::RecvDeviceCreateSampler(mozilla::webgpu::RawId, const mozilla::webgpu::ffi::WGPUSamplerDescriptor&, const nsCString&, mozilla::webgpu::RawId)':
[task 2020-05-26T22:00:21.844Z] 26:48.69 /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp:290:30: error: variable 'desc' set but not used [-Werror=unused-but-set-variable]
[task 2020-05-26T22:00:21.844Z] 26:48.69   290 |   ffi::WGPUSamplerDescriptor desc = aDesc;
[task 2020-05-26T22:00:21.845Z] 26:48.69       |                              ^~~~
[task 2020-05-26T22:00:21.845Z] 26:48.69 cc1plus: all warnings being treated as errors
[task 2020-05-26T22:00:21.845Z] 26:48.69 In file included from Unified_cpp_dom_webgpu1.cpp:110:
[task 2020-05-26T22:00:21.845Z] 26:48.69 /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp: In member function 'mozilla::ipc::IPCResult mozilla::webgpu::WebGPUParent::RecvTextureCreateView(mozilla::webgpu::RawId, const mozilla::webgpu::ffi::WGPUTextureViewDescriptor&, const nsCString&, mozilla::webgpu::RawId)':
[task 2020-05-26T22:00:21.845Z] 26:48.69 /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp:269:34: error: variable 'desc' set but not used [-Werror=unused-but-set-variable]
[task 2020-05-26T22:00:21.845Z] 26:48.69   269 |   ffi::WGPUTextureViewDescriptor desc = aDesc;
[task 2020-05-26T22:00:21.845Z] 26:48.69       |                                  ^~~~
[task 2020-05-26T22:00:21.845Z] 26:48.69 /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp: In member function 'mozilla::ipc::IPCResult mozilla::webgpu::WebGPUParent::RecvDeviceCreateSampler(mozilla::webgpu::RawId, const mozilla::webgpu::ffi::WGPUSamplerDescriptor&, const nsCString&, mozilla::webgpu::RawId)':
[task 2020-05-26T22:00:21.845Z] 26:48.69 /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp:290:30: error: variable 'desc' set but not used [-Werror=unused-but-set-variable]
[task 2020-05-26T22:00:21.845Z] 26:48.69   290 |   ffi::WGPUSamplerDescriptor desc = aDesc;
[task 2020-05-26T22:00:21.845Z] 26:48.69       |                              ^~~~
[task 2020-05-26T22:00:21.845Z] 26:48.69 cc1plus: all warnings being treated as errors
[task 2020-05-26T22:00:21.845Z] 26:48.69 /builds/worker/checkouts/gecko/config/rules.mk:746: recipe for target 'Unified_cpp_dom_webgpu1.o' failed
[task 2020-05-26T22:00:21.845Z] 26:48.69 make[4]: *** [Unified_cpp_dom_webgpu1.o] Error 1
[task 2020-05-26T22:00:21.846Z] 26:48.69 make[4]: Leaving directory '/builds/worker/checkouts/gecko/obj-analyzed/dom/webgpu'
[task 2020-05-26T22:00:21.846Z] 26:48.69 /builds/worker/checkouts/gecko/config/recurse.mk:74: recipe for target 'dom/webgpu/target-objects' failed
[task 2020-05-26T22:00:21.846Z] 26:48.69 make[3]: *** [dom/webgpu/target-objects] Error 2
[task 2020-05-26T22:00:21.846Z] 26:48.69 make[3]: *** Waiting for unfinished jobs....
Flags: needinfo?(dmalyshau)
Pushed by dmalyshau@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/85b948d27472
Integrate WebGPU API tracing r=jgilbert

Good test to fail! Although, that was harmless, and we could just follow up instead of relanding.

Flags: needinfo?(dmalyshau)
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.