diff options
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r-- | src/compiler/spirv/nir_spirv.h | 6 | ||||
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 1 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 14 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h index d5978a81bb4..81175ebf022 100644 --- a/src/compiler/spirv/nir_spirv.h +++ b/src/compiler/spirv/nir_spirv.h @@ -83,6 +83,12 @@ struct spirv_to_nir_options { nir_address_format global_addr_format; nir_address_format temp_addr_format; + /* Whether UniformConstant memory should be treated as normal global memory. + * This is usefull for CL 2.0 implementations with fine grain system SVM + * support. + */ + bool constant_as_global; + struct { void (*func)(void *private_data, enum nir_spirv_debug_level level, diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 0c1813b139d..aff11a2d579 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -1351,6 +1351,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, case SpvStorageClassFunction: case SpvStorageClassWorkgroup: case SpvStorageClassCrossWorkgroup: + case SpvStorageClassUniformConstant: val->type->stride = align(glsl_get_cl_size(val->type->deref->type), glsl_get_cl_alignment(val->type->deref->type)); break; diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 755d85642a0..d7edabb5656 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1816,8 +1816,18 @@ vtn_storage_class_to_mode(struct vtn_builder *b, nir_mode = nir_var_mem_global; break; case SpvStorageClassUniformConstant: - mode = vtn_variable_mode_uniform; - nir_mode = nir_var_uniform; + if (b->shader->info.stage == MESA_SHADER_KERNEL) { + if (b->options->constant_as_global) { + mode = vtn_variable_mode_cross_workgroup; + nir_mode = nir_var_mem_global; + } else { + mode = vtn_variable_mode_ubo; + nir_mode = nir_var_mem_ubo; + } + } else { + mode = vtn_variable_mode_uniform; + nir_mode = nir_var_uniform; + } break; case SpvStorageClassPushConstant: mode = vtn_variable_mode_push_constant; |