mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-29 04:10:53 +02:00
freedreno/ir3: don't fetch unused tex components
Detect when a component of an (for example) texture fetch is unused and propagate the updated wrmask back to the parent instruction. Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
b971afd19e
commit
0d240c2214
2 changed files with 29 additions and 0 deletions
|
|
@ -174,6 +174,33 @@ remove_unused_by_block(struct ir3_block *block)
|
||||||
if (instr->opc == OPC_END)
|
if (instr->opc == OPC_END)
|
||||||
continue;
|
continue;
|
||||||
if (instr->flags & IR3_INSTR_UNUSED) {
|
if (instr->flags & IR3_INSTR_UNUSED) {
|
||||||
|
if (instr->opc == OPC_META_FO) {
|
||||||
|
struct ir3_instruction *src = ssa(instr->regs[1]);
|
||||||
|
if (src->regs[0]->wrmask > 1) {
|
||||||
|
unsigned newn, lastn;
|
||||||
|
|
||||||
|
lastn = util_last_bit(src->regs[0]->wrmask);
|
||||||
|
src->regs[0]->wrmask &= ~(1 << instr->fo.off);
|
||||||
|
newn = util_last_bit(src->regs[0]->wrmask);
|
||||||
|
|
||||||
|
/* prune no-longer needed right-neighbors. We could
|
||||||
|
* probably do the same for left-neighbors (ie. tex
|
||||||
|
* fetch that only need .yw components), but that
|
||||||
|
* makes RA a bit more confusing than it already is
|
||||||
|
*/
|
||||||
|
if (newn < lastn) {
|
||||||
|
struct ir3_instruction *n = ir3_neighbor_first(instr);
|
||||||
|
for (unsigned i = 1; i < newn; i++) {
|
||||||
|
n = n->cp.right;
|
||||||
|
}
|
||||||
|
// XXX I don't think n should be null here!
|
||||||
|
if (n) {
|
||||||
|
debug_assert(n->cp.right->flags & IR3_INSTR_UNUSED);
|
||||||
|
n->cp.right = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
list_delinit(&instr->node);
|
list_delinit(&instr->node);
|
||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -509,6 +509,8 @@ get_definer(struct ir3_ra_ctx *ctx, struct ir3_instruction *instr,
|
||||||
d = dd;
|
d = dd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug_assert(d->opc != OPC_META_FO);
|
||||||
|
|
||||||
id->defn = d;
|
id->defn = d;
|
||||||
id->sz = *sz;
|
id->sz = *sz;
|
||||||
id->off = *off;
|
id->off = *off;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue