intel/dev: add helpers to compute subslice/eu total

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9052>
This commit is contained in:
Lionel Landwerlin 2021-02-03 11:41:06 +02:00 committed by Marge Bot
parent 45e6fcef4b
commit 196d0aa110
1 changed files with 22 additions and 0 deletions

View File

@ -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)
{