aco: don't count certain pseudo towards VMEM_STORE_CLAUSE_MAX_GRAB_DIST

fossil-db (navi31):
Totals from 1023 (1.29% of 79395) affected shaders:
MaxWaves: 29258 -> 29240 (-0.06%)
Instrs: 1134024 -> 1133163 (-0.08%); split: -0.10%, +0.02%
CodeSize: 5682108 -> 5678696 (-0.06%); split: -0.08%, +0.02%
VGPRs: 60248 -> 60272 (+0.04%); split: -0.08%, +0.12%
Latency: 3797510 -> 3792797 (-0.12%); split: -0.18%, +0.05%
InvThroughput: 781270 -> 781239 (-0.00%); split: -0.03%, +0.03%
VClause: 24701 -> 23976 (-2.94%); split: -3.55%, +0.61%
Copies: 75177 -> 75169 (-0.01%); split: -0.20%, +0.19%
VALU: 659939 -> 659962 (+0.00%); split: -0.02%, +0.02%
VOPD: 2040 -> 2009 (-1.52%); split: +0.29%, -1.81%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28948>
This commit is contained in:
Rhys Perry 2024-04-26 11:52:13 +01:00 committed by Marge Bot
parent 34844deb3e
commit cb81ec7a61
1 changed files with 30 additions and 1 deletions

View File

@ -665,6 +665,34 @@ perform_hazard_query(hazard_query* query, Instruction* instr, bool upwards)
return hazard_success;
}
unsigned
get_likely_cost(Instruction* instr)
{
if (instr->opcode == aco_opcode::p_split_vector ||
instr->opcode == aco_opcode::p_extract_vector) {
unsigned cost = 0;
for (Definition def : instr->definitions) {
if (instr->operands[0].isKill() &&
def.regClass().type() == instr->operands[0].regClass().type())
continue;
cost += def.size();
}
return cost;
} else if (instr->opcode == aco_opcode::p_create_vector) {
unsigned cost = 0;
for (Operand op : instr->operands) {
if (op.isTemp() && op.isFirstKill() &&
op.regClass().type() == instr->definitions[0].regClass().type())
continue;
cost += op.size();
}
return cost;
} else {
/* For the moment, just assume the same cost for all other instructions. */
return 1;
}
}
void
schedule_SMEM(sched_ctx& ctx, Block* block, std::vector<RegisterDemand>& register_demand,
Instruction* current, int idx)
@ -1118,7 +1146,7 @@ schedule_VMEM_store(sched_ctx& ctx, Block* block, std::vector<RegisterDemand>& r
DownwardsCursor cursor = ctx.mv.downwards_init(idx, true, true);
int skip = 0;
for (int i = 0; (i - skip) < VMEM_STORE_CLAUSE_MAX_GRAB_DIST; i++) {
for (int16_t k = 0; k < VMEM_STORE_CLAUSE_MAX_GRAB_DIST;) {
aco_ptr<Instruction>& candidate = block->instructions[cursor.source_idx];
if (candidate->opcode == aco_opcode::p_logical_start)
break;
@ -1126,6 +1154,7 @@ schedule_VMEM_store(sched_ctx& ctx, Block* block, std::vector<RegisterDemand>& r
if (!should_form_clause(current, candidate.get())) {
add_to_hazard_query(&hq, candidate.get());
ctx.mv.downwards_skip(cursor);
k += get_likely_cost(candidate.get());
continue;
}