From 9b19104a30bba35c4025833d5022c8ddc6c1ccd0 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 15 Oct 2022 18:59:15 -0400 Subject: [PATCH] pan/mdg: Lower PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK on Midgard The register file on Midgard is not large enough to sustain 256 threads in a threadgroup when all ISA-defined registers are used. As such, we want to advertise the smallest MAX_THREADS_PER_BLOCK permissible by the spec to avoid compiling shaders that will necessarily spill. The minimum-maximum in OpenGL ES 3.1 is 128, so set that on Midgard. 6 compute shaders LOST in shader-db due to exceeding this new limit. These shaders would fault if they were attempted to be executed. Cc: mesa-stable Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_screen.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index b7e469bd057..2a921c49f84 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -692,7 +692,15 @@ panfrost_get_compute_param(struct pipe_screen *pscreen, enum pipe_shader_ir ir_t RET(((uint64_t []) { 256, 256, 256 })); case PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK: - RET((uint64_t []) { 256 }); + /* On Bifrost and newer, all GPUs can support at least 256 threads + * regardless of register usage, so we report 256. + * + * On Midgard, with maximum register usage, the maximum + * thread count is only 64. We would like to report 64 here, but + * the GLES3.1 spec minimum is 128, so we report 128 and limit + * the register allocation of affected compute kernels. + */ + RET((uint64_t []) { dev->arch >= 6 ? 256 : 128 }); case PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE: RET((uint64_t []) { 1024*1024*512 /* Maybe get memory */ });