diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 68757fc252d..60fab78adf3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1891,7 +1891,7 @@ arch_rounding_available(const struct lp_type type) return true; else if (util_get_cpu_caps()->has_neon) return true; - else if (util_get_cpu_caps()->family == CPU_S390X) + else if (DETECT_ARCH_S390 == true) return true; return false; @@ -2003,7 +2003,7 @@ lp_build_round_arch(struct lp_build_context *bld, enum lp_build_round_mode mode) { if (util_get_cpu_caps()->has_sse4_1 || util_get_cpu_caps()->has_neon || - util_get_cpu_caps()->family == CPU_S390X) { + DETECT_ARCH_S390 == true) { LLVMBuilderRef builder = bld->gallivm->builder; const struct lp_type type = bld->type; const char *intrinsic_root; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 1fc32b460ea..1cfbf0282da 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -818,11 +818,11 @@ update_cache_sha1_cpu(struct mesa_sha1 *ctx) const struct util_cpu_caps_t *cpu_caps = util_get_cpu_caps(); /* * Don't need the cpu cache affinity stuff. The rest - * is contained in first 5 dwords. + * is contained in first 4 dwords. */ STATIC_ASSERT(offsetof(struct util_cpu_caps_t, num_L3_caches) - == 5 * sizeof(uint32_t)); - _mesa_sha1_update(ctx, cpu_caps, 5 * sizeof(uint32_t)); + == 4 * sizeof(uint32_t)); + _mesa_sha1_update(ctx, cpu_caps, 4 * sizeof(uint32_t)); } diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c index b446f04e842..1c3565528c8 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c @@ -480,7 +480,7 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test, unsigned if (test->ref == &nearbyintf && length == 2 && !util_get_cpu_caps()->has_neon && - util_get_cpu_caps()->family != CPU_S390X && + DETECT_ARCH_S390 == false && !(util_get_cpu_caps()->has_sse4_1 && LLVM_VERSION_MAJOR >= 8) && ref != roundf(testval)) { /* FIXME: The generic (non SSE) path in lp_build_iround, which is diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index 139b3c4766a..0dc68524ca3 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -498,7 +498,7 @@ check_os_loongarch64_support(void) static void -get_cpu_topology(void) +get_cpu_topology(bool zen) { /* Default. This is OK if L3 is not present or there is only one. */ util_cpu_caps.num_L3_caches = 1; @@ -541,8 +541,7 @@ get_cpu_topology(void) #if DETECT_ARCH_X86 || DETECT_ARCH_X86_64 /* AMD Zen */ - if (util_cpu_caps.family >= CPU_AMD_ZEN1_ZEN2 && - util_cpu_caps.family < CPU_AMD_LAST) { + if (zen) { uint32_t regs[4]; uint32_t saved_mask[UTIL_MAX_CPUS / 32] = {0}; @@ -752,6 +751,7 @@ _util_cpu_detect_once(void) { int available_cpus = 0; int total_cpus = 0; + bool zen = false; memset(&util_cpu_caps, 0, sizeof util_cpu_caps); @@ -863,20 +863,8 @@ _util_cpu_detect_once(void) if (util_cpu_caps.x86_cpu_type == 0xf) util_cpu_caps.x86_cpu_type += ((regs2[0] >> 20) & 0xff); - switch (util_cpu_caps.x86_cpu_type) { - case 0x17: - util_cpu_caps.family = CPU_AMD_ZEN1_ZEN2; - break; - case 0x18: - util_cpu_caps.family = CPU_AMD_ZEN_HYGON; - break; - case 0x19: - util_cpu_caps.family = CPU_AMD_ZEN3; - break; - default: - if (util_cpu_caps.x86_cpu_type > 0x19) - util_cpu_caps.family = CPU_AMD_ZEN_NEXT; - } + if (util_cpu_caps.x86_cpu_type >= 0x17) + zen = true; /* general feature flags */ util_cpu_caps.has_sse = (regs2[3] >> 25) & 1; /* 0x2000000 */ @@ -953,16 +941,12 @@ _util_cpu_detect_once(void) check_os_loongarch64_support(); #endif /* DETECT_ARCH_LOONGARCH64 */ -#if DETECT_ARCH_S390 - util_cpu_caps.family = CPU_S390X; -#endif - check_cpu_caps_override(); /* max_vector_bits should be checked after cpu caps override */ check_max_vector_bits(); - get_cpu_topology(); + get_cpu_topology(zen); if (debug_get_option_dump_cpu()) { printf("util_cpu_caps.nr_cpus = %u\n", util_cpu_caps.nr_cpus); diff --git a/src/util/u_cpu_detect.h b/src/util/u_cpu_detect.h index 6e52b75659b..ef4c38db263 100644 --- a/src/util/u_cpu_detect.h +++ b/src/util/u_cpu_detect.h @@ -49,18 +49,6 @@ extern "C" { #endif -enum cpu_family { - CPU_UNKNOWN, - - CPU_AMD_ZEN1_ZEN2, - CPU_AMD_ZEN_HYGON, - CPU_AMD_ZEN3, - CPU_AMD_ZEN_NEXT, - CPU_AMD_LAST, - - CPU_S390X, -}; - typedef uint32_t util_affinity_mask[UTIL_MAX_CPUS / 32]; struct util_cpu_caps_t { @@ -81,8 +69,6 @@ struct util_cpu_caps_t { */ int16_t max_cpus; - enum cpu_family family; - /* Feature flags */ int x86_cpu_type; unsigned cacheline;