aco: fix get_buffer_resource_flags()

Looks like a rebase error. After switching to derefs, we have to look
through a nir_op_mov.

fossil-db (Navi):
Totals from 846 (0.62% of 137413) affected shaders:
SGPRs: 36856 -> 44144 (+19.77%); split: -0.20%, +19.97%
VGPRs: 35968 -> 27852 (-22.56%); split: -22.64%, +0.08%
SpillSGPRs: 1366 -> 1662 (+21.67%); split: -0.95%, +22.62%
SpillVGPRs: 1909 -> 1893 (-0.84%)
CodeSize: 5209588 -> 5146536 (-1.21%); split: -1.89%, +0.68%
Scratch: 221184 -> 217088 (-1.85%)
MaxWaves: 11488 -> 14266 (+24.18%); split: +24.20%, -0.02%
Instrs: 994831 -> 974318 (-2.06%); split: -2.53%, +0.47%
Cycles: 45719692 -> 45843260 (+0.27%); split: -0.99%, +1.26%
VMEM: 147562 -> 94468 (-35.98%); split: +9.75%, -45.74%
SMEM: 32122 -> 66023 (+105.54%); split: +120.34%, -14.80%
VClause: 41051 -> 20565 (-49.90%); split: -50.00%, +0.09%
SClause: 18076 -> 40142 (+122.07%)
Copies: 100092 -> 103521 (+3.43%); split: -0.98%, +4.40%
Branches: 51244 -> 51533 (+0.56%); split: -0.02%, +0.58%
PreSGPRs: 32290 -> 34267 (+6.12%)
PreVGPRs: 27458 -> 25290 (-7.90%); split: -7.91%, +0.01%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 05b6612b4e ('radv: do not lower UBO/SSBO access to offsets')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6966>
This commit is contained in:
Rhys Perry 2020-10-01 19:51:38 +01:00 committed by Marge Bot
parent b2e1fc8976
commit 37c1b9c54b

View file

@ -131,11 +131,15 @@ inline void get_buffer_resource_flags(isel_context *ctx, nir_ssa_def *def, unsig
/* global resources are considered aliasing with all other buffers and
* buffer images */
// TODO: only merge flags of resources which can really alias.
} else if (def->parent_instr->type == nir_instr_type_intrinsic) {
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(def->parent_instr);
if (intrin->intrinsic == nir_intrinsic_vulkan_resource_index) {
desc_set = nir_intrinsic_desc_set(intrin);
binding = nir_intrinsic_binding(intrin);
} else if (def->parent_instr->type == nir_instr_type_alu) {
nir_alu_instr* mov_instr = nir_instr_as_alu(def->parent_instr);
if (mov_instr->op == nir_op_mov && mov_instr->src[0].swizzle[0] == 0 &&
mov_instr->src[0].src.ssa->parent_instr->type == nir_instr_type_intrinsic) {
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(mov_instr->src[0].src.ssa->parent_instr);
if (intrin->intrinsic == nir_intrinsic_vulkan_resource_index) {
desc_set = nir_intrinsic_desc_set(intrin);
binding = nir_intrinsic_binding(intrin);
}
}
} else if (def->parent_instr->type == nir_instr_type_deref) {
nir_deref_instr *deref = nir_instr_as_deref(def->parent_instr);