From 0e5722cd222f05896ee36c6a2b58f54469db8c1c Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Tue, 22 Nov 2022 22:47:29 +0100 Subject: [PATCH] nir: track existence of variable shared memory Signed-off-by: Karol Herbst Reviewed-by: Faith Ekstrand Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/shader_info.h | 5 +++++ src/compiler/spirv/spirv_to_nir.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index a63b9e6..522a797 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -513,6 +513,11 @@ typedef struct shader_info { */ enum gl_derivative_group derivative_group:2; + /* + * If the shader might run with shared mem on top of `shared_size`. + */ + bool has_variable_shared_mem:1; + /** * pointer size is: * AddressingModelLogical: 0 (default) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index bc067d7..a2c0bd6 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -6499,6 +6499,9 @@ vtn_emit_kernel_entry_point_wrapper(struct vtn_builder *b, for (unsigned i = 0; i < entry_point->num_params; ++i) { struct vtn_type *param_type = b->entry_point->func->type->params[i]; + b->shader->info.cs.has_variable_shared_mem |= + param_type->storage_class == SpvStorageClassWorkgroup; + /* consider all pointers to function memory to be parameters passed * by value */ -- 2.7.4