diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2020-02-21 10:53:05 -0800 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-12 19:21:36 +0000 |
commit | bf432cd831c789c02f9474f836e3259f2a73abd3 (patch) | |
tree | 241ac2499665ff398263968893e1946e1d44338e /src/compiler/nir/nir.h | |
parent | d31a8ed8fd560fd71be10956d09987dc47f20a01 (diff) |
nir: Add pass to combine adjacent scoped memory barriers
SPIR-V generates very granular barriers, however HW and backends might
not necessarily take advantage of those. This pass provides a general
mechanism to combine such barriers.
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3224>
Diffstat (limited to 'src/compiler/nir/nir.h')
-rw-r--r-- | src/compiler/nir/nir.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index ec281ad5317..1fe0264cbe5 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4240,6 +4240,17 @@ bool nir_opt_algebraic_before_ffma(nir_shader *shader); bool nir_opt_algebraic_late(nir_shader *shader); bool nir_opt_constant_folding(nir_shader *shader); +/* Try to combine a and b into a. Return true if combination was possible, + * which will result in b being removed by the pass. Return false if + * combination wasn't possible. + */ +typedef bool (*nir_combine_memory_barrier_cb)( + nir_intrinsic_instr *a, nir_intrinsic_instr *b, void *data); + +bool nir_opt_combine_memory_barriers(nir_shader *shader, + nir_combine_memory_barrier_cb combine_cb, + void *data); + bool nir_opt_combine_stores(nir_shader *shader, nir_variable_mode modes); bool nir_copy_prop(nir_shader *shader); |