mesa/src/compiler
Connor Abbott 156306e5e6 nir/find_array_copies: Handle wildcards and overlapping copies
This commit rewrites opt_find_array_copies to be able to handle
an array copy sequence with other intervening operations in between. In
particular, this handles the case where we OpLoad an array of structs
and then OpStore it, which generates code like:

foo[0].a = bar[0].a
foo[0].b = bar[0].b
foo[1].a = bar[1].a
foo[1].b = bar[1].b
...

that wasn't recognized by the previous pass.

In order to correctly handle copying arrays of arrays, and in particular
to correctly handle copies involving wildcards, we need to use a tree
structure similar to lower_vars_to_ssa so that we can walk all the
partial array copies invalidated by a particular write, including
ones where one of the common indices is a wildcard. I actually think
that when factoring in the needed hashing/comparing code, a hash table
based approach wouldn't be a lot smaller anyways.

All of the changes come from tessellation control shaders in Strange
Brigade, where we're able to remove the DXVK-inserted copy at the
beginning of the shader. These are the result for radv:

Totals from affected shaders:
SGPRS: 4576 -> 4576 (0.00 %)
VGPRS: 13784 -> 5560 (-59.66 %)
Spilled SGPRs: 0 -> 0 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 8696 -> 6876 (-20.93 %) dwords per thread
Code Size: 329940 -> 263268 (-20.21 %) bytes
LDS: 0 -> 0 (0.00 %) blocks
Max Waves: 330 -> 898 (172.12 %)
Wait states: 0 -> 0 (0.00 %)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2019-07-29 11:36:25 +02:00
..
glsl glsl: report no function instead of empty candidate list 2019-07-25 17:20:10 +02:00
nir nir/find_array_copies: Handle wildcards and overlapping copies 2019-07-29 11:36:25 +02:00
spirv spirv: propagate access qualifiers through ssa & pointer 2019-07-26 14:09:55 +00:00
Android.glsl.gen.mk
Android.glsl.mk
Android.mk
Android.nir.gen.mk
Android.nir.mk
blob.c
blob.h
builtin_type_macros.h
glsl_types.cpp util: use standard name for snprintf() 2019-07-19 22:39:38 +01:00
glsl_types.h glsl: Add a constructor for glsl_struct_field to specify the precision 2019-07-11 08:04:54 +02:00
Makefile.sources nir: replace lower_sincos with algebraic opt 2019-07-24 17:36:21 -04:00
meson.build
nir_types.cpp nir/types: Add glsl_type_is_unsized_array helper 2019-07-12 23:42:41 +02:00
nir_types.h nir/types: Add glsl_type_is_unsized_array helper 2019-07-12 23:42:41 +02:00
SConscript
SConscript.glsl
SConscript.nir
SConscript.spirv
shader_enums.c glsl: Optionally declare gl_PointCoord as a system value 2019-07-18 13:20:39 +00:00
shader_enums.h glsl: Optionally declare gl_PointCoord as a system value 2019-07-18 13:20:39 +00:00
shader_info.h nir/gather_info: Look for uses of helper invocations 2019-07-23 13:40:41 -05:00