[Mesa-dev] [PATCH 00/11 v2] TGSI: improved live range tracking, also including arrays

Gert Wollny gw.fossdev at gmail.com
Mon Mar 26 09:27:25 UTC 2018


Dear all, 

this is the merged version of two series [1] (TGSI: split, merge 
and interleave arrays) and [2] (mesa/st/glsl_to_tgsi: Properly 
resolve life times for simple if/else + use constructs) I sent
earlier. Considering that both parts target the same optimization 
step and fix a bug if both are applied, I thought it is better to 
add this second patch to the series. Changes refer to v1 of [1]: 

v2: 
 - rebase patches to latest HEAD
 - add some code that allows obtaining some statistics about register
   and instruction usage
 - Add patch [2] that improves resolving the live range estimation with 
   simple if/else and use constructs. By adding this patch the series 
   fixes https://bugs.freedesktop.org/show_bug.cgi?id=105371

 v1: 
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 
changes. 

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 
welcome.

Best, 
Gert 

PS: I have no git write access. 


[1] https://patchwork.freedesktop.org/series/37991/ 
[2] https://patchwork.freedesktop.org/series/39471/

Gert Wollny (11):
  mesa/st: glsl_to_tgsi: Split arrays who's elements are only accessed
    directly
  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
    hierarchy
  mesa/st/glsl_to_tgsi: add class for array access tracking
  mesa/st/glsl_to_tgsi: add array life range evaluation into tracking
    code
  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

-- 
2.13.6



More information about the mesa-dev mailing list