[Mesa-dev] [PATCH v2 00/73] Experimental NIR backend for radeonsi

Nicolai Hähnle nhaehnle at gmail.com
Wed Jul 5 10:47:44 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Hi all,

Here's an updated version of the NIR backend series. Most of the comments
have been integrated, and where they haven't been fully integrated, I think
they could be addressed as a follow-up.

The series has become shorter, since Dave pulled several of the ac/nir
changes into master already, and I've pushed a bunch of other non-controversial
changes as well.

The main changes of the remaining patches relative to v1:

1. nir_lower_io is moved from st/mesa into the drivers (patch 10). This
   is a major change that affects freedreno / vc4, which I can't test.
   st/mesa is still responsible for assigning all the locations, e.g. for
   uniforms, var->data.driver_location is setup by st/mesa, and then the
   driver calls nir_lower_io, which uses that information.

2. nir_lower_uniforms_to_ubo now converts from load_uniform intrinsics to
   load_ubo, rather than directly from uniform variable load_vars.

3. GLSLFragCoordIsSysVal is handled cleanly with a NIR intrinsic.

4. radeonsi calls nir_lower_tex itself.

5. ac_shader_abi uses LLVMValueRefs instead of function parameter indices.

We still don't apply nir_lower_io to input/output variables, keeping aligned
with how radv does things. But this is now an issue entirely internal to
radeonsi/radv, and can be cleaned up at our leisure if we think it makes
sense.

FWIW, dynamic array indexing still makes things awkward, because while
nir_lower_io_to_temporaries helps with VS-PS inputs and outputs, it'd
actually be preferable *not* to use it on API VS outputs when compiling
VS-as-LS or VS-as-ES.

Please review!
Cheers,
Nicolai
--
 src/amd/common/ac_llvm_build.c                    |   14 +-
 src/amd/common/ac_llvm_build.h                    |    4 +-
 src/amd/common/ac_nir_to_llvm.c                   | 1427 ++++++++++++---------
 src/amd/common/ac_nir_to_llvm.h                   |    9 +-
 src/amd/common/ac_shader_abi.h                    |   95 ++
 src/amd/common/ac_shader_info.c                   |    9 +
 src/amd/common/ac_shader_info.h                   |    2 +
 src/amd/vulkan/radv_cmd_buffer.c                  |    2 +-
 src/amd/vulkan/radv_pipeline.c                    |    2 +-
 src/compiler/Makefile.sources                     |    2 +
 src/compiler/glsl_types.cpp                       |    4 +-
 src/compiler/nir/nir.c                            |   17 +
 src/compiler/nir/nir.h                            |    5 +
 src/compiler/nir/nir_gather_info.c                |    1 +
 src/compiler/nir/nir_intrinsics.h                 |    1 +
 src/compiler/nir/nir_lower_samplers_as_deref.c    |  243 ++++
 src/compiler/nir/nir_lower_uniforms_to_ubo.c      |   97 ++
 src/compiler/nir/nir_lower_wpos_ytransform.c      |    6 +-
 src/compiler/nir_types.cpp                        |    7 +
 src/compiler/nir_types.h                          |    2 +
 src/gallium/docs/source/screen.rst                |    2 +
 src/gallium/drivers/etnaviv/etnaviv_screen.c      |    1 +
 src/gallium/drivers/freedreno/freedreno_screen.c  |    1 +
 src/gallium/drivers/freedreno/ir3/ir3_cmdline.c   |   15 +-
 src/gallium/drivers/freedreno/ir3/ir3_shader.c    |   12 +
 src/gallium/drivers/freedreno/ir3/ir3_shader.h    |    5 +
 src/gallium/drivers/i915/i915_screen.c            |    1 +
 src/gallium/drivers/llvmpipe/lp_screen.c          |    1 +
 src/gallium/drivers/nouveau/nv30/nv30_screen.c    |    1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c    |    1 +
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c    |    1 +
 src/gallium/drivers/r300/r300_screen.c            |    1 +
 src/gallium/drivers/r600/r600_pipe.c              |    1 +
 src/gallium/drivers/radeon/r600_pipe_common.c     |    1 +
 src/gallium/drivers/radeon/r600_pipe_common.h     |    2 +-
 src/gallium/drivers/radeonsi/Automake.inc         |    3 +
 src/gallium/drivers/radeonsi/Makefile.am          |    1 +
 src/gallium/drivers/radeonsi/Makefile.sources     |    1 +
 src/gallium/drivers/radeonsi/si_pipe.c            |   40 +
 src/gallium/drivers/radeonsi/si_shader.c          |  864 +++++++------
 src/gallium/drivers/radeonsi/si_shader.h          |    8 +
 src/gallium/drivers/radeonsi/si_shader_internal.h |   36 +-
 src/gallium/drivers/radeonsi/si_shader_nir.c      |  508 ++++++++
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c |   63 +-
 src/gallium/drivers/radeonsi/si_state_shaders.c   |   46 +-
 src/gallium/drivers/softpipe/sp_screen.c          |    1 +
 src/gallium/drivers/svga/svga_screen.c            |    1 +
 src/gallium/drivers/swr/swr_screen.cpp            |    1 +
 src/gallium/drivers/vc4/vc4_program.c             |   13 +-
 src/gallium/drivers/vc4/vc4_screen.c              |    1 +
 src/gallium/drivers/virgl/virgl_screen.c          |    1 +
 src/gallium/include/pipe/p_defines.h              |    1 +
 src/gallium/targets/d3dadapter9/Makefile.am       |    1 +
 src/gallium/targets/omx/Makefile.am               |    1 +
 src/gallium/targets/va/Makefile.am                |    1 +
 src/gallium/targets/vdpau/Makefile.am             |    1 +
 src/gallium/targets/xvmc/Makefile.am              |    1 +
 src/mesa/Makefile.sources                         |    2 -
 src/mesa/state_tracker/st_glsl_to_nir.cpp         |   28 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp        |    5 +-
 src/mesa/state_tracker/st_glsl_types.cpp          |  107 --
 src/mesa/state_tracker/st_glsl_types.h            |   44 -
 62 files changed, 2542 insertions(+), 1233 deletions(-)
 create mode 100644 src/amd/common/ac_shader_abi.h
 create mode 100644 src/compiler/nir/nir_lower_samplers_as_deref.c
 create mode 100644 src/compiler/nir/nir_lower_uniforms_to_ubo.c
 create mode 100644 src/gallium/drivers/radeonsi/si_shader_nir.c
 delete mode 100644 src/mesa/state_tracker/st_glsl_types.cpp
 delete mode 100644 src/mesa/state_tracker/st_glsl_types.h

-- 
2.9.3


More information about the mesa-dev mailing list