From 0d37bf2a31b2a7f5d294646a275205209e61c4f8 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 28 Apr 2023 16:34:44 -0400 Subject: [PATCH] llvmpipe: fix native vector width init this otherwise causes infinite loops in subgroup tests and kills ci Fixes: 4a056807bc3 ("gallivm: break out native vector width calc for reuse") Reviewed-by: Dave Airlie Part-of: (cherry picked from commit e9864d7f39d74a914e1d486a1a36627d296e9315) --- .pick_status.json | 2 +- src/gallium/auxiliary/gallivm/lp_bld_init.c | 14 ++++++++------ src/gallium/auxiliary/gallivm/lp_bld_init.h | 2 +- src/gallium/drivers/llvmpipe/lp_screen.c | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 39a639c80bf..c942763220d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -175,7 +175,7 @@ "description": "llvmpipe: fix native vector width init", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "4a056807bc3b813f390d194bbe382b573761649e" }, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 7f616620772..24d082398e9 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -421,18 +421,22 @@ fail: } unsigned -lp_build_get_native_width(void) +lp_build_init_native_width(void) { // Default to 256 until we're confident llvmpipe with 512 is as correct and not slower than 256 - unsigned vector_width = MIN2(util_get_cpu_caps()->max_vector_bits, 256); + lp_native_vector_width = MIN2(util_get_cpu_caps()->max_vector_bits, 256); + assert(lp_native_vector_width); - vector_width = debug_get_num_option("LP_NATIVE_VECTOR_WIDTH", vector_width); - return vector_width; + lp_native_vector_width = debug_get_num_option("LP_NATIVE_VECTOR_WIDTH", lp_native_vector_width); + assert(lp_native_vector_width); + + return lp_native_vector_width; } boolean lp_build_init(void) { + lp_build_init_native_width(); if (gallivm_initialized) return TRUE; @@ -449,8 +453,6 @@ lp_build_init(void) lp_set_target_options(); - lp_native_vector_width = lp_build_get_native_width(); - #if DETECT_ARCH_PPC_64 /* Set the NJ bit in VSCR to 0 so denormalized values are handled as * specified by IEEE standard (PowerISA 2.06 - Section 6.3). This guarantees diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.h b/src/gallium/auxiliary/gallivm/lp_bld_init.h index d462c8c3fe5..be41a34485b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.h @@ -69,7 +69,7 @@ struct gallivm_state }; unsigned -lp_build_get_native_width(void); +lp_build_init_native_width(void); boolean lp_build_init(void); diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 72160f52e0c..9b623372d4e 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -1113,7 +1113,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys) snprintf(screen->renderer_string, sizeof(screen->renderer_string), "llvmpipe (LLVM " MESA_LLVM_VERSION_STRING ", %u bits)", - lp_build_get_native_width() ); + lp_build_init_native_width() ); list_inithead(&screen->ctx_list); (void) mtx_init(&screen->ctx_mutex, mtx_plain);