Mesa (master): aco: Treat s_setprio as a scheduling barrier.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 7 11:44:56 UTC 2020


Module: Mesa
Branch: master
Commit: 35e58314d8e4b7346c2523612f6e0f52cc964232
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=35e58314d8e4b7346c2523612f6e0f52cc964232

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Wed Apr  1 15:38:43 2020 +0200

aco: Treat s_setprio as a scheduling barrier.

We want to execute instructions after s_setprio in the given
priority, so we must prevent the scheduler from scheduling beyond
s_setprio, otherwise some instructions could be executed in a
different priority.

Rename hazard_fail_memtime to hazard_fail_unreorderable and include
s_setprio in the list of unreorderable opcodes.

Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3576>

---

 src/amd/compiler/aco_scheduler.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/amd/compiler/aco_scheduler.cpp b/src/amd/compiler/aco_scheduler.cpp
index 41ca32c8625..d7cf90be189 100644
--- a/src/amd/compiler/aco_scheduler.cpp
+++ b/src/amd/compiler/aco_scheduler.cpp
@@ -460,7 +460,7 @@ enum HazardResult {
    /* Must stop at these failures. The hazard query code doesn't consider them
     * when added. */
    hazard_fail_exec,
-   hazard_fail_memtime,
+   hazard_fail_unreorderable,
 };
 
 HazardResult perform_hazard_query(hazard_query *query, Instruction *instr)
@@ -478,9 +478,11 @@ HazardResult perform_hazard_query(hazard_query *query, Instruction *instr)
    if (instr->format == Format::EXP)
       return hazard_fail_export;
 
-   /* don't move s_memtime/s_memrealtime */
-   if (instr->opcode == aco_opcode::s_memtime || instr->opcode == aco_opcode::s_memrealtime)
-      return hazard_fail_memtime;
+   /* don't move non-reorderable instructions */
+   if (instr->opcode == aco_opcode::s_memtime ||
+       instr->opcode == aco_opcode::s_memrealtime ||
+       instr->opcode == aco_opcode::s_setprio)
+      return hazard_fail_unreorderable;
 
    if (query->barrier_interaction && (query->barrier_interaction & parse_barrier(instr)))
       return hazard_fail_barrier;
@@ -795,7 +797,7 @@ void schedule_position_export(sched_ctx& ctx, Block* block,
          break;
 
       HazardResult haz = perform_hazard_query(&hq, candidate.get());
-      if (haz == hazard_fail_exec || haz == hazard_fail_memtime)
+      if (haz == hazard_fail_exec || haz == hazard_fail_unreorderable)
          break;
 
       if (haz != hazard_success) {



More information about the mesa-commit mailing list