mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-21 22:40:35 +01:00
brw/algebraic: Convert some NOT to MOV
On Xe platforms, many fragment shaders have patterns like:
asr(8) g21<2>W g1.2<0,1,0>W 15D
...
mov(8) g11<1>UW g21<16,8,2>UW
...
not.nz.f0.0(8) null<1>D g11<8,8,1>W
Converting the NOT.NZ to MOV.Z enables copy propagation to eliminate the
original MOV. Then cmod propagation is able to eliminate the
NOT-converted-to-MOV.
It might be possible to cover this case by adding more opcodes to the
list NOT can propagate to. The next commit will show that just
converting to MOV is a better approach anyway.
v2: Fix a bad squash. Changes that were supposed to be in this commit
were accidentally in the next commit. Noticed by Ivan.
shader-db:
Meteor Lake, DG2, and Tiger Lake had similar results. (Meteor Lake shown)
total instructions in shared programs: 20069804 -> 20065167 (-0.02%)
instructions in affected programs: 592450 -> 587813 (-0.78%)
helped: 2300 / HURT: 0
total cycles in shared programs: 884534032 -> 884496201 (<.01%)
cycles in affected programs: 13064194 -> 13026363 (-0.29%)
helped: 1285 / HURT: 790
LOST: 18
GAINED: 15
fossil-db:
Meteor Lake, DG2, and Tiger Lake had similar results. (Meteor Lake shown)
Totals:
Instrs: 234506495 -> 234468664 (-0.02%)
Cycle count: 24444825202 -> 24445710703 (+0.00%); split: -0.01%, +0.01%
Max live registers: 42349793 -> 42349789 (-0.00%)
Max dispatch width: 7131344 -> 7131744 (+0.01%); split: +0.05%, -0.04%
Totals from 16673 (2.07% of 805781) affected shaders:
Instrs: 6497669 -> 6459838 (-0.58%)
Cycle count: 435877770 -> 436763271 (+0.20%); split: -0.54%, +0.74%
Max live registers: 1122972 -> 1122968 (-0.00%)
Max dispatch width: 151528 -> 151928 (+0.26%); split: +2.19%, -1.92%
No shader-db or fossil-db on any other Intel platforms.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34509>
This commit is contained in:
parent
9ce869aef5
commit
08fe7988d7
1 changed files with 23 additions and 0 deletions
|
|
@ -489,6 +489,29 @@ brw_opt_algebraic(brw_shader &s)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BRW_OPCODE_NOT:
|
||||
/* not.nz null, g17
|
||||
*
|
||||
* becomes
|
||||
*
|
||||
* mov.z null, g17
|
||||
*
|
||||
* These are equivalent, but the latter is easier for cmod prop.
|
||||
*/
|
||||
if (inst->dst.is_null() &&
|
||||
inst->conditional_mod != BRW_CONDITIONAL_NONE) {
|
||||
assert(!inst->src[0].abs);
|
||||
|
||||
if (!inst->src[0].negate)
|
||||
inst->conditional_mod = brw_negate_cmod(inst->conditional_mod);
|
||||
|
||||
inst->opcode = BRW_OPCODE_MOV;
|
||||
inst->src[0].negate = false;
|
||||
progress = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case BRW_OPCODE_OR:
|
||||
if (inst->src[0].equals(inst->src[1]) || inst->src[1].is_zero()) {
|
||||
/* On Gfx8+, the OR instruction can have a source modifier that
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue