aco: Don't store TCS outputs to LDS when we're sure that none are read.
authorTimur Kristóf <timur.kristof@gmail.com>
Mon, 9 Mar 2020 15:27:54 +0000 (16:27 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 11 Mar 2020 08:34:11 +0000 (08:34 +0000)
This allows us not to write an output to LDS, even if it has
an indirect offset.

No pipeline DB changes.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3964>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3964>

src/amd/compiler/aco_instruction_selection.cpp

index 386616f52ef19be5ec88f4d42c2263946206d542..1de79f01da80570b0a76d45a48221df304ada281 100644 (file)
@@ -3339,6 +3339,10 @@ bool should_write_tcs_patch_output_to_lds(isel_context *ctx, nir_intrinsic_instr
    unsigned off = nir_intrinsic_base(instr) * 4u;
    nir_src *off_src = nir_get_io_offset_src(instr);
 
+   /* When none of the appropriate outputs are read, we are OK to never write to LDS */
+   if (per_vertex ? ctx->shader->info.outputs_read == 0U : ctx->shader->info.patch_outputs_read == 0u)
+      return false;
+
    /* Indirect offset, we can't be sure if this is read or not, always write to LDS */
    if (!nir_src_is_const(*off_src))
       return true;