tu: Add a loop count to VK_pipeline_executable_properties.

This will improve the report-fossil summaries I'm looking at for loop
unrolling, by showing me that loop count changed.  With a followup change
for my report-fossil to bring over behavior from GL report.py where we
ignore other counters when loop count changes (yeah, you expected to
increase instruction counts, it's fine), we go from:

    Totals:
    Instrs: 73000 -> 73242 (+0.33%)
    CodeSize: 142250 -> 142506 (+0.18%)
    NOPs: 13896 -> 13964 (+0.49%)
    MOVs: 2440 -> 2438 (-0.08%)
    Full: 1489 -> 1490 (+0.07%)
    (ss): 1742 -> 1754 (+0.69%)
    (ss)-stall: 7226 -> 7354 (+1.77%)
    Number of hardware loops: 79 -> 78 (-1.27%)
    [...]

    Totals from 1 (0.60% of 168) affected shaders:
    Instrs: 184 -> 426 (+131.52%)
    CodeSize: 288 -> 544 (+88.89%)
    NOPs: 80 -> 148 (+85.00%)
    MOVs: 9 -> 7 (-22.22%)
    Full: 11 -> 12 (+9.09%)
    (ss): 14 -> 26 (+85.71%)
    (ss)-stall: 58 -> 186 (+220.69%)
    Number of hardware loops: 2 -> 1 (-50.00%)
    [...]

     PERCENTAGE DELTAS                              Shaders   Instrs   CodeSize    NOPs      MOVs      Full [...]
     app_name               168       +0.33%    +0.18%    +0.49%    -0.08%    +0.07%    +0.69%    +1.77%    [...]
     -------------------------------------------------------------------------------------------------------[...]
     All affected           1        +131.52%  +88.89%   +85.00%   -22.22%    +9.09%   +85.71%   +220.69%   [...]
     -------------------------------------------------------------------------------------------------------[...]
     Total                  168       +0.33%    +0.18%    +0.49%    -0.08%    +0.07%    +0.69%    +1.77%    [...]

to:

    Totals:
    Number of hardware loops: 79 -> 78 (-1.27%)

    Totals from 1 (0.60% of 168) affected shaders:
    Number of hardware loops: 2 -> 1 (-50.00%)

     PERCENTAGE DELTAS      Shaders Number of hardware loops
     app_name               168              -1.27%
     ---------------------------------------------------------
     All affected           1                -50.00%
     ---------------------------------------------------------
     Total                  168              -1.27%

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38667>
This commit is contained in:
Emma Anholt 2025-11-25 16:40:20 -08:00 committed by Marge Bot
parent 24d9592118
commit 959520e227
4 changed files with 4 additions and 0 deletions

View file

@ -380,6 +380,7 @@ ir3_collect_info(struct ir3_shader_variant *v)
info->sizedwords = info->size / 4;
info->early_preamble = v->early_preamble;
info->loops = v->loops;
bool in_preamble = false;
bool has_eq = false;

View file

@ -42,6 +42,7 @@ struct ir3_info {
uint16_t nops_count; /* # of nop instructions, including nopN */
uint16_t mov_count;
uint16_t cov_count;
uint16_t loops;
uint16_t stp_count;
uint16_t ldp_count;
/* NOTE: max_reg, etc, does not include registers not touched

View file

@ -4952,6 +4952,7 @@ tu_GetPipelineExecutableStatisticsKHR(
stats.sy = exe->stats.sy;
stats.ss_stall = exe->stats.sstall;
stats.sy_stall = exe->stats.systall;
stats.loops = exe->stats.loops;
stats.stps = exe->stats.stp_count;
stats.ldps = exe->stats.ldp_count;
stats.preamble_inst = exe->stats.preamble_instrs_count;

View file

@ -15,6 +15,7 @@
<stat name="Estimated cycles stalled on SS" display="(ss)-stall">A better metric to estimate the impact of SS syncs.</stat>
<stat name="Estimated cycles stalled on SY" display="(sy)-stall">A better metric to estimate the impact of SY syncs.</stat>
<stat name="cat# instructions" display="cat#" count="8">Number of cat# instructions.</stat>
<stat name="Loops">Number of hardware loops</stat>
<stat name="STP Count" display="STPs">Number of STore Private instructions in the final generated shader executable.</stat>
<stat name="LDP Count" display="LDPs">Number of LoaD Private instructions in the final generated shader executable.</stat>
<stat name="Preamble Instruction Count" display="Preamble inst">Total number of IR3 instructions in the preamble.</stat>