[Mesa-dev] [PATCH 00/11] TGSI: split, merge and interleave arrays

Gert Wollny gw.fossdev at gmail.com
Fri Feb 9 10:11:05 UTC 2018

Dear all, 

this series of patches introduces array splitting, merging, and 

Patch 1: Split arrays that are only accessed directly:  
I posted a first version off the the array splitting in patch 1 some 
time ago. Eric Anholt pointed out that this might be done in 
opt_array_splitting.cpp, but in another comment Timothy pointed out 
that this is far from trivial, and he also pointed out that he was 
proposing similar patches for NIR, but since currently no NIR->TGSI 
transformation is available, TGSI based drivers can't make use of this. 

While the reminder off the series could be applied without this patch, I 
think it makes less sense to do all the optimizations on arrays that could 
simply be split into individual registers, so I repost the patch with some 

The remainder of the series focuses on implementing the live range merging 
and interleaving of arrays. The series doesn't show any piglit regressions 
(shader subset), makes 

   spec/glsl-1.50/execution -

pass on R600/Barts and fixes #100200.

I tried to be exhaustive with comments and make the variable any type names 
self-explaining, but since I've been staring at this code for a long time I
don't think I am capable of seeing any problems any more, so comments are very 


PS: I have no git write access. 

Gert Wollny (11):
  mesa/st: glsl_to_tgsi: Split arrays who's elements are only accessed
  mesa/st/glsl_to_tgsi: rename lifetime to register_live_range
  mesa/st: Add helper classes for array merging and interleaving
  mesa/st/glsl_to_tgsi: Add class to hold array information
  mesa/st/glsl_to_tgsi: Add array merge logic
  mesa/st/tests: Add unit tests for array merge helper classes.
  mesa/st/glsl_to_tgsi: refactor access_record and its use
  mesa/st/glsl_to_tgsi: move evaluation of read mask up in the call
  mesa/st/glsl_to_tgsi: add class for array access tracking
  mesa/st/glsl_to_tgsi: add array life range evaluation into tracking
  mesa/st/glsl_to_tgsi: Expose array live range tracking and merging

 src/mesa/Makefile.sources                          |   2 +
 src/mesa/meson.build                               |   2 +
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp         | 144 +++-
 .../state_tracker/st_glsl_to_tgsi_array_merge.cpp  | 735 +++++++++++++++++++++
 .../state_tracker/st_glsl_to_tgsi_array_merge.h    | 186 ++++++
 .../state_tracker/st_glsl_to_tgsi_temprename.cpp   | 290 +++++---
 .../state_tracker/st_glsl_to_tgsi_temprename.h     |  47 +-
 src/mesa/state_tracker/tests/Makefile.am           |  20 +-
 src/mesa/state_tracker/tests/st_tests_common.cpp   |  25 +-
 src/mesa/state_tracker/tests/st_tests_common.h     |  20 +-
 .../tests/test_glsl_to_tgsi_array_merge.cpp        | 296 +++++++++
 .../tests/test_glsl_to_tgsi_lifetime.cpp           |  10 +-
 12 files changed, 1644 insertions(+), 133 deletions(-)
 create mode 100644 src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.cpp
 create mode 100644 src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.h
 create mode 100644 src/mesa/state_tracker/tests/test_glsl_to_tgsi_array_merge.cpp


More information about the mesa-dev mailing list