nir: add a vectorization pass
This effectively does the opposite of nir_lower_alus_to_scalar, trying to combine per-component ALU operations with the same sources but different swizzles into one larger ALU operation. It uses a similar model as CSE, where we do a depth-first approach and keep around a hash set of instructions to be combined, but there are a few major differences: 1. For now, we only support entirely per-component ALU operations. 2. Since it's not always guaranteed that we'll be able to combine equivalent instructions, we keep a stack of equivalent instructions around, trying to combine new instructions with instructions on the stack. The pass isn't comprehensive by far; it can't handle operations where some of the sources are per-component and others aren't, and it can't handle phi nodes. But it should handle the more common cases, and it should be reasonably efficient. [Alyssa: Rebase on latest master, updating with respect to typeless moves] Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Acked-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:

committed by
Alyssa Rosenzweig

parent
c3558868da
commit
47e7c6961a
@@ -3618,6 +3618,8 @@ bool nir_opt_trivial_continues(nir_shader *shader);
|
||||
|
||||
bool nir_opt_undef(nir_shader *shader);
|
||||
|
||||
bool nir_opt_vectorize(nir_shader *shader);
|
||||
|
||||
bool nir_opt_conditional_discard(nir_shader *shader);
|
||||
|
||||
void nir_strip(nir_shader *shader);
|
||||
|
Reference in New Issue
Block a user