Mesa (main): aco/scheduler: Fix register demand computation for upwards moves

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 13 15:36:44 UTC 2021


Module: Mesa
Branch: main
Commit: 50ba919d37289d1ed9bf2464042eaa0b8e3dbb2e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=50ba919d37289d1ed9bf2464042eaa0b8e3dbb2e

Author: Tony Wasserka <tony.wasserka at gmx.de>
Date:   Fri May  7 16:22:45 2021 +0200

aco/scheduler: Fix register demand computation for upwards moves

The initial value needs to be taken from the instruction that is being
moved over, not the one to be moved.

Additionally the parameter of this function was removed because it was
misleading. Setting it to any value other than source_idx would cause
register_demand to be initialized incorrectly. (Instead, the maximum
demand among the covered instructions would need to be determined.)

Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10644>

---

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

diff --git a/src/amd/compiler/aco_scheduler.cpp b/src/amd/compiler/aco_scheduler.cpp
index 17a398a8ead..41aa381c648 100644
--- a/src/amd/compiler/aco_scheduler.cpp
+++ b/src/amd/compiler/aco_scheduler.cpp
@@ -74,7 +74,7 @@ struct MoveState {
    /* for moving instructions after the first use of the current instruction upwards */
    void upwards_init(int source_idx, bool improved_rar);
    bool upwards_check_deps();
-   void upwards_set_insert_idx(int before);
+   void upwards_update_insert_idx();
    MoveResult upwards_move();
    void upwards_skip();
 
@@ -261,10 +261,10 @@ bool MoveState::upwards_check_deps()
    return true;
 }
 
-void MoveState::upwards_set_insert_idx(int before)
+void MoveState::upwards_update_insert_idx()
 {
-   insert_idx = before;
-   total_demand = register_demand[before - 1];
+   insert_idx = source_idx;
+   total_demand = register_demand[insert_idx];
 }
 
 MoveResult MoveState::upwards_move()
@@ -635,7 +635,7 @@ void schedule_SMEM(sched_ctx& ctx, Block* block,
 
       if (is_dependency) {
          if (!found_dependency) {
-            ctx.mv.upwards_set_insert_idx(candidate_idx);
+            ctx.mv.upwards_update_insert_idx();
             init_hazard_query(&hq);
             found_dependency = true;
          }
@@ -776,7 +776,7 @@ void schedule_VMEM(sched_ctx& ctx, Block* block,
       is_dependency |= !found_dependency && !ctx.mv.upwards_check_deps();
       if (is_dependency) {
          if (!found_dependency) {
-            ctx.mv.upwards_set_insert_idx(candidate_idx);
+            ctx.mv.upwards_update_insert_idx();
             init_hazard_query(&indep_hq);
             found_dependency = true;
          }



More information about the mesa-commit mailing list