[Mesa-dev] [PATCH 0/3] Fix racy full-vector writes for v[i].x

Kristian Høgsberg krh at bitplanet.net
Tue Nov 10 11:54:55 PST 2015


On Mon, Nov 9, 2015 at 6:26 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Mon, Nov 9, 2015 at 3:52 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> On 11/04/2015 03:55 PM, Jason Ekstrand wrote:
>>> Here's some shader-db  numbers:
>>>
>>> total instructions in shared programs: 6236146 -> 6255385 (0.31%)
>>> instructions in affected programs:     203629 -> 222868 (9.45%)
>>> helped:                                118
>>> HURT:                                  1989
>>> GAINED:                                18
>>> LOST:                                  0
>>
>> I recall from off-line discussions that many (almost all?) of the really
>> hurt shaders were vertex shaders that we no longer getting benefit from
>> the vectorizer pass.  How hard would be it be to modify the lowering
>> pass to have an option to only lower SSBOs and other memories that
>> actually need the early lowering?  We could then lower those early, do
>> the vectorizing, the lower the others late (as we do now).
>>
>> I know we really want a NIR vectorizer, but I think that's a bigger
>> project than we want to tackle right now.  If we think this stop-gap
>> could be implemented quickly enough, maybe we should do that for now
>> instead.
>
> I believe this has all been fixed in v2.

Yup, v2 is a shader-db no-op.

Kristian

>>> We should probably look into that.
>>>
>>>
>>> On Wed, Nov 4, 2015 at 3:33 PM, Kristian Høgsberg Kristensen
>>> <krh at bitplanet.net> wrote:
>>>> This little series fixes a problem where we lower
>>>>
>>>>   v[i] = s
>>>>
>>>> to
>>>>
>>>>   v = vector_insert(v, s, i)
>>>>
>>>> turning a component write into a full vector write. This used to be
>>>> ok, since none of this was visible to other threads.  Now with SSBOs
>>>> (and compute shader SLM and tesselation outputs) this rewrite is racy
>>>> and we have to handle this different in case the vector is in globally
>>>> visible storage.
>>>>
>>>> Kristian Høgsberg Kristensen (3):
>>>>   glsl: Drop exec_list argument to lower_ubo_reference
>>>>   glsl: Lower UBO and SSBO access in glsl linker
>>>>   glsl: Use array deref for access to vector components
>>>>
>>>>  src/glsl/Makefile.sources                  |   1 +
>>>>  src/glsl/ast_array_index.cpp               |   5 +-
>>>>  src/glsl/ast_function.cpp                  |  24 ++-----
>>>>  src/glsl/ast_to_hir.cpp                    |  43 ------------
>>>>  src/glsl/ir_optimization.h                 |   3 +-
>>>>  src/glsl/ir_validate.cpp                   |   7 +-
>>>>  src/glsl/linker.cpp                        |  10 +++
>>>>  src/glsl/lower_ubo_reference.cpp           |  18 ++++-
>>>>  src/glsl/lower_vector_derefs.cpp           | 104 +++++++++++++++++++++++++++++
>>>>  src/glsl/opt_dead_code_local.cpp           |   2 +
>>>>  src/mesa/drivers/dri/i965/brw_link.cpp     |   2 -
>>>>  src/mesa/drivers/dri/i965/brw_shader.cpp   |   2 +
>>>>  src/mesa/main/mtypes.h                     |   2 +
>>>>  src/mesa/state_tracker/st_extensions.c     |   1 +
>>>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   1 -
>>>>  15 files changed, 151 insertions(+), 74 deletions(-)
>>>>  create mode 100644 src/glsl/lower_vector_derefs.cpp
>>>>
>>>> --
>>>> 2.6.2
>>>>
>>>> _______________________________________________
>>>> mesa-dev mailing list
>>>> mesa-dev at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>> _______________________________________________
>>> 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