[Mesa-dev] [PATCH 00/22] RFC: Batchbuffer Logger for Intel GPU

Rogovin, Kevin kevin.rogovin at intel.com
Tue Sep 26 09:35:44 UTC 2017


Hi,

  Attached to this message are the following:
     1. a file giving example usage of the tool with a modified apitrace to produce json output

     2. the patches to apitrace to make it BatchbufferLogger aware

     3. the JSON files (gzipped) made from the example.


I encourage (and hope) people will take a look at the JSON to see the potential of the tool.

-Kevin
________________________________________
From: Rogovin, Kevin
Sent: Monday, September 25, 2017 1:34 PM
To: mesa-dev at lists.freedesktop.org
Cc: Rogovin, Kevin
Subject: [PATCH 00/22] RFC: Batchbuffer Logger for Intel GPU

From: Kevin Rogovin <kevin.rogovin at intel.com>

This patch series defines and implements a BatchbufferLogger
for Intel GEN. The main purpose of the BatchbufferLogger is
to strongly correlate API calls to data added to a batchbuffer.
In addition to this function, the BatchbufferLogger also tracks
GPU state (respecting HW context as well). The logger intercepts
drmIoctl recording the information needed to decode a bachbuffer
(such as GEM BO creation/deletion, HW context create/delete,
and most importantly execbuffer2). When the execbuffer2 returns
from the kernel, the BatchbufferLogger will log information
in its log of what was added when and in addition log the
GPU state (at the point in the batchbuffer) of 3DPRIMITIVE and
GPGPU_WALKER commands.

It is an application's requirment to tell the BatchbufferLogger
just before and just after an API call. Because of the need
to intercept drmIoctl, having an application link against
BatchbufferLogger is not robust. Instead, an application is
to use dlsym to fetch the correction a function pointer that
returns the BatchbufferLogger's application interface. The
interface of the BatchbufferLogger is defined in patch 0002.
A script is also provided to use the BatchbufferLogger in
an easier way than needing to set environmental variables.

On the subject of application integration, I have a -very-
small patch series that enabled BatchbufferLogger for
apitrace. I can share these patches if anyone asks, but I
cannot submit them to apitrace until atleast the BatchbufferLogger
is in Mesa with a stable application interface.

The log emitted by the BatchbufferLogger is a sequence of blocks
with possibility of blocks being elements of blocks. The top level
blocks are the API call markers created from the calls into the
BatchbufferLogger from the application. The format of the log
is defined in a dedicated header (from patch 0003). Tools are
included to convert the log to JSON, XML and text. The simple
file format should allow others to be able to take the data and
use it however they see fit. The JSON output alone can be quite
illuminating to use when debugging/enhancing the i965 driver
for a single frame of a troublesome application.

The patch series is organized into the following blocks:

0001-0003: Define the BatchbufferLogger interfaces
0004-0005: Minor fixes to i965 driver
0006-0006: Hooking of BatchbufferLogger into i965
0007-0015: Fixes and enhancements to intel/compiler,
           intel/tools and intel/common.
0016-0018: Implementation of BatchBufferLogger
0019-0021: Tools to decode log to JSON, XML and text
0022-0022: Command line tool for disassembling shader
           binaries.

Kevin Rogovin (22):
  intel/tools: define BatchBufferLogger driver interface
  intel/tools: define BatchbufferLogger application interface
  intel/tools: BatchBufferLogger define output file format of tool
  i965: assign BindingTableEntryCount of INTERFACE_DESCRIPTOR_DATA
  i965: correctly assign SamplerCount of INTERFACE_DESCRIPTOR_DATA
  i965: Enable BatchbufferLogger in i965 driver
  intel/common/gen_decoder: make useable from C++ source
  intel/compiler: brw_validate_instructions to take const void* instead
    of void*
  intel/compiler: fix for memmove argument on annotating error
  intel/compiler:add function to give option to print offsets into
    assembly
  intel/tools/disasm: correctly observe FILE *out parameter
  intel/tools/disasm: make useable from C++ sources
  intel/tools/disasm: gen_disasm_disassemble to take const void* instead
    of void*
  intel/tools/disasm: add gen_disasm_assembly_length function
  intel/tools/disasm: make sure that entire range is disassembled
  intel/tools/BatchbufferLogger: first implementation
  intel/tools/BatchbufferLogger: install i965_batchbuffer non-driver
    interface headers
  inte/tools/BatchbufferLogger : add shell script for batchbuffer logger
  intel/tools/BatchbufferLogger (txt-output): example txt dumper
  intel/tools/BatchbufferLogger (output-xml): add outputter to XML
  intel/tools/BatchbufferLogger (output-json): add json outputter
  intel/tools: add command line GEN shader disassembler tool

 src/intel/Makefile.tools.am                        |   71 +
 src/intel/common/gen_decoder.h                     |    7 +
 src/intel/common/gen_device_info.h                 |    8 +
 src/intel/compiler/brw_eu.c                        |   11 +-
 src/intel/compiler/brw_eu.h                        |    5 +-
 src/intel/compiler/brw_eu_validate.c               |    2 +-
 src/intel/compiler/intel_asm_annotation.c          |    5 +-
 src/intel/tools/.gitignore                         |    5 +
 src/intel/tools/disasm.c                           |   28 +-
 src/intel/tools/gen_disasm.h                       |   12 +-
 src/intel/tools/gen_shader_disassembler.c          |  218 +
 src/intel/tools/i965_batchbuffer_dump_show.c       |  129 +
 .../tools/i965_batchbuffer_dump_show_json.cpp      |  251 ++
 src/intel/tools/i965_batchbuffer_dump_show_xml.cpp |  215 +
 src/intel/tools/i965_batchbuffer_logger.cpp        | 4221 ++++++++++++++++++++
 src/intel/tools/i965_batchbuffer_logger.h          |  117 +
 src/intel/tools/i965_batchbuffer_logger_app.h      |   84 +
 .../tools/i965_batchbuffer_logger_instructions.h   |  131 +
 src/intel/tools/i965_batchbuffer_logger_output.h   |   74 +
 src/intel/tools/i965_batchbuffer_logger_sh.in      |  107 +
 src/mesa/drivers/dri/i965/brw_bufmgr.c             |   22 +-
 src/mesa/drivers/dri/i965/brw_bufmgr.h             |    8 +-
 src/mesa/drivers/dri/i965/brw_context.c            |    2 +
 src/mesa/drivers/dri/i965/brw_context.h            |    6 +
 src/mesa/drivers/dri/i965/genX_state_upload.c      |    3 +-
 src/mesa/drivers/dri/i965/intel_screen.c           |   55 +-
 src/mesa/drivers/dri/i965/intel_screen.h           |    3 +
 27 files changed, 5780 insertions(+), 20 deletions(-)
 create mode 100644 src/intel/tools/gen_shader_disassembler.c
 create mode 100644 src/intel/tools/i965_batchbuffer_dump_show.c
 create mode 100644 src/intel/tools/i965_batchbuffer_dump_show_json.cpp
 create mode 100644 src/intel/tools/i965_batchbuffer_dump_show_xml.cpp
 create mode 100644 src/intel/tools/i965_batchbuffer_logger.cpp
 create mode 100644 src/intel/tools/i965_batchbuffer_logger.h
 create mode 100644 src/intel/tools/i965_batchbuffer_logger_app.h
 create mode 100644 src/intel/tools/i965_batchbuffer_logger_instructions.h
 create mode 100644 src/intel/tools/i965_batchbuffer_logger_output.h
 create mode 100644 src/intel/tools/i965_batchbuffer_logger_sh.in

--
2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gl-320-fbo-shadow.json.gz
Type: application/gzip
Size: 23637 bytes
Desc: gl-320-fbo-shadow.json.gz
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170926/74e9abde/attachment-0003.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glxgears.json.gz
Type: application/gzip
Size: 138398 bytes
Desc: glxgears.json.gz
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170926/74e9abde/attachment-0004.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ioquake3.json.gz
Type: application/gzip
Size: 696998 bytes
Desc: ioquake3.json.gz
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170926/74e9abde/attachment-0005.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Integrate-glretrace-with-i965-BatchbufferLogger-tool.patch
Type: text/x-patch
Size: 8609 bytes
Desc: 0001-Integrate-glretrace-with-i965-BatchbufferLogger-tool.patch
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170926/74e9abde/attachment-0001.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: example_usage.txt
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170926/74e9abde/attachment-0001.txt>


More information about the mesa-dev mailing list