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

Gert Wollny gw.fossdev at gmail.com
Sat Apr 28 19:30:00 UTC 2018


this is another update of the series I've sent before. 

v3: 
 - Add new test mesa/st/tests/meson.build
 - rebase patches to latest HEAD

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 (13):
  mesa/st/glsl_to_tgsi: Add method to collect some statistics
  mesa/st: glsl_to_tgsi: Split arrays who's elements are only accessed
    directly
  mesa/st/glsl_to_tgsi: Properly resolve life times simple if/else + use
    constructs
  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 track array live range
  mesa/st/glsl_to_tgsi:Add array merge logic
  mesa/st/tests: Add tests for array merge helper classes.
  mesa/st/glsl_to_tgsi: rename access_record to register_merge_record
    and some more renames
  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         | 205 +++++-
 .../state_tracker/st_glsl_to_tgsi_array_merge.cpp  | 739 +++++++++++++++++++++
 .../state_tracker/st_glsl_to_tgsi_array_merge.h    | 186 ++++++
 .../state_tracker/st_glsl_to_tgsi_temprename.cpp   | 304 ++++++---
 .../state_tracker/st_glsl_to_tgsi_temprename.h     |  45 +-
 src/mesa/state_tracker/tests/Makefile.am           |  20 +-
 src/mesa/state_tracker/tests/meson.build           |  14 +
 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           |  33 +-
 13 files changed, 1760 insertions(+), 131 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.16.1



More information about the mesa-dev mailing list