nir: Move zero_initialize_shared_memory into common shader_info
Move it out the "cs" sub-struct, since the bit will be used for other shader stages in the future. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11225>
This commit is contained in:
@@ -648,7 +648,7 @@ radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *
|
||||
}
|
||||
NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_shared, nir_address_format_32bit_offset);
|
||||
|
||||
if (nir->info.cs.zero_initialize_shared_memory && nir->info.shared_size > 0) {
|
||||
if (nir->info.zero_initialize_shared_memory && nir->info.shared_size > 0) {
|
||||
const unsigned chunk_size = 16; /* max single store size */
|
||||
const unsigned shared_size = ALIGN(nir->info.shared_size, chunk_size);
|
||||
NIR_PASS_V(nir, nir_zero_initialize_shared_memory, shared_size, chunk_size);
|
||||
|
@@ -254,6 +254,11 @@ typedef struct shader_info {
|
||||
*/
|
||||
bool shared_memory_explicit_layout:1;
|
||||
|
||||
/**
|
||||
* Used for VK_KHR_zero_initialize_workgroup_memory.
|
||||
*/
|
||||
bool zero_initialize_shared_memory:1;
|
||||
|
||||
union {
|
||||
struct {
|
||||
/* Which inputs are doubles */
|
||||
@@ -396,8 +401,6 @@ typedef struct shader_info {
|
||||
*/
|
||||
enum gl_derivative_group derivative_group:2;
|
||||
|
||||
bool zero_initialize_shared_memory;
|
||||
|
||||
/**
|
||||
* pointer size is:
|
||||
* AddressingModelLogical: 0 (default)
|
||||
|
@@ -1960,7 +1960,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
|
||||
"as initializer, but have %u instead",
|
||||
vtn_id_for_value(b, val),
|
||||
vtn_id_for_value(b, initializer));
|
||||
b->shader->info.cs.zero_initialize_shared_memory = true;
|
||||
b->shader->info.zero_initialize_shared_memory = true;
|
||||
break;
|
||||
|
||||
case SpvStorageClassUniformConstant:
|
||||
|
@@ -1808,7 +1808,7 @@ anv_pipeline_compile_cs(struct anv_compute_pipeline *pipeline,
|
||||
NIR_PASS_V(stage.nir, nir_lower_explicit_io,
|
||||
nir_var_mem_shared, nir_address_format_32bit_offset);
|
||||
|
||||
if (stage.nir->info.cs.zero_initialize_shared_memory &&
|
||||
if (stage.nir->info.zero_initialize_shared_memory &&
|
||||
stage.nir->info.shared_size > 0) {
|
||||
/* The effective Shared Local Memory size is at least 1024 bytes and
|
||||
* is always rounded to a power of two, so it is OK to align the size
|
||||
|
Reference in New Issue
Block a user