mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-07 03:20:28 +01:00
aco: add VALU/SALU/VMEM/SMEM statistics
This lets us measure optimizations without interference of waitcnt instructions. 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/25559>
This commit is contained in:
parent
0756324ca4
commit
d200916ca2
3 changed files with 19 additions and 3 deletions
|
|
@ -55,6 +55,10 @@ static const std::array<aco_compiler_statistic_info, aco_num_statistics> statist
|
|||
aco_compiler_statistic_info{"Pre-Sched SGPRs", "SGPR usage before scheduling"};
|
||||
ret[aco_statistic_vgpr_presched] =
|
||||
aco_compiler_statistic_info{"Pre-Sched VGPRs", "VGPR usage before scheduling"};
|
||||
ret[aco_statistic_valu] = aco_compiler_statistic_info{"VALU", "Number of VALU instructions"};
|
||||
ret[aco_statistic_salu] = aco_compiler_statistic_info{"SALU", "Number of SALU instructions"};
|
||||
ret[aco_statistic_vmem] = aco_compiler_statistic_info{"VMEM", "Number of VMEM instructions"};
|
||||
ret[aco_statistic_smem] = aco_compiler_statistic_info{"SMEM", "Number of SMEM instructions"};
|
||||
return ret;
|
||||
}();
|
||||
|
||||
|
|
|
|||
|
|
@ -226,6 +226,10 @@ enum aco_statistic {
|
|||
aco_statistic_smem_clauses,
|
||||
aco_statistic_sgpr_presched,
|
||||
aco_statistic_vgpr_presched,
|
||||
aco_statistic_valu,
|
||||
aco_statistic_salu,
|
||||
aco_statistic_vmem,
|
||||
aco_statistic_smem,
|
||||
aco_num_statistics
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -531,11 +531,15 @@ collect_preasm_stats(Program* program)
|
|||
program->statistics[aco_statistic_instructions] += block.instructions.size();
|
||||
|
||||
for (aco_ptr<Instruction>& instr : block.instructions) {
|
||||
if (instr->isSOPP() && instr->sopp().block != -1)
|
||||
bool is_branch = instr->isSOPP() && instr->sopp().block != -1;
|
||||
if (is_branch)
|
||||
program->statistics[aco_statistic_branches]++;
|
||||
|
||||
if (instr->opcode == aco_opcode::p_constaddr)
|
||||
program->statistics[aco_statistic_instructions] += 2;
|
||||
if (instr->isVALU() || instr->isVINTRP())
|
||||
program->statistics[aco_statistic_valu]++;
|
||||
if (instr->isSALU() && !instr->isSOPP() &&
|
||||
instr_info.classes[(int)instr->opcode] != instr_class::waitcnt)
|
||||
program->statistics[aco_statistic_salu]++;
|
||||
|
||||
if ((instr->isVMEM() || instr->isScratch() || instr->isGlobal()) &&
|
||||
!instr->operands.empty()) {
|
||||
|
|
@ -544,6 +548,8 @@ collect_preasm_stats(Program* program)
|
|||
{ return should_form_clause(instr.get(), other); }))
|
||||
program->statistics[aco_statistic_vmem_clauses]++;
|
||||
vmem_clause.insert(instr.get());
|
||||
|
||||
program->statistics[aco_statistic_vmem]++;
|
||||
} else {
|
||||
vmem_clause.clear();
|
||||
}
|
||||
|
|
@ -554,6 +560,8 @@ collect_preasm_stats(Program* program)
|
|||
{ return should_form_clause(instr.get(), other); }))
|
||||
program->statistics[aco_statistic_smem_clauses]++;
|
||||
smem_clause.insert(instr.get());
|
||||
|
||||
program->statistics[aco_statistic_smem]++;
|
||||
} else {
|
||||
smem_clause.clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue