<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 16, 2016 at 5:36 PM, Connor Abbott <span dir="ltr"><<a href="mailto:cwabbott0@gmail.com" target="_blank">cwabbott0@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Sep 16, 2016 at 6:25 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> On Thu, Sep 15, 2016 at 12:03 AM, Timothy Arceri<br>
> <<a href="mailto:timothy.arceri@collabora.com">timothy.arceri@collabora.com</a>> wrote:<br>
>><br>
>> From: Thomas Helland <<a href="mailto:thomashelland90@gmail.com">thomashelland90@gmail.com</a>><br>
>><br>
>> This pass detects induction variables and calculates the<br>
>> trip count of loops to be used for loop unrolling.<br>
>><br>
>> I've removed support for float induction values for now, for the<br>
>> simple reason that they don't appear in my shader-db collection,<br>
>> and so I don't see it as common enough that we want to pollute the<br>
>> pass with this in the initial version.<br>
>><br>
>> V2: Rebase, adapt to removal of function overloads<br>
>><br>
>> V3: (Timothy Arceri)<br>
>>Â - don't try to find trip count if loop terminator conditional is a phi<br>
>>Â - fix trip count for do-while loops<br>
>>Â - replace conditional type != alu assert with return<br>
>>Â - disable unrolling of loops with continues<br>
>>Â - multiple fixes to memory allocation, stop leaking and don't destroy<br>
>>Â Â structs we want to use for unrolling.<br>
>>Â - fix iteration count bugs when induction var not on RHS of condition<br>
>>Â - add FIXME for && conditions<br>
>>Â - calculate trip count for unsigned induction/limit vars<br>
>><br>
>> V4:<br>
>> - count instructions in a loop<br>
>> - set the limiting_terminator even if we can't find the trip count for<br>
>>Â all terminators. This is needed for complex unrolling where we handle<br>
>>Â 2 terminators and the trip count is unknown for one of them.<br>
>> - restruct structs so we don't keep information not required after<br>
>>Â analysis and remove dead fields.<br>
>> - force unrolling in some cases as per the rules in the GLSL IR pass<br>
>> ---<br>
>> src/compiler/Makefile.sources    |  2 +<br>
>> src/compiler/nir/nir.h       |  36 +-<br>
>>Â src/compiler/nir/nir_loop_<wbr>analyze.c | 1012<br>
>> ++++++++++++++++++++++++++++++<wbr>+++++<br>
>> src/compiler/nir/nir_metadata.<wbr>c   |  8 +-<br>
>>Â 4 files changed, 1056 insertions(+), 2 deletions(-)<br>
>>Â create mode 100644 src/compiler/nir/nir_loop_<wbr>analyze.c<br>
>><br>
>> diff --git a/src/compiler/Makefile.<wbr>sources b/src/compiler/Makefile.<wbr>sources<br>
>> index f5b4f9c..7ed26a9 100644<br>
>> --- a/src/compiler/Makefile.<wbr>sources<br>
>> +++ b/src/compiler/Makefile.<wbr>sources<br>
>> @@ -190,6 +190,8 @@ NIR_FILES = \<br>
>>Â Â Â Â Â nir/nir_intrinsics.c \<br>
>>Â Â Â Â Â nir/nir_intrinsics.h \<br>
>>Â Â Â Â Â nir/nir_liveness.c \<br>
>> +Â Â Â Â nir/nir_loop_analyze.c \<br>
>> +Â Â Â Â nir/nir_loop_analyze.h \<br>
>>Â Â Â Â Â nir/nir_lower_alu_to_scalar.c \<br>
>>Â Â Â Â Â nir/nir_lower_atomics.c \<br>
>>Â Â Â Â Â nir/nir_lower_bitmap.c \<br>
>> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
>> index ff7c422..49e8cd8 100644<br>
>> --- a/src/compiler/nir/nir.h<br>
>> +++ b/src/compiler/nir/nir.h<br>
>> @@ -1549,9 +1549,36 @@ nir_if_last_else_node(nir_if *if_stmt)<br>
>>Â }<br>
>><br>
>>Â typedef struct {<br>
>> +Â Â nir_if *nif;<br>
>> +<br>
>> +Â Â nir_instr *conditional_instr;<br>
>> +<br>
>> +Â Â struct list_head loop_terminator_link;<br>
>> +} nir_loop_terminator;<br>
>> +<br>
>> +typedef struct {<br>
>> +Â Â /* Number of instructions in the loop */<br>
>> +Â Â unsigned num_instructions;<br>
>> +<br>
>> +Â Â /* How many times the loop is run (if known) */<br>
>> +Â Â unsigned trip_count;<br>
>> +Â Â bool is_trip_count_known;<br>
><br>
><br>
> We could use 0 or -1 to indicate "I don't know trip count" instead of an<br>
> extra boolean. Not sure that it matters much.<br>
><br>
>><br>
>> +<br>
>> +Â Â /* Unroll the loop regardless of its size */<br>
>> +Â Â bool force_unroll;<br>
><br>
><br>
> It seems a bit odd to have this decide to force-unroll. This is an analysis<br>
> pass, not a "make decisions" pass.<br>
><br>
>><br>
>> +<br>
>> +Â Â nir_loop_terminator *limiting_terminator;<br>
>> +<br>
>> +Â Â /* A list of loop_terminators terminating this loop. */<br>
>> +Â Â struct list_head loop_terminator_list;<br>
>> +} nir_loop_info;<br>
>> +<br>
>> +typedef struct {<br>
>>Â Â Â nir_cf_node cf_node;<br>
>><br>
>>Â Â Â struct exec_list body; /** < list of nir_cf_node */<br>
>> +<br>
>> +Â Â nir_loop_info *info;<br>
>>Â } nir_loop;<br>
>><br>
>>Â static inline nir_cf_node *<br>
>> @@ -1576,6 +1603,7 @@ typedef enum {<br>
>>Â Â Â nir_metadata_dominance = 0x2,<br>
>>Â Â Â nir_metadata_live_ssa_defs = 0x4,<br>
>>Â Â Â nir_metadata_not_properly_<wbr>reset = 0x8,<br>
>> +Â Â nir_metadata_loop_analysis = 0x16,<br>
>>Â } nir_metadata;<br>
>><br>
>>Â typedef struct {<br>
>> @@ -1758,6 +1786,8 @@ typedef struct nir_shader_compiler_options {<br>
>>Â Â Â * information must be inferred from the list of input nir_variables.<br>
>>Â Â Â */<br>
>>Â Â Â bool use_interpolated_input_<wbr>intrinsics;<br>
>> +<br>
>> +Â Â unsigned max_unroll_iterations;<br>
>>Â } nir_shader_compiler_options;<br>
>><br>
>>Â typedef struct nir_shader_info {<br>
>> @@ -1962,7 +1992,7 @@ nir_loop *nir_loop_create(nir_shader *shader);<br>
>>Â nir_function_impl *nir_cf_node_get_function(nir_<wbr>cf_node *node);<br>
>><br>
>>Â /** requests that the given pieces of metadata be generated */<br>
>> -void nir_metadata_require(nir_<wbr>function_impl *impl, nir_metadata<br>
>> required);<br>
>> +void nir_metadata_require(nir_<wbr>function_impl *impl, nir_metadata required,<br>
>> ...);<br>
>>Â /** dirties all but the preserved metadata */<br>
>>Â void nir_metadata_preserve(nir_<wbr>function_impl *impl, nir_metadata<br>
>> preserved);<br>
>><br>
>> @@ -2559,6 +2589,10 @@ void nir_lower_double_pack(nir_<wbr>shader *shader);<br>
>>Â bool nir_normalize_cubemap_coords(<wbr>nir_shader *shader);<br>
>><br>
>>Â void nir_live_ssa_defs_impl(nir_<wbr>function_impl *impl);<br>
>> +<br>
>> +void nir_loop_analyze_impl(nir_<wbr>function_impl *impl,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â nir_variable_mode indirect_mask);<br>
>> +<br>
>>Â bool nir_ssa_defs_interfere(nir_<wbr>ssa_def *a, nir_ssa_def *b);<br>
>><br>
>>Â void nir_convert_to_ssa_impl(nir_<wbr>function_impl *impl);<br>
>> diff --git a/src/compiler/nir/nir_loop_<wbr>analyze.c<br>
>> b/src/compiler/nir/nir_loop_<wbr>analyze.c<br>
>> new file mode 100644<br>
>> index 0000000..6bea9e5<br>
>> --- /dev/null<br>
>> +++ b/src/compiler/nir/nir_loop_<wbr>analyze.c<br>
>> @@ -0,0 +1,1012 @@<br>
>> +/*<br>
>> + * Copyright © 2015 Thomas Helland<br>
>> + *<br>
>> + * Permission is hereby granted, free of charge, to any person obtaining<br>
>> a<br>
>> + * copy of this software and associated documentation files (the<br>
>> "Software"),<br>
>> + * to deal in the Software without restriction, including without<br>
>> limitation<br>
>> + * the rights to use, copy, modify, merge, publish, distribute,<br>
>> sublicense,<br>
>> + * and/or sell copies of the Software, and to permit persons to whom the<br>
>> + * Software is furnished to do so, subject to the following conditions:<br>
>> + *<br>
>> + * The above copyright notice and this permission notice (including the<br>
>> next<br>
>> + * paragraph) shall be included in all copies or substantial portions of<br>
>> the<br>
>> + * Software.<br>
>> + *<br>
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,<br>
>> EXPRESS OR<br>
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF<br>
>> MERCHANTABILITY,<br>
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT<br>
>> SHALL<br>
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
>> OTHER<br>
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
>> ARISING<br>
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
>> DEALINGS<br>
>> + * IN THE SOFTWARE.<br>
>> + */<br>
>> +<br>
>> +#include "nir.h"<br>
>> +<br>
>> +typedef enum {<br>
>> +Â Â undefined,<br>
>> +Â Â invariant,<br>
>> +Â Â basic_induction<br>
>> +} nir_loop_variable_type;<br>
>> +<br>
>> +typedef struct {<br>
>> +Â Â /* The ssa_def associated with this info */<br>
>> +Â Â nir_ssa_def *def;<br>
>> +<br>
>> +Â Â /* The type of this ssa_def */<br>
>> +Â Â nir_loop_variable_type type;<br>
>> +<br>
>> +Â Â /* If the ssa-def is constant */<br>
>> +Â Â bool is_constant;<br>
>> +<br>
>> +Â Â bool in_conditional_block;<br>
>> +<br>
>> +Â Â bool in_nested_loop;<br>
>> +} nir_loop_variable;<br>
>> +<br>
>> +typedef struct {<br>
>> +Â Â nir_op alu_op;Â Â Â Â Â Â Â Â Â Â Â Â Â Â /* The type of alu-operation<br>
>> */<br>
>> +Â Â nir_loop_variable *alu_def;Â Â Â Â Â Â Â /* The def of the<br>
>> alu-operation */<br>
>> +Â Â nir_loop_variable *invariant;Â Â Â Â Â Â /* The invariant alu-operand<br>
>> */<br>
>> +Â Â nir_loop_variable *phi;Â Â Â Â Â Â Â Â Â /* The other alu-operand<br>
>> */<br>
>> +Â Â nir_loop_variable *def_outside_loop;Â Â Â /* The phi-src outside the<br>
>> loop */<br>
>> +} nir_basic_induction_var;<br>
>> +<br>
>> +typedef struct {<br>
>> +Â Â /* A link for the work list */<br>
>> +Â Â struct list_head process_link;<br>
>> +<br>
>> +Â Â bool in_loop;<br>
>> +<br>
>> +Â Â nir_loop_variable *nir_loop_var;<br>
>> +} loop_variable;<br>
>> +<br>
>> +typedef struct {<br>
>> +Â Â bool contains_break;<br>
>> +Â Â bool contains_continue;<br>
>> +} loop_jumps;<br>
>> +<br>
>> +typedef struct {<br>
>> +Â Â /* The loop we store information for */<br>
>> +Â Â nir_loop *loop;<br>
>> +<br>
>> +Â Â /* Loop_variable for all ssa_defs in function */<br>
>> +Â Â loop_variable *loop_vars;<br>
>> +<br>
>> +Â Â /* Loop_variable for all ssa_defs in function */<br>
>> +Â Â nir_loop_variable *nir_loop_vars;<br>
><br>
><br>
> Why are these two separate things? You have two arrays both indexed by<br>
> nir_ssa_def::index and both called loop_vars and one has a pointer to the<br>
> other. Can we just make 1 array?<br>
><br>
>><br>
>> +<br>
>> +Â Â /* A list of the loop_vars to analyze */<br>
>> +Â Â struct list_head process_list;<br>
>> +<br>
>> +Â Â nir_loop_info *info;<br>
>> +<br>
>> +Â Â nir_variable_mode indirect_mask;<br>
>> +<br>
>> +Â Â struct hash_table *var_to_basic_ind;<br>
><br>
><br>
> Also, this seems like an unneeded level of indirection. Just put a pointer<br>
> in loop_variable that points to the induction var struct.<br>
><br>
>><br>
>> +} loop_info_state;<br>
>> +<br>
>> +static loop_variable *<br>
>> +get_loop_var(nir_ssa_def *value, loop_info_state *state)<br>
>> +{<br>
>> +Â Â return &(state->loop_vars[value-><wbr>index]);<br>
>> +}<br>
>> +<br>
>> +static nir_loop_variable *<br>
>> +get_nir_loop_var(nir_ssa_def *value, loop_info_state *state)<br>
>> +{<br>
>> +Â Â return &(state->nir_loop_vars[value-><wbr>index]);<br>
>> +}<br>
>> +<br>
>> +typedef struct {<br>
>> +Â Â loop_info_state *state;<br>
>> +Â Â bool mark_nested;<br>
>> +Â Â bool mark_in_conditional;<br>
>> +} init_loop_state;<br>
>> +<br>
>> +static bool<br>
>> +init_loop_def(nir_ssa_def *def, void *void_init_loop_state)<br>
>> +{<br>
>> +Â Â init_loop_state *loop_init_state = void_init_loop_state;<br>
>> +Â Â loop_variable *var = get_loop_var(def, loop_init_state->state);<br>
>> +<br>
>> +Â Â /* Add to the tail of the list. That way we start at the beginning of<br>
>> the<br>
>> +Â Â * defs in the loop instead of the end when walking the list. This<br>
>> means<br>
>> +Â Â * less recursive calls. Only add defs that are not in nested loops or<br>
>> +Â Â * conditional blocks.<br>
>> +Â Â */<br>
>> +Â Â if (!(loop_init_state->mark_in_<wbr>conditional ||<br>
>> +Â Â Â Â Â loop_init_state->mark_nested))<br>
>> +Â Â Â LIST_ADDTAIL(&(var->process_<wbr>link),<br>
>> +Â Â Â Â Â Â Â Â Â Â &(loop_init_state->state-><wbr>process_list));<br>
><br>
><br>
> I have a mild preference for the lower-case variants. As I recall, they are<br>
> more for legacy.<br>
><br>
>><br>
>> +<br>
>> +Â Â if (loop_init_state->mark_in_<wbr>conditional)<br>
>> +Â Â Â var->nir_loop_var->in_<wbr>conditional_block = true;<br>
>> +<br>
>> +Â Â if (loop_init_state->mark_nested)<br>
>> +Â Â Â var->nir_loop_var->in_nested_<wbr>loop = true;<br>
>> +<br>
>> +Â Â var->in_loop = true;<br>
>> +<br>
>> +Â Â return true;<br>
>> +}<br>
>> +<br>
>> +static bool<br>
>> +init_loop_block(nir_block *block, void *void_init_loop_state)<br>
><br>
><br>
> Can we make this function take the actual parameters and limit<br>
> init_loop_state to being the thing we use for init_loop_def. Passing piles<br>
> of pointers through made sense when Thomas originally wrote it but now that<br>
> we have better loop iteration macros, we can just pass arguments.<br>
><br>
>><br>
>> +{<br>
>> +Â Â init_loop_state *loop_init_state = void_init_loop_state;<br>
>> +<br>
>> +Â Â nir_foreach_instr(instr, block)<br>
>> +Â Â Â nir_foreach_ssa_def(instr, init_loop_def, loop_init_state);<br>
>> +<br>
>> +Â Â return true;<br>
>> +}<br>
>> +<br>
>> +static inline bool<br>
>> +is_var_alu(loop_variable *var)<br>
>> +{<br>
>> +Â Â return (var->nir_loop_var->def-><wbr>parent_instr->type ==<br>
>> nir_instr_type_alu);<br>
>> +}<br>
>> +<br>
>> +static inline bool<br>
>> +is_var_phi(loop_variable *var)<br>
>> +{<br>
>> +Â Â return (var->nir_loop_var->def-><wbr>parent_instr->type ==<br>
>> nir_instr_type_phi);<br>
>> +}<br>
>> +<br>
>> +static inline bool<br>
>> +is_ssa_def_invariant(nir_ssa_<wbr>def *def, loop_info_state *state)<br>
>> +{<br>
>> +Â Â loop_variable *var = get_loop_var(def, state);<br>
>> +<br>
>> +Â Â if (var->nir_loop_var->type == invariant)<br>
>> +Â Â Â return true;<br>
>> +<br>
>> +Â Â if (!var->in_loop) {<br>
>> +Â Â Â var->nir_loop_var->type = invariant;<br>
>> +Â Â Â return true;<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â if (var->nir_loop_var->type == basic_induction)<br>
>> +Â Â Â return false;<br>
>> +<br>
>> +Â Â if (is_var_alu(var)) {<br>
>> +Â Â Â nir_alu_instr *alu = nir_instr_as_alu(def->parent_<wbr>instr);<br>
>> +<br>
>> +Â Â Â for (unsigned i = 0; i < nir_op_infos[alu->op].num_<wbr>inputs; i++) {<br>
>> +Â Â Â Â Â if (!is_ssa_def_invariant(alu-><wbr>src[i].src.ssa, state))<br>
>> +Â Â Â Â Â Â return false;<br>
>> +Â Â Â }<br>
>> +Â Â Â var->nir_loop_var->type = invariant;<br>
>> +Â Â Â return true;<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â /* Phis shouldn't be invariant except if one operand is invariant, and<br>
>> the<br>
>> +Â Â * other is the phi itself. These should be removed by<br>
>> opt_remove_phis.<br>
>> +Â Â * load_consts are already set to invariant and constant during init,<br>
>> +Â Â * and so should return earlier. Remaining op_codes are set undefined.<br>
>> +Â Â */<br>
>> +Â Â var->nir_loop_var->type = undefined;<br>
>> +Â Â return false;<br>
>> +}<br>
>> +<br>
>> +static void<br>
>> +compute_invariance_<wbr>information(loop_info_state *state)<br>
>> +{<br>
>> +Â Â /* An expression is invariant in a loop L if:<br>
>> +Â Â *Â (base cases)<br>
>> +  *  – it’s a constant<br>
>> +  *  – it’s a variable use, all of whose single defs are outside of L<br>
>> +Â Â *Â (inductive cases)<br>
>> +  *  – it’s a pure computation all of whose args are loop invariant<br>
>> +  *  – it’s a variable use whose single reaching def, and the<br>
>> +Â Â *Â Â Â rhs of that def is loop-invariant<br>
>> +Â Â */<br>
>> +Â Â bool changes;<br>
>> +<br>
>> +Â Â do {<br>
>> +Â Â Â changes = false;<br>
>> +Â Â Â list_for_each_entry_safe(loop_<wbr>variable, var,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &state->process_list, process_link) {<br>
>> +<br>
>> +Â Â Â Â Â if (var->nir_loop_var->in_<wbr>conditional_block ||<br>
>> +Â Â Â Â Â Â Â var->nir_loop_var->in_nested_<wbr>loop) {<br>
>> +Â Â Â Â Â Â LIST_DEL(&var->process_link);<br>
>> +Â Â Â Â Â Â continue;<br>
>> +Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â if (is_ssa_def_invariant(var-><wbr>nir_loop_var->def, state)) {<br>
>> +Â Â Â Â Â Â LIST_DEL(&var->process_link);<br>
>> +Â Â Â Â Â Â changes = true;<br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â }<br>
>> +Â Â } while (changes);<br>
>> +}<br>
>> +<br>
>> +static inline bool<br>
>> +is_var_basic_induction_var(<wbr>loop_variable *var, loop_info_state *state)<br>
>> +{<br>
>> +Â Â if (var->nir_loop_var->type == basic_induction)<br>
>> +Â Â Â return true;<br>
>> +<br>
>> +Â Â /* We are only interested in checking phi's for the basic induction<br>
>> +Â Â * variable case as its simple to detect. All basic induction<br>
>> variables<br>
>> +Â Â * have a phi node<br>
>> +Â Â */<br>
>> +Â Â if (!is_var_phi(var))<br>
>> +Â Â Â return false;<br>
>> +<br>
>> +Â Â nir_phi_instr *phi =<br>
>> nir_instr_as_phi(var->nir_<wbr>loop_var->def->parent_instr);<br>
>> +<br>
>> +Â Â nir_basic_induction_var *biv = rzalloc(state,<br>
>> nir_basic_induction_var);<br>
>> +Â Â biv->phi = var->nir_loop_var;<br>
>> +<br>
>> +Â Â nir_foreach_phi_src(src, phi) {<br>
>> +Â Â Â loop_variable *src_var = get_loop_var(src->src.ssa, state);<br>
>> +<br>
>> +Â Â Â /* If one of the sources is in a conditional or nested block then<br>
>> panic.<br>
>> +Â Â Â Â */<br>
>> +Â Â Â if (src_var->nir_loop_var->in_<wbr>conditional_block ||<br>
>> +Â Â Â Â Â src_var->nir_loop_var->in_<wbr>nested_loop)<br>
>> +Â Â Â Â Â break;<br>
>> +<br>
>> +Â Â Â if (!src_var->in_loop)<br>
>> +Â Â Â Â Â biv->def_outside_loop = src_var->nir_loop_var;<br>
><br>
><br>
> Could we assert biv->def_outside_loop == NULL<br>
><br>
>><br>
>> +<br>
>> +Â Â Â if (src_var->in_loop && is_var_alu(src_var)) {<br>
>> +Â Â Â Â Â nir_alu_instr *alu =<br>
>> +Â Â Â Â Â Â Â nir_instr_as_alu(src_var->nir_<wbr>loop_var->def->parent_instr);<br>
>> +<br>
>> +Â Â Â Â Â switch (alu->op) {<br>
>> +Â Â Â Â Â case nir_op_fadd:Â Â case nir_op_iadd:Â Â case<br>
>> nir_op_uadd_carry:<br>
>> +Â Â Â Â Â case nir_op_fsub:Â Â case nir_op_isub:Â Â case<br>
>> nir_op_usub_borrow:<br>
>> +Â Â Â Â Â case nir_op_fmul:Â Â case nir_op_imul:Â Â case nir_op_umul_high:<br>
>> +Â Â Â Â Â case nir_op_fdiv:Â Â case nir_op_idiv:Â Â case nir_op_udiv:<br>
><br>
><br>
> Is there a reason why this is an explicit list and not simply<br>
> "nir_op_infos[alu->op].num_<wbr>inputs == 2"?<br>
><br>
>><br>
>> +<br>
>> +Â Â Â Â Â Â biv->alu_def = src_var->nir_loop_var;<br>
>> +<br>
>> +Â Â Â Â Â Â for (unsigned i = 0; i < 2; i++) {<br>
>> +Â Â Â Â Â Â Â Â /* Is one of the operands invariant, and the other the phi<br>
>> */<br>
>> +Â Â Â Â Â Â Â Â if (is_ssa_def_invariant(alu-><wbr>src[i].src.ssa, state) &&<br>
>> +Â Â Â Â Â Â Â Â Â Â alu->src[1-i].src.ssa->index == phi->dest.ssa.index)<br>
>> +Â Â Â Â Â Â Â Â Â biv->invariant = get_nir_loop_var(alu->src[i].<wbr>src.ssa,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â state);<br>
>> +Â Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â Â biv->alu_op = alu->op;<br>
>> +Â Â Â Â Â Â break;<br>
>> +Â Â Â Â Â default:<br>
>> +Â Â Â Â Â Â break;<br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â }<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â if (biv->alu_def && biv->def_outside_loop && biv->invariant &&<br>
>> biv->phi) {<br>
>> +Â Â Â biv->alu_def->type = basic_induction;<br>
>> +Â Â Â biv->phi->type = basic_induction;<br>
>> +Â Â Â _mesa_hash_table_insert(state-<wbr>>var_to_basic_ind, biv->alu_def,<br>
>> biv);<br>
>> +Â Â Â _mesa_hash_table_insert(state-<wbr>>var_to_basic_ind, biv->phi, biv);<br>
>> +Â Â Â return true;<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â /* The requirements for a basic induction variable are not fulfilled<br>
>> */<br>
>> +Â Â ralloc_free(biv);<br>
>> +Â Â return false;<br>
>> +}<br>
>> +<br>
>> +static bool<br>
>> +compute_induction_<wbr>information(loop_info_state *state)<br>
>> +{<br>
>> +Â Â bool changes;<br>
>> +Â Â bool found_induction_var = false;<br>
>> +<br>
>> +Â Â do {<br>
>> +Â Â Â changes = false;<br>
>> +Â Â Â list_for_each_entry_safe(loop_<wbr>variable, var,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &state->process_list, process_link) {<br>
>> +<br>
>> +Â Â Â Â Â /* It can't be an induction variable if it is invariant. We<br>
>> don't<br>
>> +Â Â Â Â Â * want to deal with things in nested loops or conditionals.<br>
>> +Â Â Â Â Â */<br>
>> +Â Â Â Â Â if (var->nir_loop_var->type == invariant ||<br>
>> +Â Â Â Â Â Â Â var->nir_loop_var->in_<wbr>conditional_block ||<br>
>> +Â Â Â Â Â Â Â var->nir_loop_var->in_nested_<wbr>loop) {<br>
>> +Â Â Â Â Â Â LIST_DEL(&(var->process_link))<wbr>;<br>
>> +Â Â Â Â Â Â continue;<br>
>> +Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â if (is_var_basic_induction_var(<wbr>var, state)) {<br>
>> +Â Â Â Â Â Â /* If a phi is marked basic_ind we also mark the alu_def<br>
>> basic_ind<br>
>> +Â Â Â Â Â Â Â * at the same time. It will then be detected as basic_ind<br>
>> here,<br>
>> +Â Â Â Â Â Â Â * on the second passing, and be removed from the list.<br>
>> +Â Â Â Â Â Â Â */<br>
>> +Â Â Â Â Â Â LIST_DEL(&(var->process_link))<wbr>;<br>
>> +Â Â Â Â Â Â changes = true;<br>
>> +Â Â Â Â Â Â found_induction_var = true;<br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â }<br>
>> +Â Â } while (changes);<br>
>> +<br>
>> +Â Â return found_induction_var;<br>
>> +}<br>
>> +<br>
>> +static bool<br>
>> +initialize_ssa_def(nir_ssa_<wbr>def *def, void *void_state)<br>
>> +{<br>
>> +Â Â loop_info_state *state = void_state;<br>
>> +Â Â loop_variable *var = get_loop_var(def, state);<br>
>> +<br>
>> +Â Â var->nir_loop_var = get_nir_loop_var(def, state);<br>
>> +<br>
>> +Â Â var->in_loop = false;<br>
>> +Â Â var->nir_loop_var->def = def;<br>
>> +<br>
>> +Â Â if (def->parent_instr->type == nir_instr_type_load_const) {<br>
>> +Â Â Â var->nir_loop_var->type = invariant;<br>
>> +Â Â Â var->nir_loop_var->is_constant = true;<br>
>> +Â Â } else {<br>
>> +Â Â Â var->nir_loop_var->type = undefined;<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return true;<br>
>> +}<br>
>> +<br>
>> +static bool<br>
>> +foreach_cf_node_ex_loop(nir_<wbr>cf_node *node, void *state)<br>
><br>
><br>
> There's no good reason for this to be a void *; it just leads to extra<br>
> casting. Also, this function could use a better name. Maybe<br>
> cf_node_find_loop_jumps?<br>
><br>
>><br>
>> +{<br>
>> +Â Â nir_block *block;<br>
>> +<br>
>> +Â Â switch (node->type) {<br>
>> +Â Â case nir_cf_node_block:<br>
>> +Â Â Â block = nir_cf_node_as_block(node);<br>
>> +Â Â Â nir_foreach_instr(instr, block) {<br>
><br>
><br>
> Jumps are always the last instruction in a block. There's no sense in<br>
> walking all of them just to find the jump. Use nir_block_last_instr()<br>
> instead.<br>
><br>
>><br>
>> +Â Â Â Â Â if (instr->type == nir_instr_type_jump) {<br>
>> +Â Â Â Â Â Â if (nir_instr_as_jump(instr)-><wbr>type == nir_jump_break) {<br>
>> +Â Â Â Â Â Â Â Â ((loop_jumps *) state)->contains_break = true;<br>
>> +Â Â Â Â Â Â } else if (nir_instr_as_jump(instr)-><wbr>type ==<br>
>> nir_jump_continue) {<br>
>> +Â Â Â Â Â Â Â Â ((loop_jumps *) state)->contains_continue = true;<br>
>> +Â Â Â Â Â Â }<br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â }<br>
>> +Â Â Â return true;<br>
>> +<br>
>> +Â Â case nir_cf_node_if: {<br>
>> +Â Â Â nir_if *if_stmt = nir_cf_node_as_if(node);<br>
>> +<br>
>> +Â Â Â foreach_list_typed_safe(nir_<wbr>cf_node, node, node,<br>
>> &if_stmt->then_list)<br>
>> +Â Â Â Â Â if (!foreach_cf_node_ex_loop(<wbr>node, state))<br>
>> +Â Â Â Â Â Â return false;<br>
>> +<br>
>> +Â Â Â foreach_list_typed_safe(nir_<wbr>cf_node, node, node,<br>
>> &if_stmt->else_list)<br>
>> +Â Â Â Â Â if (!foreach_cf_node_ex_loop(<wbr>node, state))<br>
>> +Â Â Â Â Â Â return false;<br>
>> +<br>
>> +Â Â Â break;<br>
>> +Â Â }<br>
><br>
><br>
> Maybe add an explicit case for nir_cf_node_loop with a comment that we don't<br>
> care about inner loops.<br>
><br>
>><br>
>> +<br>
>> +Â Â default:<br>
>> +Â Â Â break;<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return false;<br>
>> +}<br>
>> +<br>
>> +static bool<br>
>> +is_trivial_loop_terminator(<wbr>nir_if *nif)<br>
>> +{<br>
>> +Â Â /* If there is stuff in the else-block that means that this is not a<br>
>> +Â Â * simple break on true if-statement and so we bail<br>
>> +Â Â */<br>
>> +Â Â foreach_list_typed_safe(nir_<wbr>cf_node, node, node, &nif->else_list)<br>
>> +Â Â Â if (node->type == nir_cf_node_block)<br>
>> +Â Â Â Â Â nir_foreach_instr(instr, nir_cf_node_as_block(node))<br>
>> +Â Â Â Â Â Â return false;<br>
><br>
><br>
> How about "if (!exec_list_empty(&nif->else_<wbr>list)) return false;"? That<br>
> seems far simpler.<br>
<br>
</div></div>That won't work, since cf lists are never empty. I think the intent<br>
was to check that the else branch consists of one empty basic block,<br>
in which case it's broken -- it could have just a loop, for example,<br>
and we wouldn't return false. I think what you want to do is get the<br>
first node, cast it to a basic block, bail if it has any instructions,<br>
and then bail if it doesn't equal the last node.<br></blockquote><div><br></div><div>You are correct, sir. That is what I meant.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
><br>
>><br>
>> +<br>
>> +Â Â nir_cf_node *first_then = nir_if_first_then_node(nif);<br>
>> +Â Â nir_block *first_then_block = nir_cf_node_as_block(first_<wbr>then);<br>
>> +Â Â nir_instr *first_instr = nir_block_first_instr(first_<wbr>then_block);<br>
>> +<br>
>> +Â Â if (first_instr && first_instr->type == nir_instr_type_jump &&<br>
>> +Â Â Â Â nir_instr_as_jump(first_instr)<wbr>->type == nir_jump_break) {<br>
>> +Â Â Â return true;<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return false;<br>
>> +}<br>
>> +<br>
>> +static bool<br>
>> +find_loop_terminators(loop_<wbr>info_state *state)<br>
>> +{<br>
>> +Â Â bool success = false;<br>
>> +Â Â foreach_list_typed_safe(nir_<wbr>cf_node, node, node, &state->loop->body) {<br>
>> +Â Â Â if (node->type == nir_cf_node_if) {<br>
>> +Â Â Â Â Â nir_if *nif = nir_cf_node_as_if(node);<br>
>> +<br>
>> +Â Â Â Â Â /* Don't check the nested loops if there are breaks */<br>
>> +Â Â Â Â Â loop_jumps lj;<br>
>> +Â Â Â Â Â lj.contains_break = false;<br>
>> +Â Â Â Â Â lj.contains_continue = false;<br>
>> +<br>
>> +Â Â Â Â Â foreach_cf_node_ex_loop(&nif-><wbr>cf_node, &lj);<br>
>> +<br>
>> +Â Â Â Â Â if (lj.contains_continue)<br>
>> +Â Â Â Â Â Â return false;<br>
>> +<br>
>> +Â Â Â Â Â if (!lj.contains_break)<br>
>> +Â Â Â Â Â Â continue;<br>
>> +<br>
>> +Â Â Â Â Â /* If there is a break then we should find a terminator. If we<br>
>> can<br>
>> +Â Â Â Â Â * not find a loop terminator, but there is a break-statement<br>
>> then<br>
>> +Â Â Â Â Â * we should return false so that we do not try to find<br>
>> trip-count<br>
>> +Â Â Â Â Â */<br>
>> +Â Â Â Â Â if (!is_trivial_loop_terminator(<wbr>nif))<br>
>> +Â Â Â Â Â Â return false;<br>
>> +<br>
>> +Â Â Â Â Â if (nif->condition.ssa->parent_<wbr>instr->type ==<br>
>> nir_instr_type_phi)<br>
>> +Â Â Â Â Â Â return false;<br>
>> +<br>
>> +Â Â Â Â Â nir_loop_terminator *terminator =<br>
>> +Â Â Â Â Â Â rzalloc(state->info, nir_loop_terminator);<br>
>> +<br>
>> +Â Â Â Â Â list_add(&terminator->loop_<wbr>terminator_link,<br>
>> +Â Â Â Â Â Â Â Â Â &state->info->loop_terminator_<wbr>list);<br>
>> +<br>
>> +Â Â Â Â Â terminator->nif = nif;<br>
>> +Â Â Â Â Â terminator->conditional_instr =<br>
>> nif->condition.ssa->parent_<wbr>instr;<br>
>> +<br>
>> +Â Â Â Â Â success = true;<br>
>> +Â Â Â }<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return success;<br>
>> +}<br>
>> +<br>
>> +static nir_basic_induction_var *<br>
>> +get_basic_ind_var_for_loop_<wbr>var(loop_variable *var, loop_info_state<br>
>> *state)<br>
>> +{<br>
>> +Â Â assert(var->nir_loop_var->type == basic_induction);<br>
>> +<br>
>> +Â Â struct hash_entry *entry =<br>
>> +Â Â Â _mesa_hash_table_search(state-<wbr>>var_to_basic_ind,<br>
>> var->nir_loop_var);<br>
>> +<br>
>> +Â Â return entry->data;<br>
>> +}<br>
>> +<br>
>> +static int32_t<br>
>> +get_iteration(nir_op cond_op, nir_const_value *initial, nir_const_value<br>
>> *step,<br>
>> +Â Â Â Â Â Â Â nir_const_value *limit, nir_alu_instr *alu, int32_t<br>
>> *init_val,<br>
>> +Â Â Â Â Â Â Â bool increment_before)<br>
>> +{<br>
>> +Â Â int32_t iter;<br>
>> +<br>
>> +Â Â switch (cond_op) {<br>
>> +Â Â case nir_op_ige:<br>
>> +Â Â case nir_op_ilt:<br>
>> +Â Â case nir_op_ieq:<br>
>> +Â Â case nir_op_ine: {<br>
>> +Â Â Â int32_t initial_val = initial->i32[0];<br>
>> +Â Â Â if (increment_before) {<br>
>> +Â Â Â Â Â initial_val = alu->op == nir_op_iadd ?<br>
>> +Â Â Â Â Â Â initial_val + step->i32[0] : initial_val - step->i32[0];<br>
>> +Â Â Â }<br>
>> +<br>
>> +Â Â Â int32_t span = limit->i32[0] - initial_val;<br>
>> +Â Â Â iter = span / step->i32[0];<br>
>> +Â Â Â *init_val = initial_val;<br>
>> +Â Â Â break;<br>
>> +Â Â }<br>
>> +Â Â case nir_op_uge:<br>
>> +Â Â case nir_op_ult: {<br>
>> +Â Â Â uint32_t initial_val = initial->u32[0];<br>
>> +Â Â Â if (increment_before) {<br>
>> +Â Â Â Â Â initial_val = alu->op == nir_op_iadd ?<br>
>> +Â Â Â Â Â Â initial_val + step->u32[0] : initial_val - step->u32[0];<br>
>> +Â Â Â }<br>
>> +<br>
>> +Â Â Â uint32_t span = limit->u32[0] - initial_val;<br>
>> +Â Â Â iter = span / step->u32[0];<br>
>> +Â Â Â *init_val = initial_val;<br>
>> +Â Â Â break;<br>
>> +Â Â }<br>
>> +Â Â default:<br>
>> +Â Â Â return -1;<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return iter;<br>
>> +}<br>
>> +<br>
>> +static uint32_t<br>
>> +utest_interations(int32_t iter_int, nir_const_value *step,<br>
>> +Â Â Â Â Â Â Â Â Â nir_const_value *limit, nir_op cond_op,<br>
>> +Â Â Â Â Â Â Â Â Â uint32_t initial_val, bool limit_rhs)<br>
>> +{<br>
>> +Â Â bool valid_loop = false;<br>
>> +Â Â uint32_t mul = iter_int * step->u32[0];<br>
>> +Â Â uint32_t uadd = mul + initial_val;<br>
>> +<br>
>> +Â Â switch (cond_op) {<br>
>> +Â Â case nir_op_uge:<br>
>> +Â Â Â valid_loop = limit_rhs ? uadd >= limit->u32[0] : uadd <=<br>
>> limit->u32[0];<br>
>> +Â Â Â break;<br>
>> +Â Â case nir_op_ult:<br>
>> +Â Â Â valid_loop = limit_rhs ? uadd < limit->u32[0] : uadd ><br>
>> limit->u32[0];<br>
>> +Â Â Â break;<br>
>> +Â Â default:<br>
>> +Â Â Â unreachable("Unhandled loop condition!");<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return valid_loop;<br>
>> +}<br>
>> +<br>
>> +static int32_t<br>
>> +itest_interations(int32_t iter_int, nir_const_value *step,<br>
>> +Â Â Â Â Â Â Â Â Â nir_const_value *limit, nir_op cond_op,<br>
>> +Â Â Â Â Â Â Â Â Â int32_t initial_val, bool limit_rhs)<br>
>> +{<br>
>> +Â Â bool valid_loop = false;<br>
>> +Â Â int32_t mul = iter_int * step->i32[0];<br>
>> +Â Â int32_t iadd = mul + initial_val;<br>
>> +<br>
>> +Â Â switch (cond_op) {<br>
>> +Â Â case nir_op_ige:<br>
>> +Â Â Â valid_loop = limit_rhs ? iadd >= limit->i32[0] : iadd <=<br>
>> limit->i32[0];<br>
>> +Â Â Â break;<br>
>> +Â Â case nir_op_ilt:<br>
>> +Â Â Â valid_loop = limit_rhs ? iadd < limit->i32[0] : iadd ><br>
>> limit->i32[0];<br>
>> +Â Â Â break;<br>
>> +Â Â case nir_op_ieq:<br>
>> +Â Â Â valid_loop = iadd == limit->i32[0];<br>
>> +Â Â Â break;<br>
>> +Â Â case nir_op_ine:<br>
>> +Â Â Â valid_loop = iadd != limit->i32[0];<br>
>> +Â Â Â break;<br>
>> +Â Â default:<br>
>> +Â Â Â unreachable("Unhandled loop condition!");<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return valid_loop;<br>
>> +}<br>
>> +<br>
>> +static int<br>
>> +calculate_iterations(nir_<wbr>const_value *initial, nir_const_value *step,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â nir_const_value *limit, nir_op cond_op,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â nir_loop_variable *alu_def, nir_alu_instr *cond_alu,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â bool limit_rhs)<br>
>> +{<br>
>> +Â Â assert(initial != NULL && step != NULL && limit != NULL);<br>
>> +<br>
>> +Â Â nir_alu_instr *alu = nir_instr_as_alu(alu_def->def-<wbr>>parent_instr);<br>
>> +<br>
>> +Â Â /* Unsupported alu operation */<br>
>> +Â Â if (!(alu->op == nir_op_iadd || alu->op == nir_op_isub))<br>
><br>
><br>
> You only allow iadd and isub except that we lower away isub so you'll never<br>
> see it. Probably best to remove the dead code. Also...<br>
><br>
>Â 1) You don't handle swizzles at all<br>
> 2) You don't handle things other than 64 or 16-bit. Those are coming soon;<br>
> they need to be supported.<br>
><br>
>><br>
>> +Â Â Â return -1;<br>
>> +<br>
>> +Â Â /* do-while loops can increment the starting value before the<br>
>> condition is<br>
>> +Â Â * checked. e.g.<br>
>> +Â Â *<br>
>> +Â Â *Â Â do {<br>
>> +Â Â *Â Â Â Â ndx++;<br>
>> +Â Â *Â Â Â } while (ndx < 3);<br>
>> +Â Â *<br>
>> +Â Â * Here we check if the induction variable is used directly by the<br>
>> loop<br>
>> +Â Â * condition and if so we assume we need to step the initial value.<br>
>> +Â Â */<br>
>> +Â Â bool increment_before = false;<br>
>> +Â Â if (cond_alu->src[0].src.ssa == alu_def->def ||<br>
>> +Â Â Â Â cond_alu->src[1].src.ssa == alu_def->def) {<br>
>> +Â Â Â increment_before = true;<br>
><br>
><br>
> Is there a reason why this can't be handled as "trip_count + 1"? This seems<br>
> way overcomplicated.<br>
><br>
>><br>
>> +Â Â }<br>
>> +<br>
>> +Â Â int32_t initial_val;<br>
>> +Â Â int iter_int = get_iteration(cond_op, initial, step, limit, alu,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &initial_val, increment_before);<br>
>> +<br>
>> +Â Â /* If iter_int is negative the loop is ill-formed or is the<br>
>> conditional is<br>
>> +Â Â * unsigned with a huge iteration count so don't bother going any<br>
>> further.<br>
>> +Â Â */<br>
>> +Â Â if (iter_int < 0)<br>
>> +Â Â Â return -1;<br>
>> +<br>
>> +Â Â /* An explanation from the GLSL unrolling pass:<br>
>> +Â Â *<br>
>> +Â Â * Make sure that the calculated number of iterations satisfies the<br>
>> exit<br>
>> +  * condition. This is needed to catch off-by-one errors and some<br>
>> types of<br>
>> +  * ill-formed loops. For example, we need to detect that the<br>
>> following<br>
>> +Â Â * loop does not have a maximum iteration count.<br>
>> +Â Â *<br>
>> +Â Â *Â Â for (float x = 0.0; x != 0.9; x += 0.2);<br>
>> +Â Â */<br>
>> +Â Â const int bias[] = { -1, 1, 1 };<br>
>> +<br>
>> +Â Â for (unsigned i = 0; i < ARRAY_SIZE(bias); i++) {<br>
>> +Â Â Â iter_int = iter_int + bias[i];<br>
>> +<br>
>> +Â Â Â switch (cond_op) {<br>
>> +Â Â Â case nir_op_ige:<br>
>> +Â Â Â case nir_op_ilt:<br>
>> +Â Â Â case nir_op_ieq:<br>
>> +Â Â Â case nir_op_ine:<br>
>> +Â Â Â Â Â if (itest_interations(iter_int, step, limit, cond_op,<br>
>> initial_val,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â limit_rhs)) {<br>
>> +Â Â Â Â Â Â return iter_int;<br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â Â Â break;<br>
>> +Â Â Â case nir_op_uge:<br>
>> +Â Â Â case nir_op_ult:<br>
>> +Â Â Â Â Â if (utest_interations(iter_int, step, limit, cond_op,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â (uint32_t) initial_val, limit_rhs)) {<br>
>> +Â Â Â Â Â Â return iter_int;<br>
><br>
><br>
> I think it would be clearer if we combined these two functions.<br>
><br>
>><br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â Â Â break;<br>
>> +Â Â Â default:<br>
>> +Â Â Â Â Â return -1;<br>
>> +Â Â Â }<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return -1;<br>
>> +}<br>
>> +<br>
>> +/* Run through each of the terminators of the loop and try to infer a<br>
>> possible<br>
>> + * trip-count. We need to check them all, and set the lowest trip-count<br>
>> as the<br>
>> + * trip-count of our loop. If one of the terminators has an undecidable<br>
>> + * trip-count we can not safely assume anything about the duration of the<br>
>> + * loop.<br>
>> + */<br>
>> +static void<br>
>> +find_trip_count(loop_info_<wbr>state *state)<br>
>> +{<br>
>> +Â Â bool trip_count_known = true;<br>
>> +Â Â nir_loop_terminator *limiting_terminator = NULL;<br>
>> +Â Â int min_trip_count = -2;<br>
>> +<br>
>> +Â Â list_for_each_entry(nir_loop_<wbr>terminator, terminator,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â &state->info->loop_terminator_<wbr>list,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â loop_terminator_link) {<br>
>> +<br>
>> +Â Â Â if (terminator->conditional_<wbr>instr->type != nir_instr_type_alu) {<br>
>> +Â Â Â Â Â /* If we get here the loop is likely not really a loop and will<br>
>> get<br>
>> +Â Â Â Â Â * cleaned up elsewhere.<br>
>> +Â Â Â Â Â */<br>
><br>
><br>
> The if statement (and its contents) seem fine but the comment here seems<br>
> sketchy.<br>
><br>
>><br>
>> +Â Â Â Â Â trip_count_known = false;<br>
>> +Â Â Â Â Â continue;<br>
>> +Â Â Â }<br>
>> +<br>
>> +Â Â Â nir_alu_instr *alu =<br>
>> nir_instr_as_alu(terminator-><wbr>conditional_instr);<br>
>> +Â Â Â loop_variable *basic_ind = NULL;<br>
>> +Â Â Â loop_variable *limit = NULL;<br>
>> +Â Â Â bool limit_rhs = true;<br>
>> +Â Â Â nir_op cond_op;<br>
>> +<br>
>> +Â Â Â switch (alu->op) {<br>
>> +Â Â Â case nir_op_fge:Â Â Â case nir_op_ige:Â Â Â case nir_op_uge:<br>
>> +Â Â Â case nir_op_flt:Â Â Â case nir_op_ilt:Â Â Â case nir_op_ult:<br>
>> +Â Â Â case nir_op_feq:Â Â Â case nir_op_ieq:<br>
>> +Â Â Â case nir_op_fne:Â Â Â case nir_op_ine:<br>
>> +<br>
>> +Â Â Â Â Â /* We assume that the limit is the "right" operand */<br>
>> +Â Â Â Â Â basic_ind = get_loop_var(alu->src[0].src.<wbr>ssa, state);<br>
>> +Â Â Â Â Â limit = get_loop_var(alu->src[1].src.<wbr>ssa, state);<br>
>> +Â Â Â Â Â cond_op = alu->op;<br>
>> +<br>
>> +Â Â Â Â Â if (basic_ind->nir_loop_var->type != basic_induction) {<br>
>> +Â Â Â Â Â Â /* We had it the wrong way, flip things around */<br>
>> +Â Â Â Â Â Â basic_ind = get_loop_var(alu->src[1].src.<wbr>ssa, state);<br>
>> +Â Â Â Â Â Â limit = get_loop_var(alu->src[0].src.<wbr>ssa, state);<br>
>> +Â Â Â Â Â Â limit_rhs = false;<br>
>> +Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â /* The comparison has to have a basic induction variable<br>
>> +Â Â Â Â Â * and a constant for us to be able to find trip counts<br>
>> +Â Â Â Â Â */<br>
>> +Â Â Â Â Â if (basic_ind->nir_loop_var->type != basic_induction ||<br>
>> +Â Â Â Â Â Â Â !limit->nir_loop_var->is_<wbr>constant) {<br>
>> +Â Â Â Â Â Â trip_count_known = false;<br>
>> +Â Â Â Â Â Â continue;<br>
>> +Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â nir_basic_induction_var *ind =<br>
>> +Â Â Â Â Â Â Â Â get_basic_ind_var_for_loop_<wbr>var(basic_ind, state);<br>
>> +<br>
>> +Â Â Â Â Â if (!ind->def_outside_loop->is_<wbr>constant ||<br>
>> +Â Â Â Â Â Â Â !ind->invariant->is_constant) {<br>
>> +Â Â Â Â Â Â trip_count_known = false;<br>
>> +Â Â Â Â Â Â continue;<br>
>> +Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â /* We have determined that we have the following constants:<br>
>> +Â Â Â Â Â * (With the typical int i = 0; i < x; i++; as an example)<br>
>> +Â Â Â Â Â *Â Â - Upper limit.<br>
>> +Â Â Â Â Â *Â Â - Starting value<br>
>> +Â Â Â Â Â *Â Â - Step / iteration size<br>
>> +Â Â Â Â Â * Thats all thats needed to calculate the trip-count<br>
>> +Â Â Â Â Â */<br>
>> +<br>
>> +Â Â Â Â Â nir_load_const_instr *initial_instr =<br>
>> +Â Â Â Â Â Â Â Â nir_instr_as_load_const(<br>
>> +Â Â Â Â Â Â Â Â Â Â Â ind->def_outside_loop->def-><wbr>parent_instr);<br>
>> +<br>
>> +Â Â Â Â Â nir_const_value initial_val = initial_instr->value;<br>
>> +<br>
>> +Â Â Â Â Â nir_load_const_instr *step_instr =<br>
>> +Â Â Â Â Â Â Â Â nir_instr_as_load_const(<br>
>> +Â Â Â Â Â Â Â Â Â Â Â ind->invariant->def->parent_<wbr>instr);<br>
>> +<br>
>> +Â Â Â Â Â nir_const_value step_val = step_instr->value;<br>
>> +<br>
>> +Â Â Â Â Â nir_load_const_instr *limit_instr =<br>
>> +Â Â Â Â Â Â Â Â nir_instr_as_load_const(<br>
>> +Â Â Â Â Â Â Â Â Â Â Â limit->nir_loop_var->def-><wbr>parent_instr);<br>
>> +<br>
>> +Â Â Â Â Â nir_const_value limit_val = limit_instr->value;<br>
>> +<br>
>> +Â Â Â Â Â int iterations = calculate_iterations(&initial_<wbr>val, &step_val,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &limit_val, cond_op,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ind->alu_def, alu,<br>
>> limit_rhs);<br>
>> +<br>
>> +Â Â Â Â Â /* Where we not able to calculate the iteration count */<br>
>> +Â Â Â Â Â if (iterations == -1) {<br>
>> +Â Â Â Â Â Â trip_count_known = false;<br>
>> +Â Â Â Â Â Â continue;<br>
>> +Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â /* If this is the first run or we have found a smaller amount of<br>
>> +Â Â Â Â Â * iterations than previously (we have identified a more<br>
>> limiting<br>
>> +Â Â Â Â Â * terminator) set the trip count and limiting terminator.<br>
>> +Â Â Â Â Â */<br>
>> +Â Â Â Â Â if (min_trip_count == -2 || iterations < min_trip_count) {<br>
><br>
><br>
> Can we have a #define for -2 so that it has a name.<br>
><br>
>><br>
>> +Â Â Â Â Â Â min_trip_count = iterations;<br>
>> +Â Â Â Â Â Â limiting_terminator = terminator;<br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â Â Â break;<br>
>> +<br>
>> +Â Â Â default:<br>
>> +Â Â Â Â Â trip_count_known = false;<br>
>> +Â Â Â }<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â state->info->is_trip_count_<wbr>known = trip_count_known;<br>
>> +Â Â if (min_trip_count > -2)<br>
>> +Â Â Â state->info->trip_count = min_trip_count;<br>
>> +Â Â state->info->limiting_<wbr>terminator = limiting_terminator;<br>
>> +}<br>
>> +<br>
>> +/* Checks if we should force the loop to be unrolled regardless of size<br>
>> */<br>
>> +static bool<br>
>> +force_unroll(loop_info_state *state, nir_shader *ns, nir_deref_var<br>
>> *variable)<br>
>> +{<br>
>> +Â Â nir_deref *tail = &variable->deref;<br>
>> +<br>
>> +Â Â while (tail->child != NULL) {<br>
>> +Â Â Â tail = tail->child;<br>
>> +<br>
>> +Â Â Â if (tail->deref_type == nir_deref_type_array) {<br>
>> +<br>
>> +Â Â Â Â Â nir_deref_array *deref_array = nir_deref_as_array(tail);<br>
>> +Â Â Â Â Â if (deref_array->deref_array_type !=<br>
>> nir_deref_array_type_indirect)<br>
>> +Â Â Â Â Â Â continue;<br>
>> +<br>
>> +Â Â Â Â Â nir_loop_variable *array_index =<br>
>> +Â Â Â Â Â Â get_nir_loop_var(deref_array-><wbr>indirect.ssa, state);<br>
>> +<br>
>> +Â Â Â Â Â if (array_index->type != basic_induction)<br>
>> +Â Â Â Â Â Â continue;<br>
>> +<br>
>> +Â Â Â Â Â /* If an array is indexed by a loop induction variable, and the<br>
>> +Â Â Â Â Â * array size is exactly the number of loop iterations, this is<br>
>> +Â Â Â Â Â * probably a simple for-loop trying to access each element in<br>
>> +Â Â Â Â Â * turn; the application may expect it to be unrolled.<br>
>> +Â Â Â Â Â */<br>
>> +Â Â Â Â Â if (glsl_get_length(tail->type) == state->info->trip_count) {<br>
>> +Â Â Â Â Â Â state->info->force_unroll = true;<br>
>> +Â Â Â Â Â Â return state->info->force_unroll;<br>
>> +Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â if (variable->var->data.mode & state->indirect_mask) {<br>
>> +Â Â Â Â Â Â state->info->force_unroll = true;<br>
>> +Â Â Â Â Â Â return state->info->force_unroll;<br>
>> +Â Â Â Â Â }<br>
><br>
><br>
> Thinking a bit about analysis vs. lowering...<br>
><br>
> I wonder if it wouldn't be better to make the loop anlaysis pass be a bit<br>
> more informational and less decision making. For instance, it could record<br>
> what all variable modes it has seen be indexed by an induction variable and<br>
> let the pass using the analysis decide whether or not to force-unroll. For<br>
> that matter, it could just produce a hash map from induction variables to<br>
> the loop for which they are an induction variable. You could also just<br>
> record the trip count per-loop. That all seems a bit more like things an<br>
> analysis pass would do than just setting a force_unroll bit.<br>
><br>
> Please don't feel like you need to make any changes in this direction yet.<br>
> I'm mostly trying to open the discussion up a bit and feel out exactly how<br>
> we want things to be structured.<br>
><br>
> I think I've written you a long enough book for now. I'll try to look at<br>
> the others as I get time.<br>
><br>
> --Jason<br>
><br>
>><br>
>> +Â Â Â }<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return false;<br>
>> +}<br>
>> +<br>
>> +static bool<br>
>> +count_instructions(loop_info_<wbr>state *state, nir_shader *ns, nir_block<br>
>> *block)<br>
>> +{<br>
>> +Â Â nir_foreach_instr(instr, block) {<br>
>> +Â Â Â if (instr->type == nir_instr_type_intrinsic ||<br>
>> +Â Â Â Â Â instr->type == nir_instr_type_alu) {<br>
>> +Â Â Â Â Â state->info->num_instructions+<wbr>+;<br>
>> +Â Â Â }<br>
>> +<br>
>> +Â Â Â if (instr->type != nir_instr_type_intrinsic)<br>
>> +Â Â Â Â Â continue;<br>
>> +<br>
>> +Â Â Â nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);<br>
>> +<br>
>> +Â Â Â /* Check for arrays variably-indexed by a loop induction variable.<br>
>> +Â Â Â Â * Unrolling the loop may convert that access into<br>
>> constant-indexing.<br>
>> +Â Â Â Â */<br>
>> +Â Â Â if (intrin->intrinsic == nir_intrinsic_load_var ||<br>
>> +Â Â Â Â Â intrin->intrinsic == nir_intrinsic_store_var ||<br>
>> +Â Â Â Â Â intrin->intrinsic == nir_intrinsic_copy_var) {<br>
>> +Â Â Â Â Â unsigned num_vars =<br>
>> +Â Â Â Â Â Â nir_intrinsic_infos[intrin-><wbr>intrinsic].num_variables;<br>
>> +Â Â Â Â Â for (unsigned i = 0; i < num_vars; i++) {<br>
>> +Â Â Â Â Â Â if (force_unroll(state, ns, intrin->variables[i]))<br>
>> +Â Â Â Â Â Â Â Â return true;<br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â }<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â return false;<br>
>> +}<br>
>> +<br>
>> +static void<br>
>> +get_loop_info(loop_info_state *state, nir_function_impl *impl)<br>
>> +{<br>
>> +Â Â /* Initialize all variables to "outside_loop". This also marks defs<br>
>> +Â Â * invariant and constant if they are nir_instr_type_load_const's<br>
>> +Â Â */<br>
>> +Â Â nir_foreach_block(block, impl) {<br>
>> +Â Â Â nir_foreach_instr(instr, block)<br>
>> +Â Â Â Â Â nir_foreach_ssa_def(instr, initialize_ssa_def, state);<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â init_loop_state init_state = {.mark_in_conditional = false,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â .mark_nested = false, .state = state };<br>
>> +<br>
>> +Â Â /* Add all entries in the outermost part of the loop to the processing<br>
>> list<br>
>> +Â Â * Mark the entries in conditionals or in nested loops accordingly<br>
>> +Â Â */<br>
>> +Â Â foreach_list_typed_safe(nir_<wbr>cf_node, node, node, &state->loop->body) {<br>
>> +Â Â Â switch (node->type) {<br>
>> +<br>
>> +Â Â Â case nir_cf_node_block:<br>
>> +Â Â Â Â Â init_state.mark_in_conditional = false;<br>
>> +Â Â Â Â Â init_state.mark_nested = false;<br>
>> +Â Â Â Â Â init_loop_block(nir_cf_node_<wbr>as_block(node), &init_state);<br>
>> +Â Â Â Â Â break;<br>
>> +<br>
>> +Â Â Â case nir_cf_node_if:<br>
>> +Â Â Â Â Â init_state.mark_in_conditional = true;<br>
>> +Â Â Â Â Â init_state.mark_nested = false;<br>
>> +Â Â Â Â Â nir_foreach_block_in_cf_node(<wbr>block, node)<br>
>> +Â Â Â Â Â Â init_loop_block(block, &init_state);<br>
>> +Â Â Â Â Â break;<br>
>> +<br>
>> +Â Â Â case nir_cf_node_loop:<br>
>> +Â Â Â Â Â init_state.mark_in_conditional = false;<br>
>> +Â Â Â Â Â init_state.mark_nested = true;<br>
>> +Â Â Â Â Â nir_foreach_block_in_cf_node(<wbr>block, node) {<br>
>> +Â Â Â Â Â Â init_loop_block(block, &init_state);<br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â Â Â break;<br>
>> +<br>
>> +Â Â Â case nir_cf_node_function:<br>
>> +Â Â Â Â Â break;<br>
>> +Â Â Â }<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â /* Induction analysis needs invariance information so get that first<br>
>> */<br>
>> +Â Â compute_invariance_<wbr>information(state);<br>
>> +<br>
>> +Â Â /* We may now have filled the process_list with instructions from<br>
>> inside<br>
>> +Â Â * the nested blocks in the loop. Remove all instructions from the<br>
>> list<br>
>> +Â Â * nir_foreach_block_in_cf_node before we start computing induction<br>
>> +Â Â * information.<br>
>> +Â Â */<br>
>> +Â Â list_inithead(&state->process_<wbr>list);<br>
>> +<br>
>> +Â Â /* Add all entries in the outermost part of the loop to the processing<br>
>> list.<br>
>> +Â Â * Don't include defs inn nested loops or in conditionals.<br>
>> +Â Â */<br>
>> +Â Â init_state.mark_in_conditional = false;<br>
>> +Â Â init_state.mark_nested = false;<br>
>> +<br>
>> +Â Â foreach_list_typed_safe(nir_<wbr>cf_node, node, node, &state->loop->body)<br>
>> +Â Â Â if (node->type == nir_cf_node_block)<br>
>> +Â Â Â Â Â init_loop_block(nir_cf_node_<wbr>as_block(node), &init_state);<br>
>> +<br>
>> +Â Â /* We have invariance information so try to find induction variables<br>
>> */<br>
>> +Â Â if (!compute_induction_<wbr>information(state))<br>
>> +Â Â Â return;<br>
>> +<br>
>> +Â Â /* Try to find all simple terminators of the loop. If we can't find<br>
>> any,<br>
>> +Â Â * or we find possible terminators that have side effects then bail.<br>
>> +Â Â */<br>
>> +Â Â if (!find_loop_terminators(state)<wbr>)<br>
>> +Â Â Â return;<br>
>> +<br>
>> +Â Â /* Run through each of the terminators and try to compute a trip-count<br>
>> */<br>
>> +Â Â find_trip_count(state);<br>
>> +<br>
>> +Â Â nir_shader *ns = impl->function->shader;<br>
>> +Â Â foreach_list_typed_safe(nir_<wbr>cf_node, node, node, &state->loop->body) {<br>
>> +Â Â Â if (node->type == nir_cf_node_block) {<br>
>> +Â Â Â Â Â if (count_instructions(state, ns, nir_cf_node_as_block(node)))<br>
>> +Â Â Â Â Â Â break;<br>
>> +Â Â Â } else {<br>
>> +Â Â Â Â Â nir_foreach_block_in_cf_node(<wbr>block, node) {<br>
>> +Â Â Â Â Â Â if (count_instructions(state, ns, block))<br>
>> +Â Â Â Â Â Â Â Â break;<br>
>> +Â Â Â Â Â }<br>
>> +Â Â Â }<br>
>> +Â Â }<br>
>> +}<br>
>> +<br>
>> +static loop_info_state *<br>
>> +initialize_loop_info_state(<wbr>nir_loop *loop, void *mem_ctx,<br>
>> nir_function_impl *impl)<br>
>> +{<br>
>> +Â Â loop_info_state *state = rzalloc(mem_ctx, loop_info_state);<br>
>> +Â Â state->loop_vars = rzalloc_array(mem_ctx, loop_variable,<br>
>> impl->ssa_alloc);<br>
>> +Â Â state->loop = loop;<br>
>> +Â Â state->nir_loop_vars = rzalloc_array(mem_ctx, nir_loop_variable,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â impl->ssa_alloc);<br>
>> +<br>
>> +Â Â LIST_INITHEAD(&state->process_<wbr>list);<br>
>> +<br>
>> +Â Â if (loop->info)<br>
>> +Â Â Â ralloc_free(loop->info);<br>
>> +<br>
>> +Â Â state->info = rzalloc(loop, nir_loop_info);<br>
>> +<br>
>> +Â Â LIST_INITHEAD(&state->info-><wbr>loop_terminator_list);<br>
>> +<br>
>> +Â Â state->var_to_basic_ind =<br>
>> +Â Â Â _mesa_hash_table_create(state-<wbr>>info, _mesa_hash_pointer,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _mesa_key_pointer_equal);<br>
>> +<br>
>> +Â Â return state;<br>
>> +}<br>
>> +<br>
>> +static void<br>
>> +process_loops(nir_cf_node *cf_node, nir_variable_mode indirect_mask)<br>
>> +{<br>
>> +Â Â switch (cf_node->type) {<br>
>> +Â Â case nir_cf_node_block:<br>
>> +Â Â Â return;<br>
>> +Â Â case nir_cf_node_if: {<br>
>> +Â Â Â nir_if *if_stmt = nir_cf_node_as_if(cf_node);<br>
>> +Â Â Â foreach_list_typed(nir_cf_<wbr>node, nested_node, node,<br>
>> &if_stmt->then_list)<br>
>> +Â Â Â Â Â process_loops(nested_node, indirect_mask);<br>
>> +Â Â Â foreach_list_typed(nir_cf_<wbr>node, nested_node, node,<br>
>> &if_stmt->else_list)<br>
>> +Â Â Â Â Â process_loops(nested_node, indirect_mask);<br>
>> +Â Â Â return;<br>
>> +Â Â }<br>
>> +Â Â case nir_cf_node_loop: {<br>
>> +Â Â Â nir_loop *loop = nir_cf_node_as_loop(cf_node);<br>
>> +Â Â Â foreach_list_typed(nir_cf_<wbr>node, nested_node, node, &loop->body)<br>
>> +Â Â Â Â Â process_loops(nested_node, indirect_mask);<br>
>> +Â Â Â break;<br>
>> +Â Â }<br>
>> +Â Â default:<br>
>> +Â Â Â unreachable("unknown cf node type");<br>
>> +Â Â }<br>
>> +<br>
>> +Â Â nir_loop *loop = nir_cf_node_as_loop(cf_node);<br>
>> +Â Â nir_function_impl *impl = nir_cf_node_get_function(cf_<wbr>node);<br>
>> +Â Â void *mem_ctx = ralloc_context(NULL);<br>
>> +<br>
>> +Â Â loop_info_state *state = initialize_loop_info_state(<wbr>loop, mem_ctx,<br>
>> impl);<br>
>> +Â Â state->indirect_mask = indirect_mask;<br>
>> +<br>
>> +Â Â get_loop_info(state, impl);<br>
>> +<br>
>> +Â Â loop->info = state->info;<br>
>> +<br>
>> +Â Â ralloc_free(mem_ctx);<br>
>> +}<br>
>> +<br>
>> +void<br>
>> +nir_loop_analyze_impl(nir_<wbr>function_impl *impl,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â nir_variable_mode indirect_mask)<br>
>> +{<br>
>> +Â Â if (impl->function->shader-><wbr>options->max_unroll_iterations == 0)<br>
>> +Â Â Â return;<br>
>> +<br>
>> +Â Â nir_index_ssa_defs(impl);<br>
>> +Â Â foreach_list_typed(nir_cf_<wbr>node, node, node, &impl->body)<br>
>> +Â Â Â process_loops(node, indirect_mask);<br>
>> +}<br>
>> diff --git a/src/compiler/nir/nir_<wbr>metadata.c<br>
>> b/src/compiler/nir/nir_<wbr>metadata.c<br>
>> index 9e1cff5..f71cf43 100644<br>
>> --- a/src/compiler/nir/nir_<wbr>metadata.c<br>
>> +++ b/src/compiler/nir/nir_<wbr>metadata.c<br>
>> @@ -31,7 +31,7 @@<br>
>>Â Â */<br>
>><br>
>>Â void<br>
>> -nir_metadata_require(nir_<wbr>function_impl *impl, nir_metadata required)<br>
>> +nir_metadata_require(nir_<wbr>function_impl *impl, nir_metadata required, ...)<br>
>>Â {<br>
>>Â #define NEEDS_UPDATE(X) ((required & ~impl->valid_metadata) & (X))<br>
>><br>
>> @@ -41,6 +41,12 @@ nir_metadata_require(nir_<wbr>function_impl *impl,<br>
>> nir_metadata required)<br>
>>Â Â Â Â nir_calc_dominance_impl(impl);<br>
>>Â Â Â if (NEEDS_UPDATE(nir_metadata_<wbr>live_ssa_defs))<br>
>>Â Â Â Â nir_live_ssa_defs_impl(impl);<br>
>> +Â Â if (NEEDS_UPDATE(nir_metadata_<wbr>loop_analysis)) {<br>
>> +Â Â Â va_list ap;<br>
>> +Â Â Â va_start(ap, required);<br>
>> +Â Â Â nir_loop_analyze_impl(impl, va_arg(ap, nir_variable_mode));<br>
>> +Â Â Â va_end(ap);<br>
>> +Â Â }<br>
>><br>
>>Â #undef NEEDS_UPDATE<br>
>><br>
>> --<br>
>> 2.7.4<br>
>><br>
>> ______________________________<wbr>_________________<br>
>> mesa-dev mailing list<br>
>> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
>> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
><br>
</div></div></blockquote></div><br></div></div>