From 7a614806134dc78bcfb2a75c1ba09daed9c0eeeb Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 24 Jul 2020 16:38:33 +0100 Subject: [PATCH] aco: consider intrinsic access in visit_{load,store}_image MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit radv_nir_lower_memory_model will use this. Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 5b93d3fcf06..4539ee64c3a 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -5861,6 +5861,7 @@ void visit_image_load(isel_context *ctx, nir_intrinsic_instr *instr) Temp dst = get_ssa_temp(ctx, &instr->dest.ssa); memory_sync_info sync = get_memory_sync_info(instr, storage_image, 0); + unsigned access = var->data.access | nir_intrinsic_access(instr); if (dim == GLSL_SAMPLER_DIM_BUF) { unsigned mask = nir_ssa_def_components_read(&instr->dest.ssa); @@ -5896,7 +5897,7 @@ void visit_image_load(isel_context *ctx, nir_intrinsic_instr *instr) tmp = {ctx->program->allocateId(), RegClass(RegType::vgpr, num_channels)}; load->definitions[0] = Definition(tmp); load->idxen = true; - load->glc = var->data.access & (ACCESS_VOLATILE | ACCESS_COHERENT); + load->glc = access & (ACCESS_VOLATILE | ACCESS_COHERENT); load->dlc = load->glc && ctx->options->chip_class >= GFX10; load->sync = sync; ctx->block->instructions.emplace_back(std::move(load)); @@ -5924,7 +5925,7 @@ void visit_image_load(isel_context *ctx, nir_intrinsic_instr *instr) load->operands[1] = Operand(s4); /* no sampler */ load->operands[2] = Operand(coords); load->definitions[0] = Definition(tmp); - load->glc = var->data.access & (ACCESS_VOLATILE | ACCESS_COHERENT) ? 1 : 0; + load->glc = access & (ACCESS_VOLATILE | ACCESS_COHERENT) ? 1 : 0; load->dlc = load->glc && ctx->options->chip_class >= GFX10; load->dim = ac_get_image_dim(ctx->options->chip_class, dim, is_array); load->dmask = dmask; @@ -5946,7 +5947,8 @@ void visit_image_store(isel_context *ctx, nir_intrinsic_instr *instr) Temp data = as_vgpr(ctx, get_ssa_temp(ctx, instr->src[3].ssa)); memory_sync_info sync = get_memory_sync_info(instr, storage_image, 0); - bool glc = ctx->options->chip_class == GFX6 || var->data.access & (ACCESS_VOLATILE | ACCESS_COHERENT | ACCESS_NON_READABLE) ? 1 : 0; + unsigned access = var->data.access | nir_intrinsic_access(instr); + bool glc = ctx->options->chip_class == GFX6 || access & (ACCESS_VOLATILE | ACCESS_COHERENT | ACCESS_NON_READABLE) ? 1 : 0; if (dim == GLSL_SAMPLER_DIM_BUF) { Temp rsrc = get_sampler_desc(ctx, nir_instr_as_deref(instr->src[0].ssa->parent_instr), ACO_DESC_BUFFER, nullptr, true, true); -- 2.30.2