[Mesa-dev] [PATCH 0/5] [RFC] Value range propagation for NIR

Connor Abbott cwabbott0 at gmail.com
Mon Jul 20 16:15:26 PDT 2015

On Tue, Jul 14, 2015 at 3:08 PM, Thomas Helland
<thomashelland90 at gmail.com> wrote:
> The deadline for GSoC is aproaching a bit faster than I'm
> comfortable with, so I need to get this out on the list
> for some review-action. It's not yet complete, but I think
> it's getting there. At least it should be possible to infer
> what I'm trying to do I think.
> I haven't yet gotten to testing this a whole lot, as I
> wanted to get some feedback before getting to lost with
> all the debugging. It compiles though, so that's nice.
> (apart from some . / -> blunders I got in there just before
> sending out the pathces).
> Things I know are a bit iffy, and that I need to look into,
> is the long citation from LLVM's SCCP at close-to-bottom of the pass.
> TLDR of that section is:
> Since we don't analyze blocks that are results of branching on
> instructions that are undefined the assumptions that the
> pass has made when we get to the end may be wrong.
> I have a sketch in my mind on how to do that though,
> so I don't think it should be that bad.
> I'm hoping to get a similar series on the list tomorrow
> for the loop analysis pass. I just need to figure out
> how to hook the pass up to the metadata system.
> When these two series are out I'll let them soak
> on the list for some comments while I go head-to-head with
> the loop unrolling.

FWIW, I'm working on something which will probably help you with loop
unrolling. A while back, Jason and I realized that our infrastructure
for moving pieces of control flow around was pretty inadequate. I'm
working on refactoring things so that we have an API that can take a
subset of a control flow list (think of it as like a series of
statements in GLSL), extract it, and then re-insert it somewhere else.
Patches should be coming soon. What you'll need on top is the ability
to copy that bit of control flow, so that you can extract the body of
the original loop before and after the limiting terminator, copy it
repeatedly, insert the copies, and then delete the original.

> Happy reviewing =)
> Thomas Helland (5):
>   nir/worklist: Split out the type-independent parts
>   nir: Add a worklist for SSA definitions
>   nir: Move nir_instr_get_dest_ssa_def to nir.c / nir.h
>   nir: Add a helper for iterating over blocks in a cf node
>   nir: Add a value range propagation pass
>  src/glsl/Makefile.sources           |    3 +
>  src/glsl/nir/nir.c                  |   28 +
>  src/glsl/nir/nir.h                  |    8 +
>  src/glsl/nir/nir_block_worklist.h   |  112 +++
>  src/glsl/nir/nir_live_variables.c   |    2 +-
>  src/glsl/nir/nir_opt_cse.c          |   20 -
>  src/glsl/nir/nir_opt_value_range.c  | 1330 +++++++++++++++++++++++++++++++++++
>  src/glsl/nir/nir_ssa_def_worklist.h |  100 +++
>  src/glsl/nir/nir_worklist.c         |   78 +-
>  src/glsl/nir/nir_worklist.h         |   44 +-
>  10 files changed, 1637 insertions(+), 88 deletions(-)
>  create mode 100644 src/glsl/nir/nir_block_worklist.h
>  create mode 100644 src/glsl/nir/nir_opt_value_range.c
>  create mode 100644 src/glsl/nir/nir_ssa_def_worklist.h
> --
> 2.4.5
> _______________________________________________
> 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