On 01/04/16 21:35, Jason Ekstrand wrote: > Unless I'm missing something, this series doesn't contain anything that > uses this patch. Let's drop it for now and put it in with whatever adds > the actual nir_opt_algebraic changes. >
Yeah, the user of this will be included in next patch series. I will move this patch to there. > Another option would be to silently bail if nir_search tries to create an > expression where the opcode has an explicit bit size and it doesn't match > the bit size that it needs. I'm not sure what the best thing to do is. > I'll think on it. > OK. Thanks, Sam > On Thu, Mar 31, 2016 at 3:00 AM, Samuel Iglesias Gonsálvez < > sigles...@igalia.com> wrote: > >> Some instructions (like flrp in i965) cannot be lowered depending on the >> bit size because it doesn't support all bit sizes. >> >> If the bit size field is defined in nir_opt_algebraic.py, take it into >> account. >> >> Signed-off-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com> >> --- >> src/compiler/nir/nir_algebraic.py | 11 ++++++++++- >> 1 file changed, 10 insertions(+), 1 deletion(-) >> >> diff --git a/src/compiler/nir/nir_algebraic.py >> b/src/compiler/nir/nir_algebraic.py >> index d05564f..9c679ac 100644 >> --- a/src/compiler/nir/nir_algebraic.py >> +++ b/src/compiler/nir/nir_algebraic.py >> @@ -180,6 +180,11 @@ class SearchAndReplace(object): >> else: >> self.condition = 'true' >> >> + if len(transform) > 3: >> + self.bit_size = transform[3] >> + else: >> + self.bit_size = 0 >> + >> if self.condition not in condition_list: >> condition_list.append(self.condition) >> self.condition_index = condition_list.index(self.condition) >> @@ -208,6 +213,7 @@ struct transform { >> const nir_search_expression *search; >> const nir_search_value *replace; >> unsigned condition_offset; >> + unsigned bit_size; >> }; >> >> struct opt_state { >> @@ -226,7 +232,7 @@ struct opt_state { >> >> static const struct transform ${pass_name}_${opcode}_xforms[] = { >> % for xform in xform_list: >> - { &${xform.search.name}, ${xform.replace.c_ptr}, >> ${xform.condition_index} }, >> + { &${xform.search.name}, ${xform.replace.c_ptr}, >> ${xform.condition_index}, ${xform.bit_size}}, >> % endfor >> }; >> % endfor >> @@ -249,6 +255,9 @@ ${pass_name}_block(nir_block *block, void *void_state) >> case nir_op_${opcode}: >> for (unsigned i = 0; i < >> ARRAY_SIZE(${pass_name}_${opcode}_xforms); i++) { >> const struct transform *xform = >> &${pass_name}_${opcode}_xforms[i]; >> + if (xform->bit_size != 0 && >> + alu->dest.dest.ssa.bit_size != xform->bit_size) >> + continue; >> if (state->condition_flags[xform->condition_offset] && >> nir_replace_instr(alu, xform->search, xform->replace, >> state->mem_ctx)) { >> -- >> 2.5.0 >> >> _______________________________________________ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev >> > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev