mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
jay/register_allocate: start using accumulators
this lets us lower away 8<-->2 copies/swaps in a faster, more straightforward way by (ab)using accumulators. I think as an edge case this plays nicely enough with my plans to profit from accs for normal fma-heavy code. SIMD16: Totals: Instrs: 2761525 -> 2758108 (-0.12%) CodeSize: 44222384 -> 44167168 (-0.12%) Totals from 33 (1.25% of 2647) affected shaders: Instrs: 422130 -> 418713 (-0.81%) CodeSize: 6713680 -> 6658464 (-0.82%) SIMD32: Totals: Instrs: 4911601 -> 4691895 (-4.47%) CodeSize: 79553984 -> 76010880 (-4.45%) Totals from 947 (35.78% of 2647) affected shaders: Instrs: 4143501 -> 3923795 (-5.30%) CodeSize: 67174592 -> 63631488 (-5.27%) Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41064>
This commit is contained in:
parent
53c1c076a8
commit
4c5ad7a832
1 changed files with 19 additions and 5 deletions
|
|
@ -374,11 +374,14 @@ add_copy(struct util_dynarray *copies, jay_reg dst, jay_reg src)
|
|||
static jay_def
|
||||
push_temp(jay_builder *b, jay_reg reg, bool stride4)
|
||||
{
|
||||
jay_def tmp = def_from_reg(reg);
|
||||
jay_def tmp = reg == NO_REG ? jay_null() : def_from_reg(reg);
|
||||
|
||||
if (stride4 && jay_def_stride(b->shader, tmp) != JAY_STRIDE_4) {
|
||||
if (jay_is_null(tmp) ||
|
||||
(stride4 && jay_def_stride(b->shader, tmp) != JAY_STRIDE_4)) {
|
||||
|
||||
/* Put accumulators down the float pipe - it's still a raw move. */
|
||||
jay_def new = def_from_reg(0);
|
||||
jay_MOV(b, tmp, new);
|
||||
jay_MOV(b, jay_bare_reg(ACCUM, 0), new)->type = JAY_TYPE_F32;
|
||||
tmp = new;
|
||||
}
|
||||
|
||||
|
|
@ -388,8 +391,8 @@ push_temp(jay_builder *b, jay_reg reg, bool stride4)
|
|||
static void
|
||||
pop_temp(jay_builder *b, struct jay_temp_regs t, jay_def temp)
|
||||
{
|
||||
if (temp.file == GPR && temp.reg != t.gpr) {
|
||||
jay_MOV(b, temp, def_from_reg(t.gpr));
|
||||
if (temp.file == GPR && make_reg(GPR, temp.reg) != t.gpr) {
|
||||
jay_MOV(b, temp, jay_bare_reg(ACCUM, 0))->type = JAY_TYPE_F32;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -410,6 +413,17 @@ mov(jay_builder *b, jay_def dst, jay_def src, struct jay_temp_regs temps)
|
|||
assert(temps.ugpr != NO_REG && "ensured by the spill limit");
|
||||
jay_MOV(b, def_from_reg(temps.ugpr), src);
|
||||
jay_MOV(b, dst, def_from_reg(temps.ugpr));
|
||||
} else if (dst.file == GPR &&
|
||||
src.file == GPR &&
|
||||
jay_def_stride(b->shader, dst) !=
|
||||
jay_def_stride(b->shader, src) &&
|
||||
jay_def_stride(b->shader, dst) != JAY_STRIDE_4 &&
|
||||
jay_def_stride(b->shader, src) != JAY_STRIDE_4) {
|
||||
|
||||
jay_def temp = push_temp(b, temps.gpr, true /* stride4 */);
|
||||
jay_MOV(b, temp, src);
|
||||
jay_MOV(b, dst, temp);
|
||||
pop_temp(b, temps, temp);
|
||||
} else {
|
||||
jay_MOV(b, dst, src);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue