Mesa (master): nir/schedule: Store a pointer to the options struct in scoreboard

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 24 10:58:16 UTC 2020


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

Author: Neil Roberts <nroberts at igalia.com>
Date:   Fri Jul 17 09:17:29 2020 +0200

nir/schedule: Store a pointer to the options struct in scoreboard

Instead of copying the individual members of nir_schedule_options into
the scoreboard, it now just keeps a pointer to the options. This avoids
the duplicated comments and makes it easier to add more options later.

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5953>

---

 src/compiler/nir/nir_schedule.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/compiler/nir/nir_schedule.c b/src/compiler/nir/nir_schedule.c
index 386a515d783..1db808fc1cc 100644
--- a/src/compiler/nir/nir_schedule.c
+++ b/src/compiler/nir/nir_schedule.c
@@ -110,13 +110,8 @@ typedef struct {
     */
    int pressure;
 
-   /* Number of channels that may be in use before we switch to the
-    * pressure-prioritizing scheduling heuristic.
-    */
-   int threshold;
-
-   /* Mask of stages that share memory for inputs and outputs */
-   unsigned stages_with_shared_io_memory;
+   /* Options specified by the backend */
+   const nir_schedule_options *options;
 } nir_schedule_scoreboard;
 
 /* When walking the instructions in reverse, we use this flag to swap
@@ -329,7 +324,7 @@ nir_schedule_intrinsic_deps(nir_deps_state *state,
       /* For some hardware and stages, output stores affect the same shared
        * memory as input loads.
        */
-      if ((state->scoreboard->stages_with_shared_io_memory &
+      if ((state->scoreboard->options->stages_with_shared_io_memory &
            (1 << state->scoreboard->shader->info.stage)))
          add_write_dep(state, &state->load_input, n);
 
@@ -870,7 +865,7 @@ nir_schedule_instructions(nir_schedule_scoreboard *scoreboard, nir_block *block)
       }
 
       nir_schedule_node *chosen;
-      if (scoreboard->pressure < scoreboard->threshold)
+      if (scoreboard->pressure < scoreboard->options->threshold)
          chosen = nir_schedule_choose_instruction_csp(scoreboard);
       else
          chosen = nir_schedule_choose_instruction_csr(scoreboard);
@@ -991,9 +986,7 @@ nir_schedule_get_scoreboard(nir_shader *shader,
    scoreboard->shader = shader;
    scoreboard->live_values = _mesa_pointer_set_create(scoreboard);
    scoreboard->remaining_uses = _mesa_pointer_hash_table_create(scoreboard);
-   scoreboard->threshold = options->threshold;
-   scoreboard->stages_with_shared_io_memory =
-      options->stages_with_shared_io_memory;
+   scoreboard->options = options;
    scoreboard->pressure = 0;
 
    nir_foreach_function(function, shader) {



More information about the mesa-commit mailing list