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@igalia.com> Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5953>
This commit is contained in:
@@ -110,13 +110,8 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
int pressure;
|
int pressure;
|
||||||
|
|
||||||
/* Number of channels that may be in use before we switch to the
|
/* Options specified by the backend */
|
||||||
* pressure-prioritizing scheduling heuristic.
|
const nir_schedule_options *options;
|
||||||
*/
|
|
||||||
int threshold;
|
|
||||||
|
|
||||||
/* Mask of stages that share memory for inputs and outputs */
|
|
||||||
unsigned stages_with_shared_io_memory;
|
|
||||||
} nir_schedule_scoreboard;
|
} nir_schedule_scoreboard;
|
||||||
|
|
||||||
/* When walking the instructions in reverse, we use this flag to swap
|
/* 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
|
/* For some hardware and stages, output stores affect the same shared
|
||||||
* memory as input loads.
|
* 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)))
|
(1 << state->scoreboard->shader->info.stage)))
|
||||||
add_write_dep(state, &state->load_input, n);
|
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;
|
nir_schedule_node *chosen;
|
||||||
if (scoreboard->pressure < scoreboard->threshold)
|
if (scoreboard->pressure < scoreboard->options->threshold)
|
||||||
chosen = nir_schedule_choose_instruction_csp(scoreboard);
|
chosen = nir_schedule_choose_instruction_csp(scoreboard);
|
||||||
else
|
else
|
||||||
chosen = nir_schedule_choose_instruction_csr(scoreboard);
|
chosen = nir_schedule_choose_instruction_csr(scoreboard);
|
||||||
@@ -991,9 +986,7 @@ nir_schedule_get_scoreboard(nir_shader *shader,
|
|||||||
scoreboard->shader = shader;
|
scoreboard->shader = shader;
|
||||||
scoreboard->live_values = _mesa_pointer_set_create(scoreboard);
|
scoreboard->live_values = _mesa_pointer_set_create(scoreboard);
|
||||||
scoreboard->remaining_uses = _mesa_pointer_hash_table_create(scoreboard);
|
scoreboard->remaining_uses = _mesa_pointer_hash_table_create(scoreboard);
|
||||||
scoreboard->threshold = options->threshold;
|
scoreboard->options = options;
|
||||||
scoreboard->stages_with_shared_io_memory =
|
|
||||||
options->stages_with_shared_io_memory;
|
|
||||||
scoreboard->pressure = 0;
|
scoreboard->pressure = 0;
|
||||||
|
|
||||||
nir_foreach_function(function, shader) {
|
nir_foreach_function(function, shader) {
|
||||||
|
Reference in New Issue
Block a user