Mesa (main): intel/perf: use the right popcount for 64bits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 29 06:42:25 UTC 2021
Module: Mesa
Branch: main
Commit: 71b7c7b0dc698b052b0dc7875c12b433c790bbaf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=71b7c7b0dc698b052b0dc7875c12b433c790bbaf
Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date: Fri Jun 25 13:54:51 2021 +0300
intel/perf: use the right popcount for 64bits
We're currently using the 32bit version which is dropping half the
bits of the 64bits values.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: mesa-stable
Reviewed-by: Sagar Ghuge <sagar.ghuge at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11607>
---
src/intel/perf/intel_perf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/intel/perf/intel_perf.c b/src/intel/perf/intel_perf.c
index 98e1ee5cfd3..f3c7726931e 100644
--- a/src/intel/perf/intel_perf.c
+++ b/src/intel/perf/intel_perf.c
@@ -373,11 +373,11 @@ compute_topology_builtins(struct intel_perf_config *perf,
for (int i = 0; i < sizeof(devinfo->subslice_masks[i]); i++) {
perf->sys_vars.n_eu_sub_slices +=
- __builtin_popcount(devinfo->subslice_masks[i]);
+ util_bitcount(devinfo->subslice_masks[i]);
}
for (int i = 0; i < sizeof(devinfo->eu_masks); i++)
- perf->sys_vars.n_eus += __builtin_popcount(devinfo->eu_masks[i]);
+ perf->sys_vars.n_eus += util_bitcount(devinfo->eu_masks[i]);
perf->sys_vars.eu_threads_count = devinfo->num_thread_per_eu;
@@ -896,7 +896,7 @@ get_passes_mask(struct intel_perf_config *perf,
assert(counter_indices[i] < perf->n_counters);
uint32_t idx = counter_indices[i];
- if (__builtin_popcount(perf->counter_infos[idx].query_mask) != (q + 1))
+ if (util_bitcount64(perf->counter_infos[idx].query_mask) != (q + 1))
continue;
if (queries_mask & perf->counter_infos[idx].query_mask)
@@ -925,7 +925,7 @@ intel_perf_get_n_passes(struct intel_perf_config *perf,
}
}
- return __builtin_popcount(queries_mask);
+ return util_bitcount64(queries_mask);
}
void
@@ -935,7 +935,7 @@ intel_perf_get_counters_passes(struct intel_perf_config *perf,
struct intel_perf_counter_pass *counter_pass)
{
uint64_t queries_mask = get_passes_mask(perf, counter_indices, counter_indices_count);
- ASSERTED uint32_t n_passes = __builtin_popcount(queries_mask);
+ ASSERTED uint32_t n_passes = util_bitcount64(queries_mask);
for (uint32_t i = 0; i < counter_indices_count; i++) {
assert(counter_indices[i] < perf->n_counters);
@@ -947,7 +947,7 @@ intel_perf_get_counters_passes(struct intel_perf_config *perf,
counter_pass[i].query = &perf->queries[query_idx];
uint32_t clear_bits = 63 - query_idx;
- counter_pass[i].pass = __builtin_popcount((queries_mask << clear_bits) >> clear_bits) - 1;
+ counter_pass[i].pass = util_bitcount64((queries_mask << clear_bits) >> clear_bits) - 1;
assert(counter_pass[i].pass < n_passes);
}
}
More information about the mesa-commit
mailing list