[Mesa-dev] [PATCH 00/16] nir+gallium: Move to using instructions for derefs

Rob Clark robdclark at gmail.com
Sat Apr 7 16:13:32 UTC 2018


This applies on top of Jason's v3 patchset of the same name[1],
and converts the remaining nir passes only used by gallium drivers,
plus the tgsi_to_nir frontend, and in the end converts the ir3
backend.

The first patch is just some small fixups to one of Jason's patches
(which he might already have locally since sending his v3 patchset,
but I needed to build).

Patches 2-4 are some small misc fixes/cleanups, which are not
depending on deref instructions (but in particular 4 fixes an issue
that crops up when we start using deref instructions).

After that, a couple RFC's, and then the interesting bits.  It is a
bit difficult to review, because a lot of churn in the conversion
from deref chains to deref instructions.  In particular the order
is reversed, with deref chains you have a pointer to the deref_var
at the head of the deref chain and follow it down thru various
array/struct dereferences.  But in the new world, you have as an
SSA src, the last deref node and follow it up to the deref_var
instruction.  But it might end up being easier to just look at the
end result[2] rather than the patch.

The tgsi_to_nir and lower_samplers_as_deref were tested using the
commandline compiler (since really only simple built-in shaders use
tgsi_to_nir these days, and freedreno doesn't use the _as_deref
variant of sampler lowering.  The rest was tested with piglit.  At
this point there are no regressions (tested on a5xx).  I haven't
compared shader-db yet.

[1] https://lists.freedesktop.org/archives/mesa-dev/2018-April/190905.html
[2] https://github.com/freedreno/mesa/commits/nir-deref-instr-v3

Rob Clark (16):
  fixup! nir: Remove old-school deref chain support
  nir: add comment about nir_src_copy()
  mesa/st/nir: fix naked lowering pass call
  mesa/st/nir: fix instruction removal
  nir: promote intrinsic_get_var() to helper
  nir/print: show deref instruction type
  nir/print: add type names for deref instr
  RFC: nir: typedef'ify nir_deref_path
  RFC: nir: cleanup dead deref instructions
  ttn: convert to deref instructions
  mesa/st/nir: convert lower_builtins to deref instructions
  Revert "HACK! nir: Disable building a couple passes"
  nir: convert lower_io_arrays_to_elements to deref instructions
  nir: convert lower_io_to_scalar to deref instructions
  nir: convert lower_samplers_as_deref to deref instructions
  freedreno/ir3: convert to deref instructions

 src/amd/vulkan/radv_shader.c                       |   2 -
 src/compiler/Makefile.sources                      |   3 +
 src/compiler/nir/meson.build                       |   6 +-
 src/compiler/nir/nir.c                             |   3 +
 src/compiler/nir/nir.h                             |  13 +-
 src/compiler/nir/nir_deref.c                       |  22 ++-
 src/compiler/nir/nir_deref.h                       |   4 +-
 src/compiler/nir/nir_lower_io_arrays_to_elements.c | 149 +++++++++---------
 src/compiler/nir/nir_lower_io_to_scalar.c          |  88 ++++++-----
 src/compiler/nir/nir_lower_samplers_as_deref.c     | 167 +++++++++++++--------
 src/compiler/nir/nir_print.c                       |   9 +-
 src/compiler/nir/nir_propagate_invariant.c         |  14 +-
 src/compiler/nir/nir_validate.c                    |   5 +
 src/gallium/auxiliary/nir/tgsi_to_nir.c            |  52 ++-----
 src/gallium/drivers/freedreno/ir3/ir3_cmdline.c    |   3 -
 .../drivers/freedreno/ir3/ir3_compiler_nir.c       |  46 +++---
 src/gallium/drivers/freedreno/ir3/ir3_nir.c        |   4 +-
 .../freedreno/ir3/ir3_nir_lower_tg4_to_tex.c       |   4 +-
 src/mesa/state_tracker/st_glsl_to_nir.cpp          |   4 +-
 src/mesa/state_tracker/st_nir_lower_builtin.c      |  53 ++++---
 20 files changed, 349 insertions(+), 302 deletions(-)

-- 
2.14.3



More information about the mesa-dev mailing list