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

Jason Ekstrand jason at jlekstrand.net
Wed Nov 4 15:55:52 PST 2015


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

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


More information about the mesa-dev mailing list