From 196d0aa1101644488872f765d28ef84a59a2defc Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Wed, 3 Feb 2021 11:41:06 +0200 Subject: [PATCH] intel/dev: add helpers to compute subslice/eu total Signed-off-by: Lionel Landwerlin Reviewed-by: Jordan Justen Part-of: --- src/intel/dev/gen_device_info.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/intel/dev/gen_device_info.h b/src/intel/dev/gen_device_info.h index 492baccc2e5..4b3db81ad4a 100644 --- a/src/intel/dev/gen_device_info.h +++ b/src/intel/dev/gen_device_info.h @@ -308,6 +308,28 @@ gen_device_info_eu_available(const struct gen_device_info *devinfo, return (devinfo->eu_masks[subslice_offset + eu / 8] & (1U << eu % 8)) != 0; } +static inline uint32_t +gen_device_info_subslice_total(const struct gen_device_info *devinfo) +{ + uint32_t total = 0; + + for (uint32_t i = 0; i < devinfo->num_slices; i++) + total += __builtin_popcount(devinfo->subslice_masks[i]); + + return total; +} + +static inline uint32_t +gen_device_info_eu_total(const struct gen_device_info *devinfo) +{ + uint32_t total = 0; + + for (uint32_t i = 0; i < ARRAY_SIZE(devinfo->eu_masks); i++) + total += __builtin_popcount(devinfo->eu_masks[i]); + + return total; +} + static inline unsigned gen_device_info_num_dual_subslices(UNUSED const struct gen_device_info *devinfo) {