nir/scheduler: Add an option to specify what stages share memory for I/O

The scheduler has code to handle hardware that shares the same memory
for inputs and outputs. Seeing as the specific stages that need this is
probably hardware-dependent, this patch makes it a configurable option
instead of hard-coding it to everything but fragment shaders.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5561>
This commit is contained in:
Neil Roberts
2020-06-17 15:18:06 +02:00
parent 28e3209985
commit ed29b576cb
3 changed files with 43 additions and 12 deletions
+14 -1
View File
@@ -4579,7 +4579,20 @@ bool nir_opt_load_store_vectorize(nir_shader *shader, nir_variable_mode modes,
nir_should_vectorize_mem_func callback,
nir_variable_mode robust_modes);
void nir_schedule(nir_shader *shader, int threshold);
typedef struct nir_schedule_options {
/* On some hardware with some stages the inputs and outputs to the shader
* share the same memory. In that case scheduler needs to ensure that all
* output writes are scheduled after all of the input writes to avoid
* overwriting them. This is a bitmask of stages that need that.
*/
unsigned stages_with_shared_io_memory;
/* The approximate amount of register pressure at which point the scheduler
* will try to reduce register usage.
*/
int threshold;
} nir_schedule_options;
void nir_schedule(nir_shader *shader, const nir_schedule_options *options);
void nir_strip(nir_shader *shader);