tu/autotune: Allocate performance counters from low-to-high

This is more consistent with the newly established pattern of the
UMD allocating all locally used performance counters low-to-high
instead of the prior high-to-low order.

Cc: mesa-stable
Signed-off-by: Dhruv Mark Collins <mark@igalia.com>
Assisted-by: OpenAI Codex (GPT-5.4)
(cherry picked from commit f78541b765)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41104>
This commit is contained in:
Dhruv Mark Collins 2026-04-16 21:50:26 +00:00 committed by Eric Engestrom
parent 3d6fab0404
commit 203ae35091
2 changed files with 5 additions and 7 deletions

View file

@ -2114,7 +2114,7 @@
"description": "tu/autotune: Allocate performance counters from low-to-high",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1660,15 +1660,13 @@ tu_autotune::tu_autotune(struct tu_device *device, VkResult &result)
auto always_count_countable = get_perfcntr_countable(cp_group, "PERF_CP_ALWAYS_COUNT");
if (preemption_latency_countable && always_count_countable) {
if (cp_group->num_counters >= 2) {
uint32_t preemption_latency_counter_index = cp_group->num_counters - 2;
preemption_latency_selector_reg = cp_group->counters[preemption_latency_counter_index].select_reg;
preemption_latency_selector_reg = cp_group->counters[0].select_reg;
preemption_latency_selector = preemption_latency_countable->selector;
preemption_latency_counter_reg_lo = cp_group->counters[preemption_latency_counter_index].counter_reg_lo;
preemption_latency_counter_reg_lo = cp_group->counters[0].counter_reg_lo;
uint32_t always_count_counter_index = cp_group->num_counters - 1;
always_count_selector_reg = cp_group->counters[always_count_counter_index].select_reg;
always_count_selector_reg = cp_group->counters[1].select_reg;
always_count_selector = always_count_countable->selector;
always_count_counter_reg_lo = cp_group->counters[always_count_counter_index].counter_reg_lo;
always_count_counter_reg_lo = cp_group->counters[1].counter_reg_lo;
} else {
fail_reason = "not enough counters in CP group for preemption latency tracking";
}