mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-15 22:58:05 +02:00
jay/opt_propagate: propagate undefs
allows deleting piles of moves & pressure. simd16 results: Totals: Instrs: 2759547 -> 2753358 (-0.22%); split: -0.29%, +0.06% CodeSize: 41141280 -> 41071072 (-0.17%); split: -0.23%, +0.06% Totals from 332 (12.54% of 2647) affected shaders: Instrs: 648080 -> 641891 (-0.95%); split: -1.23%, +0.28% CodeSize: 9782272 -> 9712064 (-0.72%); split: -0.97%, +0.25% simd32 is a loss because of RA being stupid. again, this is obviously the right thing to do so we're doing it. stats are just a hint. Totals: Instrs: 4683556 -> 4689193 (+0.12%); split: -0.25%, +0.37% CodeSize: 70072256 -> 70171920 (+0.14%); split: -0.23%, +0.38% Number of spill instructions: 50320 -> 50316 (-0.01%) Number of fill instructions: 51530 -> 51526 (-0.01%) Totals from 351 (13.26% of 2647) affected shaders: Instrs: 1349954 -> 1355591 (+0.42%); split: -0.86%, +1.28% CodeSize: 20484224 -> 20583888 (+0.49%); split: -0.80%, +1.29% Number of spill instructions: 21762 -> 21758 (-0.02%) Number of fill instructions: 26328 -> 26324 (-0.02%) Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41510>
This commit is contained in:
parent
21e527ceec
commit
db95df3da4
2 changed files with 19 additions and 8 deletions
|
|
@ -210,29 +210,32 @@ jay_collect(jay_builder *b,
|
|||
/*
|
||||
* Set the n'th channel of a def to index. This requires a copy-on-write.
|
||||
*
|
||||
* This implementation could likely be optimized.
|
||||
* This implementation could likely be optimized. Right now, we just decompress
|
||||
* the def, update in-place, then collect back.
|
||||
*/
|
||||
static inline void
|
||||
jay_insert_channel(jay_builder *b, jay_def *d, unsigned c, jay_def scalar)
|
||||
jay_insert_channel_index(jay_builder *b, jay_def *d, unsigned c, uint32_t index)
|
||||
{
|
||||
uint32_t indices[JAY_MAX_DEF_LENGTH];
|
||||
uint32_t count = jay_num_values(*d);
|
||||
|
||||
assert(scalar.file == d->file && !scalar.negate && !scalar.abs);
|
||||
assert(c < count && count <= ARRAY_SIZE(indices));
|
||||
|
||||
/* First, decompress the def. */
|
||||
jay_foreach_comp(*d, i) {
|
||||
indices[i] = jay_channel(*d, i);
|
||||
}
|
||||
|
||||
/* Next, update the indices in place */
|
||||
indices[c] = jay_index(scalar);
|
||||
|
||||
/* Now collect it back. */
|
||||
indices[c] = index;
|
||||
jay_replace_src(d, jay_collect(b, d->file, indices, count));
|
||||
}
|
||||
|
||||
static inline void
|
||||
jay_insert_channel(jay_builder *b, jay_def *d, unsigned c, jay_def scalar)
|
||||
{
|
||||
assert(scalar.file == d->file && !scalar.negate && !scalar.abs);
|
||||
jay_insert_channel_index(b, d, c, jay_index(scalar));
|
||||
}
|
||||
|
||||
/*
|
||||
* Concatenate a list of vectors, collecting all the indices in order.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -147,6 +147,8 @@ propagate_forwards(jay_function *f)
|
|||
I->src[s].file == def->src[0].file) {
|
||||
|
||||
jay_insert_channel(&b, &I->src[s], c, def->src[0]);
|
||||
} else if (def->op == JAY_OPCODE_UNDEF && c > 0) {
|
||||
jay_insert_channel_index(&b, &I->src[s], c, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -189,6 +191,12 @@ propagate_forwards(jay_function *f)
|
|||
propagate_modifier(I, s, def);
|
||||
} else if (def->op == JAY_OPCODE_NOT && !jay_uses_implicit_flag(def)) {
|
||||
propagate_not(I, s, def);
|
||||
} else if (def->op == JAY_OPCODE_UNDEF &&
|
||||
I->op == JAY_OPCODE_MOV &&
|
||||
!jay_uses_implicit_flag(I)) {
|
||||
|
||||
I->op = JAY_OPCODE_UNDEF;
|
||||
jay_shrink_sources(I, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue