[Mesa-dev] [PATCH 0/8] Alternative to the NIR pass manager idea

Kenneth Graunke kenneth at whitecape.org
Tue Nov 3 00:31:14 PST 2015


Hello,

Here's my alternative suggestion to Jason's pass manager series.

First, it implements an OPT() macro in the i965 NIR backend, and
uses it for ~all passes.  (Other drivers are obviously free to do likewise!)
I chose to group up some operations (such as input lowering) which
technically use a few passes but are logically one operation.

Although these use GCC statement expressions, they're not extensively
tied to them, as suggested.  We only use them to allow putting OPT()
directly in if-conditions.  We could call it outside of an expression
and refer to this_progress instead - this is just a bit nicer.

Secondly, it adds missing nir_metadata_preserve calls in various
passes.  If accepted, I plan to mark these as Cc: mesa-stable.
Even if we go with Jason's idea, these patches should at least be
useful for that :)

Finally, it provides a simple mechanism for ensuring passes properly
call nir_metadata_preserve().  Before calling a pass, the OPT() macro
sets a new meaningless metadata flag on all impls.  If the pass calls
nir_metadata_preserve, this bogus flag will be cleared.  After the
pass, we assert that either !this_progress or the flag was cleared.

This works pretty well and allows us to preserve our function-style
pass interface.  It doesn't work for passes that return void, as we
allow passes to skip calling nir_metadata_preserve when not making
any changes at all.  But we should convert those to return progress
anyway.

Thoughts?  Flames?

--Ken



More information about the mesa-dev mailing list