<p dir="ltr"><br>
On Sep 18, 2015 1:29 PM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br>
><br>
> On Friday, September 18, 2015 10:55:34 AM Jason Ekstrand wrote:<br>
> > Um, why? I'm sure you have some reason but I don't immediately see how a<br>
> > progress flag from lower_vec_to_movs is useful. Some of the others<br>
> > definitely are.<br>
> > --Jason<br>
><br>
> Sorry, I should have explained in at least one of the patches.<br>
><br>
> I'm hoping to create an OPT() macro, similar to what we do for i965<br>
> passes. It would:<br>
><br>
> 1. Run the pass.<br>
> 2. Call nir_validate_shader() if we actually made any progress.<br>
> 3. Optionally nir_print_shader() if we made any changes.<br>
> (i.e. let us do INTEL_DEBUG=optimizer but for NIR passes)<br>
><br>
> I need to know whether a pass made progress in order to decide whether<br>
> or not to dump the shader. I might want to see the code before and<br>
> after nir_lower_vec_to_movs().<br>
><br>
> Also, having some passes return 'bool' and some return 'void' is<br>
> awkward: I can't wrap void-return functions in the same sort of macro.</p>
<p dir="ltr">That makes sense. I think what I'd like to have is a data structure</p>
<p dir="ltr">nir_shader_pass {<br>
bool (*shader_func)(nir_shader *shader);<br>
bool (*impl_func)(nir_function_impl *impl);<br>
nir_metadata preserved;<br>
};</p>
<p dir="ltr">Then have one of these exported per pass instead of the actual function or functions. Then we could have a helper function that runs the pass similar to what the OPT macro would. It could even be smart and, if you don't provide a shader_func, it runs impl_func on each overload. Does that seem reasonable?<br>
--Jason<br>
</p>