From: Rhys Perry Date: Fri, 17 Jul 2020 18:17:10 +0000 (+0100) Subject: radv: use scoped barriers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc3bc9493cfc0ec6c03d16b17f9eb703dead3cac;p=mesa.git radv: use scoped barriers fossil-db (LLVM, Navi): Totals from 843 (0.62% of 135820) affected shaders: SGPRs: 40456 -> 40480 (+0.06%); split: -0.10%, +0.16% VGPRs: 39648 -> 39688 (+0.10%); split: -0.01%, +0.11% CodeSize: 2936164 -> 2932508 (-0.12%); split: -0.21%, +0.09% MaxWaves: 10828 -> 10827 (-0.01%) fossil-db changes seem to be due to SPIR-V -> NIR emitting a workgroup scope shared memory barrier instead of a group_memory_barrier. Signed-off-by: Rhys Perry Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Daniel Schürmann Part-of: --- diff --git a/src/amd/vulkan/radv_meta_fast_clear.c b/src/amd/vulkan/radv_meta_fast_clear.c index 45d15fd9e2b..bf9ed047c35 100644 --- a/src/amd/vulkan/radv_meta_fast_clear.c +++ b/src/amd/vulkan/radv_meta_fast_clear.c @@ -83,11 +83,8 @@ build_dcc_decompress_compute_shader(struct radv_device *dev) nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, "tex"); nir_builder_instr_insert(&b, &tex->instr); - nir_intrinsic_instr *membar = nir_intrinsic_instr_create(b.shader, nir_intrinsic_memory_barrier); - nir_builder_instr_insert(&b, &membar->instr); - - nir_intrinsic_instr *bar = nir_intrinsic_instr_create(b.shader, nir_intrinsic_control_barrier); - nir_builder_instr_insert(&b, &bar->instr); + nir_scoped_barrier(&b, NIR_SCOPE_WORKGROUP, NIR_SCOPE_WORKGROUP, + NIR_MEMORY_ACQ_REL, nir_var_mem_ssbo); nir_ssa_def *outval = &tex->dest.ssa; nir_intrinsic_instr *store = nir_intrinsic_instr_create(b.shader, nir_intrinsic_image_deref_store); diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 810d4055186..e499e6ea234 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -76,6 +76,7 @@ static const struct nir_shader_compiler_options nir_options_llvm = { .lower_fpow = true, .lower_mul_2x32_64 = true, .lower_rotate = true, + .use_scoped_barrier = true, .max_unroll_iterations = 32, .use_interpolated_input_intrinsics = true, /* nir_lower_int64() isn't actually called for the LLVM backend, but @@ -118,6 +119,7 @@ static const struct nir_shader_compiler_options nir_options_aco = { .lower_fpow = true, .lower_mul_2x32_64 = true, .lower_rotate = true, + .use_scoped_barrier = true, .max_unroll_iterations = 32, .use_interpolated_input_intrinsics = true, .lower_int64_options = nir_lower_imul64 | @@ -130,7 +132,6 @@ static const struct nir_shader_compiler_options nir_options_aco = { nir_lower_dsqrt | nir_lower_drsq | nir_lower_ddiv, - .use_scoped_barrier = true, }; bool