anv/perf: fixup counter/query mapping
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 27 Jul 2022 08:51:29 +0000 (08:51 +0000)
committerMarge Bot <emma+marge@anholt.net>
Thu, 17 Nov 2022 12:57:06 +0000 (12:57 +0000)
The intel_perf_counter_pass::pass field is actually useless and
invalid.

Once you have mapped all the counters to all the metrics, the order of
the metrics capture is dictated by intel_perf_get_n_passes().

When reading values that is the order we should follow.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 2001a80d4a81 ("anv: Implement VK_KHR_performance_query")
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18893>

src/intel/perf/intel_perf.c
src/intel/perf/intel_perf.h
src/intel/vulkan/anv_perf.c
src/intel/vulkan_hasvk/anv_perf.c

index a3ae255..e1b482c 100644 (file)
@@ -985,12 +985,9 @@ intel_perf_get_counters_passes(struct intel_perf_config *perf,
          }
       }
 
-      if (pass_idx == UINT32_MAX) {
+      if (pass_idx == UINT32_MAX)
          pass_array[n_written_passes] = counter_pass[i].query;
-         pass_idx = n_written_passes++;
-      }
 
-      counter_pass[i].pass = pass_idx;
       assert(n_written_passes <= n_passes);
    }
 }
index 207c237..6a9f835 100644 (file)
@@ -415,7 +415,6 @@ struct intel_perf_config {
 struct intel_perf_counter_pass {
    struct intel_perf_query_info *query;
    struct intel_perf_query_counter *counter;
-   uint32_t pass;
 };
 
 /** Initialize the intel_perf_config object for a given device.
index 49cbef5..3e970b2 100644 (file)
@@ -430,10 +430,12 @@ anv_perf_write_pass_results(struct intel_perf_config *perf,
                             const struct intel_perf_query_result *accumulated_results,
                             union VkPerformanceCounterResultKHR *results)
 {
+   const struct intel_perf_query_info *query = pool->pass_query[pass];
+
    for (uint32_t c = 0; c < pool->n_counters; c++) {
       const struct intel_perf_counter_pass *counter_pass = &pool->counter_pass[c];
 
-      if (counter_pass->pass != pass)
+      if (counter_pass->query != query)
          continue;
 
       switch (pool->pass_query[pass]->kind) {
index 3aac07f..b0372ec 100644 (file)
@@ -440,10 +440,12 @@ anv_perf_write_pass_results(struct intel_perf_config *perf,
                             const struct intel_perf_query_result *accumulated_results,
                             union VkPerformanceCounterResultKHR *results)
 {
+   const struct intel_perf_query_info *query = pool->pass_query[pass];
+
    for (uint32_t c = 0; c < pool->n_counters; c++) {
       const struct intel_perf_counter_pass *counter_pass = &pool->counter_pass[c];
 
-      if (counter_pass->pass != pass)
+      if (counter_pass->query != query)
          continue;
 
       switch (pool->pass_query[pass]->kind) {