[Mesa-dev] [PATCH 0/5] NIR vectorization

Connor Abbott cwabbott0 at gmail.com
Tue Feb 2 11:49:09 PST 2016


On Mon, Feb 1, 2016 at 6:13 AM, Alejandro Piñeiro <apinheiro at igalia.com> wrote:
> While doing some code checking, I realized that nir vectorization was
> not on master, in spite my memory saying the opposite. So I searched on
> the mailing list, and I found the original series (this one). My memory
> was correct that the introduced HURT shaders was accepted as a lesser
> evil, but not the patch itself (patch 4/5 was reviewed but not updated).
>
> So an awkward ping here (as this is not my series), because even if
> Connor doesn't have time to update patch 4/5, I think that it would be
> good to push patch 1 and 2, that were reviewed but not pushed on master.
>
> BR

Whoops, sorry! I've pushed 1 and 2. It seems like I never responded to
Jason's comments :( so I'll go back and try to sort it out.

>
> On 15/11/15 03:59, Connor Abbott wrote:
>> This series adds an optimization to detect things like:
>>
>> foo.x = bar.x + baz.x;
>> foo.y = bar.y + baz.y;
>> foo.z = bar.z + baz.z;
>> foo.w = bar.w + baz.w;
>>
>> and turn them into:
>>
>> foo = bar + baz;
>>
>> which shows up distressingly often in shaders translated from D3D
>> bytecode, or by people who seemingly don't know that GLSL can do all
>> that vector-y stuff for you. There is a similar pass in GLSL IR, but it
>> can only handle operations on uniforms/inputs since it would've been too
>> difficult to handle more complicated cases. But now that we have NIR,
>> and the i965 vec4 backend uses NIR, we can write a much better pass
>> using the magic of SSA. Shader-db results are in the last patch.
>>
>> Series is also available as the 'nir-vectorize' branch of my FDO repository.
>>
>> Connor Abbott (5):
>>   util/set: don't compare against deleted entries
>>   util/hash_table: don't compare deleted entries
>>   nir/array: add a few more helpers
>>   nir: add a vectorization pass
>>   i965/nir: use vectorization for non-scalar stages
>>
>>  src/glsl/Makefile.sources           |   1 +
>>  src/glsl/nir/nir.h                  |   2 +
>>  src/glsl/nir/nir_array.h            |  21 ++
>>  src/glsl/nir/nir_opt_vectorize.c    | 447 ++++++++++++++++++++++++++++++++++++
>>  src/mesa/drivers/dri/i965/brw_nir.c |   8 +
>>  src/util/hash_table.c               |   3 +-
>>  src/util/set.c                      |   3 +-
>>  7 files changed, 483 insertions(+), 2 deletions(-)
>>  create mode 100644 src/glsl/nir/nir_opt_vectorize.c
>>
>
> --
> Alejandro Piñeiro (apinheiro at igalia.com)
>


More information about the mesa-dev mailing list