intel/dev: fix subslice/eu total computations with some fused configurations

When a device has its first slice/subslice fused off, we can't use the
number of slices/subslices to iterate the mask array.

v2: Fix spelling (Marcin)
    Use size_t for iterator (Marcin)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reported-by: Matt Roper <matthew.d.roper@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5601
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10015>
This commit is contained in:
Lionel Landwerlin
2021-04-03 13:28:50 +03:00
committed by Marge Bot
parent e10c641f00
commit a543a94404
5 changed files with 73 additions and 9 deletions
+4 -4
View File
@@ -79,18 +79,18 @@ main(int argc, char *argv[])
const char *subslice_name = devinfo.ver >= 12 ? "dualsubslice" : "subslice";
uint32_t n_s = 0, n_ss = 0, n_eus = 0;
for (unsigned s = 0; s < devinfo.num_slices; s++) {
for (unsigned s = 0; s < devinfo.max_slices; s++) {
n_s += (devinfo.slice_masks & (1u << s)) ? 1 : 0;
for (unsigned ss = 0; ss < devinfo.num_subslices[s]; ss++) {
for (unsigned ss = 0; ss < devinfo.max_subslices_per_slice; ss++) {
fprintf(stdout, " slice%u.%s%u: ", s, subslice_name, ss);
if (intel_device_info_subslice_available(&devinfo, s, ss)) {
n_ss++;
for (unsigned eu = 0; eu < devinfo.num_eu_per_subslice; eu++) {
for (unsigned eu = 0; eu < devinfo.max_eu_per_subslice; eu++) {
n_eus += intel_device_info_eu_available(&devinfo, s, ss, eu) ? 1 : 0;
fprintf(stdout, "%s", intel_device_info_eu_available(&devinfo, s, ss, eu) ? "1" : "0");
}
} else {
fprintf(stderr, "fused");
fprintf(stdout, "fused");
}
fprintf(stdout, "\n");
}