aco: do not fix_exports when program is prolog
authorQiang Yu <yuq825@gmail.com>
Thu, 17 Aug 2023 06:45:37 +0000 (14:45 +0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 31 Aug 2023 02:39:16 +0000 (02:39 +0000)
Otherwise fix_export() will abort when find no export.

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/24712>

src/amd/compiler/aco_assembler.cpp
src/amd/compiler/aco_interface.cpp
src/amd/compiler/aco_ir.h

index c27e084..a50d4b9 100644 (file)
@@ -1291,8 +1291,10 @@ emit_program(Program* program, std::vector<uint32_t>& code, std::vector<struct a
 {
    asm_context ctx(program, symbols);
 
-   if (program->stage.hw == AC_HW_VERTEX_SHADER || program->stage.hw == AC_HW_PIXEL_SHADER ||
-       program->stage.hw == AC_HW_NEXT_GEN_GEOMETRY_SHADER)
+   /* Prolog has no exports. */
+   if (!program->is_prolog &&
+       (program->stage.hw == AC_HW_VERTEX_SHADER || program->stage.hw == AC_HW_PIXEL_SHADER ||
+        program->stage.hw == AC_HW_NEXT_GEN_GEOMETRY_SHADER))
       fix_exports(ctx, code, program);
 
    for (Block& block : program->blocks) {
index 51f0cbd..08274ea 100644 (file)
@@ -363,6 +363,8 @@ aco_compile_shader_part(const struct aco_compiler_options* options,
    program->debug.func = options->debug.func;
    program->debug.private_data = options->debug.private_data;
 
+   program->is_prolog = is_prolog;
+
    /* Instruction selection */
    select_shader_part(program.get(), pinfo, &config, options, info, args);
 
index 6de37e5..df902cb 100644 (file)
@@ -2121,6 +2121,7 @@ public:
    bool has_smem_buffer_or_global_loads = false;
    bool has_pops_overlapped_waves_wait = false;
    bool has_color_exports = false;
+   bool is_prolog = false;
 
    std::vector<uint8_t> constant_data;
    Temp private_segment_buffer;