Module: Mesa
Branch: staging/21.0
Commit: 29bbd4bc678d3c6ac518596e17bfcbb4223d6ebb
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=29bbd4bc678d3c6ac518596e17bfcbb4223d6ebb

Author: Tony Wasserka <[email protected]>
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 <[email protected]>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10644>
(cherry picked from commit 50ba919d37289d1ed9bf2464042eaa0b8e3dbb2e)

---

 .pick_status.json                  |  2 +-
 src/amd/compiler/aco_scheduler.cpp | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index cfede3d8e2d..19fe0053c29 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2110,7 +2110,7 @@
         "description": "aco/scheduler: Fix register demand computation for 
upwards moves",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/compiler/aco_scheduler.cpp 
b/src/amd/compiler/aco_scheduler.cpp
index 81b882c0a61..6a8fc09fa7b 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()
@@ -637,7 +637,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;
          }
@@ -780,7 +780,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;
          }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to