[Mesa-dev] [PATCH 1/4] nir: Add a src_get_parent_instr function

Jason Ekstrand jason at jlekstrand.net
Fri Apr 3 12:28:09 PDT 2015


On Fri, Apr 3, 2015 at 12:24 PM, Jordan Justen
<jordan.l.justen at intel.com> wrote:
> 1-3 Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

Thanks!  I'm actually in the process of replacing 3 with what I think
is a better long-term solution.  I'll put you R-B on 1 and 2 when I
send the v2.

> Shouldn't we hold off on 4 given the lost count?

Maybe.  That's also the one that gives us a nice benifit and the
shaders it looses are all shaders we don't have in GLSL IR anyway
presumably because it's also lowering the ifs to selects and running
into the same scheduling problems.
--Jason

> On 2015-04-02 21:05:22, Jason Ekstrand wrote:
>> ---
>>  src/glsl/nir/nir.h                                       | 10 ++++++++++
>>  .../drivers/dri/i965/brw_nir_analyze_boolean_resolves.c  | 16 ++--------------
>>  2 files changed, 12 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
>> index 24deb82..94b0f49 100644
>> --- a/src/glsl/nir/nir.h
>> +++ b/src/glsl/nir/nir.h
>> @@ -529,6 +529,16 @@ nir_src_for_reg(nir_register *reg)
>>     return src;
>>  }
>>
>> +static inline nir_instr *
>> +nir_src_get_parent_instr(const nir_src *src)
>> +{
>> +   if (src->is_ssa) {
>> +      return src->ssa->parent_instr;
>> +   } else {
>> +      return src->reg.reg->parent_instr;
>> +   }
>> +}
>> +
>>  static inline nir_dest
>>  nir_dest_for_reg(nir_register *reg)
>>  {
>> diff --git a/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c b/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c
>> index 3a27cf1..f0b018c 100644
>> --- a/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c
>> +++ b/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c
>> @@ -43,13 +43,7 @@
>>  static uint8_t
>>  get_resolve_status_for_src(nir_src *src)
>>  {
>> -   nir_instr *src_instr;
>> -   if (src->is_ssa) {
>> -      src_instr = src->ssa->parent_instr;
>> -   } else {
>> -      src_instr = src->reg.reg->parent_instr;
>> -   }
>> -
>> +   nir_instr *src_instr = nir_src_get_parent_instr(src);
>>     if (src_instr) {
>>        uint8_t resolve_status = src_instr->pass_flags & BRW_NIR_BOOLEAN_MASK;
>>
>> @@ -72,13 +66,7 @@ get_resolve_status_for_src(nir_src *src)
>>  static bool
>>  src_mark_needs_resolve(nir_src *src, void *void_state)
>>  {
>> -   nir_instr *src_instr;
>> -   if (src->is_ssa) {
>> -      src_instr = src->ssa->parent_instr;
>> -   } else {
>> -      src_instr = src->reg.reg->parent_instr;
>> -   }
>> -
>> +   nir_instr *src_instr = nir_src_get_parent_instr(src);
>>     if (src_instr) {
>>        uint8_t resolve_status = src_instr->pass_flags & BRW_NIR_BOOLEAN_MASK;
>>
>> --
>> 2.3.4
>>
>> _______________________________________________
>> 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