[Mesa-dev] [PATCH 0/6] anv,nir: Move large constants to a UBO

Jason Ekstrand jason at jlekstrand.net
Fri Jun 29 20:06:49 UTC 2018


This little series adds an optimization pass to NIR and wires up up in anv
that moves large constant variables to a UBO.  This fixes a farily common
case in some filter or ambient occlusion shaders where they put some sort
of look-up table in the shader itself.  This series takes Skyrim Special
Edition running under DXVK from a slide show to a smooth and very playable
framerate on my SKL desktop.

The first part of the series adds a concept of constant data that can be
associated with a NIR shader and adds an optimization pass to move large
constant variables into this constant data section.  It's left up to the
driver to figure out how to get this constant data into the shader.  The
last three patches wire things up in ANV to put this data into an implicit
UBO and enables the optimization.

Jason Ekstrand (6):
  nir: Add a deref_instr_has_indirect helper
  nir: Add a concept of constant data associated with a shader
  nir: Add a large constants optimization pass
  anv: Add support for shader constant data to the pipeline cache
  anv: Add state setup support for shader constants
  anv,intel: Enable nir_opt_large_constants for Vulkan

 src/compiler/Makefile.sources                 |   1 +
 src/compiler/nir/meson.build                  |   1 +
 src/compiler/nir/nir.h                        |  15 +-
 src/compiler/nir/nir_clone.c                  |   6 +
 src/compiler/nir/nir_deref.c                  |  18 +
 src/compiler/nir/nir_intrinsics.py            |   2 +
 src/compiler/nir/nir_opt_large_constants.c    | 338 ++++++++++++++++++
 src/compiler/nir/nir_serialize.c              |  10 +
 src/intel/compiler/brw_compiler.h             |   6 +
 src/intel/compiler/brw_nir.c                  |   7 +
 src/intel/vulkan/anv_blorp.c                  |   1 +
 src/intel/vulkan/anv_device.c                 |   1 +
 .../vulkan/anv_nir_apply_pipeline_layout.c    |  47 +++
 src/intel/vulkan/anv_pipeline.c               |  12 +
 src/intel/vulkan/anv_pipeline_cache.c         |  26 ++
 src/intel/vulkan/anv_private.h                |   7 +
 src/intel/vulkan/genX_cmd_buffer.c            |  72 +++-
 17 files changed, 550 insertions(+), 20 deletions(-)
 create mode 100644 src/compiler/nir/nir_opt_large_constants.c

-- 
2.17.1



More information about the mesa-dev mailing list