aco: allow no export instruction for gfx10+ fs
authorQiang Yu <yuq825@gmail.com>
Sun, 23 Apr 2023 08:39:11 +0000 (16:39 +0800)
committerQiang Yu <yuq825@gmail.com>
Fri, 28 Apr 2023 03:33:28 +0000 (11:33 +0800)
radeonsi will generate no export instruction when no
discard and no output.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22727>

src/amd/compiler/aco_assembler.cpp

index e05f6dc..3717964 100644 (file)
@@ -1010,7 +1010,10 @@ fix_exports(asm_context& ctx, std::vector<uint32_t>& out, Program* program)
       }
    }
 
-   if (!exported) {
+   /* GFX10+ FS may not export anything if no discard is used. */
+   bool may_skip_export = program->stage.hw == HWStage::FS && program->gfx_level >= GFX10;
+
+   if (!exported && !may_skip_export) {
       /* Abort in order to avoid a GPU hang. */
       bool is_vertex_or_ngg =
          (program->stage.hw == HWStage::VS || program->stage.hw == HWStage::NGG);