Wgpu: CPU profiling infrastructure

Created on 10 Feb 2020  路  15Comments  路  Source: gfx-rs/wgpu

Candidates:

Some obvious things we'd like to track down:

  • time to acquire a new swapchain image (including the fence block time)
  • time to submit
  • time to record a pass
  • time to create resources
infrastructure performance enhancement

Most helpful comment

I think this is pretty solved by our tracing integration.

All 15 comments

I have been thinking about building rust bindings to tracy, maybe that could be an option: https://bitbucket.org/wolfpld/tracy/src/master/

That does look pretty fancy and functional! My personal preference though would be to have something Rusty :) The chrome-tracing thing, in particular, appears to be battle-tested.

Interesting windows-only solution - https://github.com/embarkStudios/superluminal-perf-rs

I have been thinking about building rust bindings to tracy, maybe that could be an option: https://bitbucket.org/wolfpld/tracy/src/master/

FWIW, I built an early pass as rust bindings for tracy - https://github.com/gw3583/tracy-rs - it only exposes a basic set of CPU profiling APIs for now. It's published on crates.io.

How about the tracing crate? It seems to be a pretty mature pure Rust solution.

This is a very interesting one, which somehow I didn't see before. I'd be open to trying it out in wgpu! The only unclear thing to me is how we are going to analyze its output.

I think tracing leaves the output part as "any way you want" - I think tracing is more of an abstraction layer you put in between the capturing and the analysis. So, for example, you could instrument your code with tracing spans, and then have a subscriber that takes those and uses tracy-rs to convert them into output that can be analyzed.

@mstange yes, I understand that abstract nature of it. I'm more asking about the practical side: what do people use with it (i.e. which subscribers)?

From what I can tell, they already have support for some subscribers. For example, they can export data in the OpenTelemetry format, and it seems to be supported by jaeger (which is open source).

I'd say we could implement this feature using tracing, and then create exporters for anything else we need.

To add even more options to the fire: https://github.com/hrydgard/minitrace is out there. Doesn't fit the rusty component, but it exists. It also outputs to chrome traces.

chrome-tracing imo looks really simple, is pure rust, and will probably get done exactly what we need to. The only possible missing feature would be events, but that's probably not a show stopper and could likely be added in if needed.

chrome-tracing gives me an uneasy feeling because of its name :)
Let's start with tracing as the Rust idiomatic solution, and consider others if we hit any blockers (i.e. dependency tree is too large, doesn't support our use case, or something else).

I've been looking through the code, wgpu-core already has a trace feature, and it seems to be used for tracing some events to a trace.ron file. How is that affected by this issue?

@GabrielMajeri That's for api tracing, which serializes all calls to wgpu into RON files so the player can replay them later.

I think this is pretty solved by our tracing integration.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulkernfeld picture paulkernfeld  路  3Comments

kvark picture kvark  路  3Comments

kvark picture kvark  路  3Comments

rukai picture rukai  路  3Comments

stephanemagnenat picture stephanemagnenat  路  5Comments