aco: only require texture coordinates to be in WQM if NSA is used
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 14 Jan 2021 20:00:12 +0000 (20:00 +0000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 20 Jan 2021 16:46:54 +0000 (16:46 +0000)
From comment in emit_mimg():
We don't need the bias, sample index, compare value or offset to be
computed in WQM but if the p_create_vector copies the coordinates, then it
needs to be in WQM.

fossil-db (GFX10.3):
Totals from 1778 (1.28% of 139391) affected shaders:
SGPRs: 105080 -> 105072 (-0.01%); split: -0.02%, +0.01%
VGPRs: 96800 -> 96776 (-0.02%); split: -0.07%, +0.05%
CodeSize: 10001120 -> 10001384 (+0.00%); split: -0.04%, +0.04%
MaxWaves: 18164 -> 18163 (-0.01%)
Instrs: 1883750 -> 1883598 (-0.01%); split: -0.06%, +0.05%
Cycles: 34800176 -> 34767840 (-0.09%); split: -0.10%, +0.01%

We don't have a p_create_vector if we use NSA.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8523>

src/amd/compiler/aco_instruction_selection.cpp

index 08ad957..d4c24b8 100644 (file)
@@ -9491,7 +9491,7 @@ void visit_tex(isel_context *ctx, nir_tex_instr *instr)
                           instr->sampler_dim != GLSL_SAMPLER_DIM_SUBPASS_MS;
 
    Operand vdata = instr->is_sparse ? emit_tfe_init(bld, tmp_dst) : Operand(v1);
-   unsigned num_wqm_coords = implicit_derivs ? args.size() : 0;
+   unsigned num_wqm_coords = implicit_derivs ? coords.size() : 0;
    MIMG_instruction *tex = emit_mimg(bld, opcode, Definition(tmp_dst), resource,
                                      Operand(sampler), args, num_wqm_coords, vdata);
    tex->dim = dim;