Yes, I'm fully aware that some of this is a repeat of what eric just sent. However, most of the repeated work is in the first patch (and the 5th) which I'm not too worried about. There's two solutions to scalarizing things floating around and we can decide what we like best.
The important parts here are: 1) The second patch which scalarizes phi nodes. Having scalar ALU operations is find and all, but if we really want to melt those DX shaders, we need to split up the pyhi nodes as well. 2) The additions to nir_search to handle swizzles on replacements. Eventually, I'd like to support swizzles on search paterns as well, but that's much harder to get right and I didn't want to bang my head on it today. One side-effect of this is that we can use it to do the reduction replacements. Whether it's better to do these with the algebraic search-and-replace framework or direcly in C as Eric did, I don't know. 3) The last two patches which substantially simplifies the NIR -> i965 FS pass. One of the benifits of this is that we're no longer emitting piles of MOV operations just to resolve swizzles. Instead, since everything is vectorized, we can directly resolve them as we emit instructions. Also available here: http://cgit.freedesktop.org/~jekstrand/mesa/log/?h=review/nir-scalarize With all of this, we get the following from shader-db: total instructions in shared programs: 6097323 -> 6074645 (-0.37%) instructions in affected programs: 814032 -> 791354 (-2.79%) GAINED: 8 LOST: 11 Jason Ekstrand (7): nir: Add a pass for scalarizing ALU operations nir: Add a pass to lower vector phi nodes to scalar phi nodes nir/search: Don't use a nir_alu_src for storing variables nir/search: Add a swizzle to nir_search_variable and use it for replacements nir: Add a pass to lower things like bany and ball to scalar operations i965/fs: Use NIR's scalarizing abilities and stop handling vectors i965/fs_nir: Get rid of get_alu_src src/glsl/Makefile.am | 6 + src/glsl/Makefile.sources | 3 + src/glsl/nir/nir.h | 6 + src/glsl/nir/nir_algebraic.py | 14 + src/glsl/nir/nir_lower_alu_reductions.py | 78 +++++ src/glsl/nir/nir_lower_alu_to_scalar.c | 155 +++++++++ src/glsl/nir/nir_lower_phis_to_scalar.c | 238 +++++++++++++ src/glsl/nir/nir_search.c | 25 +- src/glsl/nir/nir_search.h | 7 + src/mesa/drivers/dri/i965/brw_fs.h | 16 - src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 569 +++++++++++-------------------- 11 files changed, 718 insertions(+), 399 deletions(-) create mode 100644 src/glsl/nir/nir_lower_alu_reductions.py create mode 100644 src/glsl/nir/nir_lower_alu_to_scalar.c create mode 100644 src/glsl/nir/nir_lower_phis_to_scalar.c -- 2.2.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev