2022-05-18 18:08:22 +08:00
|
|
|
u_trace GPU Performance Tracing
|
|
|
|
===============================
|
|
|
|
|
|
|
|
Mesa has its own GPU performance tracing framework which drivers may
|
|
|
|
choose to implement. ``gpu.renderstages.*`` producer for
|
|
|
|
:doc:`Perfetto Tracing <perfetto>` is based on u_trace.
|
|
|
|
|
|
|
|
It doesn't require external dependencies and much simpler to use. Though
|
|
|
|
it provides information only about GPU timings and is harder to analyze
|
|
|
|
for complex rendering.
|
|
|
|
|
|
|
|
u_trace is useful when one needs to quickly identify performance bottleneck,
|
|
|
|
or to build a tool to analyze the raw performance data.
|
|
|
|
|
|
|
|
Drivers which support u_trace:
|
2022-10-18 21:49:44 +08:00
|
|
|
- Intel drivers: ANV, Iris
|
2022-05-18 18:08:22 +08:00
|
|
|
- Adreno drivers: Freedreno, Turnip
|
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
|
|
|
u_trace is controlled by environment variables:
|
|
|
|
|
2022-11-08 15:50:34 +08:00
|
|
|
.. envvar:: MESA_GPU_TRACES
|
|
|
|
|
2022-10-19 19:29:36 +08:00
|
|
|
controls whether u_trace is enabled and trace output
|
|
|
|
|
|
|
|
``print``
|
|
|
|
prints in a human readable text format. It should be noted that this
|
|
|
|
is mutually exclusive with ``print_json`` and both cannot be enabled
|
|
|
|
at the same time.
|
|
|
|
``print_json``
|
|
|
|
prints in JSON format, suitable for parsing. Application should
|
|
|
|
appropriately finish its rendering in order for trace's json to be
|
|
|
|
valid. For the Vulkan API, it is expected to destroy the device,
|
|
|
|
for GL it's expected to destroy the context.
|
|
|
|
``perfetto``
|
2023-01-09 16:31:01 +08:00
|
|
|
enables Perfetto instrumentation prior to connecting, Perfetto
|
2022-10-19 19:29:36 +08:00
|
|
|
traces can be collected without setting this but it may miss some
|
|
|
|
events prior to the tracing session being started.
|
2022-10-21 02:26:47 +08:00
|
|
|
``markers``
|
2023-04-26 20:20:39 +08:00
|
|
|
enables marker instrumentation, will print trace markers into
|
2022-10-21 02:26:47 +08:00
|
|
|
the CS which can then be viewed by dumping the CS from the driver.
|
2022-05-18 18:08:22 +08:00
|
|
|
|
2022-10-21 02:35:57 +08:00
|
|
|
- For Turnip, ``cffdump`` can be used to view the markers in
|
|
|
|
the trace.
|
2024-06-27 01:37:28 +08:00
|
|
|
``indirects``
|
|
|
|
enables indirect data capture for some of the tracepoints (like
|
|
|
|
indirect draw count or indirect dispatch size)
|
2022-10-21 02:35:57 +08:00
|
|
|
|
2022-11-08 15:50:34 +08:00
|
|
|
.. envvar:: MESA_GPU_TRACEFILE
|
|
|
|
|
2022-05-18 18:08:22 +08:00
|
|
|
specifies a file where to write the output instead of ``stdout``
|
|
|
|
|
2022-11-08 15:50:34 +08:00
|
|
|
.. envvar:: *_GPU_TRACEPOINT
|
|
|
|
|
2022-05-31 19:04:27 +08:00
|
|
|
tracepoints can be enabled or disabled using driver specific environment
|
|
|
|
variable. Most tracepoints are enabled by default. For instance
|
|
|
|
``TU_GPU_TRACEPOINT=-blit,+render_pass`` will disable the
|
|
|
|
``blit`` tracepoints and enable the ``render_pass`` tracepoints.
|
|
|
|
|
2022-11-08 17:18:02 +08:00
|
|
|
.. list-table::
|
|
|
|
:header-rows: 1
|
2022-05-31 19:04:27 +08:00
|
|
|
|
2022-11-08 17:18:02 +08:00
|
|
|
* - Driver
|
|
|
|
- Environment Variable
|
|
|
|
- Tracepoint Definitions
|
|
|
|
* - Freedreno
|
2022-11-08 15:50:34 +08:00
|
|
|
- .. envvar:: FD_GPU_TRACEPOINT
|
2022-11-08 17:18:02 +08:00
|
|
|
- ``src/gallium/drivers/freedreno/freedreno_tracepoints.py``
|
|
|
|
* - Turnip
|
2022-11-08 15:50:34 +08:00
|
|
|
- .. envvar:: TU_GPU_TRACEPOINT
|
2022-11-08 17:18:02 +08:00
|
|
|
- ``src/freedreno/vulkan/tu_tracepoints.py``
|
2023-04-26 16:40:56 +08:00
|
|
|
* - ANV
|
2022-05-22 21:00:40 +08:00
|
|
|
- .. envvar:: INTEL_GPU_TRACEPOINT
|
2023-03-02 17:20:44 +08:00
|
|
|
- ``src/intel/vulkan/intel_tracepoints.py``
|