[Mesa-dev] [PATCH 00/11] nir: Add a pass management framework
Kristian Høgsberg
krh at bitplanet.net
Wed Oct 28 14:58:07 PDT 2015
On Wed, Oct 28, 2015 at 2:34 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Wed, Oct 28, 2015 at 2:32 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>> This series adds a nir_pass datastructure and some helpers for managing
>> optimization and lowering passes. I've been meaning to get around to this
>> for some time. There are a couple of primary benifits to this:
>>
>> First, this gives us a central place to put things such as validating the
>> shader, printing it if it changes, etc. Right now, the i965 backend calls
>> nir_validate_shader after each pass. We would also like to add something
>> like we have in the i965 backend where it can be set to dump the IR to a
>> file after every pass that changess it.
>>
>> Mor importantly, though, it moves metadata out of the passes them selves
>> and into the runner. In the process of putting this series together, I
>> found at least 3 or 4 optimization passes that don't properly invalidate
>> metadata. By putting a metadata_preserved field in nir_pass and handling
>> metadata in the pass runner, we make it much less likely that a pass will
>> get this wrong. LLVM has a similar optimization pass architecture for
>> precicely this reason.
>>
>> As a nice little side-benifit, we no longer have to iterate over all of the
>> overloads with non-NULL impl pointers in each pass.
>
> Once again, git-send-email failed to send the last patch for whatever
> reason. The entire series can be found here:
>
> http://cgit.freedesktop.org/~jekstrand/mesa/log/?h=wip/nir-pass
Nice. Series,
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
>> Jason Ekstrand (11):
>> nir: Move nir_metadata.c to nir_pass.c
>> nir: Add a pass-running infastructure
>> nir: Unexpose _impl versions of copy_prop and dce
>> nir/alu_to_scalar: Use the nir_pass framework internally
>> nir/phis_to_scalar: Use the nir_pass framework internally
>> nir/lower_vars_to_ssa: Use the nir_pass framework internally
>> nir: Use the nir_pass framework internally for copy_prop, dce, and cse
>> nir/algebraic: Use the nir_pass framework internally
>> nir: Use the nir_pass framework internally for more passes
>> ir3: Use nir_pass for lower_if_else
>> nir: Expose nir_pass structures rather than functions for several
>> passes
>>
>> .../drivers/freedreno/ir3/ir3_compiler_nir.c | 28 +++--
>> src/gallium/drivers/freedreno/ir3/ir3_nir.h | 2 +-
>> .../drivers/freedreno/ir3/ir3_nir_lower_if_else.c | 22 ++--
>> src/gallium/drivers/vc4/vc4_program.c | 28 +++--
>> src/glsl/Makefile.sources | 2 +-
>> src/glsl/nir/nir.h | 57 ++++++----
>> src/glsl/nir/nir_algebraic.py | 39 +++----
>> src/glsl/nir/nir_lower_alu_to_scalar.c | 58 +++++++----
>> src/glsl/nir/nir_lower_phis_to_scalar.c | 27 ++---
>> src/glsl/nir/nir_lower_vars_to_ssa.c | 18 ++--
>> src/glsl/nir/nir_metadata.c | 54 ----------
>> src/glsl/nir/nir_opt_constant_folding.c | 23 ++--
>> src/glsl/nir/nir_opt_copy_propagate.c | 21 ++--
>> src/glsl/nir/nir_opt_cse.c | 24 ++---
>> src/glsl/nir/nir_opt_dce.c | 24 ++---
>> src/glsl/nir/nir_opt_dead_cf.c | 25 ++---
>> src/glsl/nir/nir_opt_peephole_select.c | 22 ++--
>> src/glsl/nir/nir_opt_remove_phis.c | 19 ++--
>> src/glsl/nir/nir_opt_undef.c | 20 ++--
>> src/glsl/nir/nir_pass.c | 116 +++++++++++++++++++++
>> src/mesa/drivers/dri/i965/brw_nir.c | 67 ++++--------
>> 21 files changed, 328 insertions(+), 368 deletions(-)
>> delete mode 100644 src/glsl/nir/nir_metadata.c
>> create mode 100644 src/glsl/nir/nir_pass.c
>>
>> --
>> 2.5.0.400.gff86faf
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list