[Mesa-dev] [PATCH 0/4] GLSL passes begone

Thomas Helland thomashelland90 at gmail.com
Thu Apr 6 19:49:04 UTC 2017


This series has been reciding on my computer for way to long,
so it's about time I get it out there for some feedback.
The rationale is that in the glsl compiler a lot of the overhead
is in cache misses due to the visitor pattern we're running.
This is run on my intel machine.

Here are some perf stat results before and after the series
on a shader-db run on a subset of my shader-db.

Before:
56 849 919 924    cycles:u                  #    2,894 GHz                    
21 803 529 990    stalled-cycles-frontend:u #   38,35% frontend cycles idle   
82 463 039 717    instructions:u            #    1,45 insn per cycle         
                                            #    0,26  stalled cycles per insn
16 796 501 647    branches:u                #  855,182 M/sec                  
   394 313 169    branch-misses:u           #    2,35% of all branches        

20,568256999 seconds time elapsed


After:
55 956 131 481    cycles:u                  #    2,884 GHz                    
21 889 872 343    stalled-cycles-frontend:u #   39,12% frontend cycles idle   
80 666 584 607    instructions:u            #    1,44  insn per cycle         
                                            #    0,27  stalled cycles per insn
16 349 063 938    branches:u                #  842,630 M/sec                  
   383 226 870    branch-misses:u           #    2,34% of all branches        

20,342067729 seconds time elapsed

So, some things to notice:
There's a decent drop in executed instructions.
There's an increase in stalled cycles, which is not what I expected.
We are still seeing an ever so slight reduction in runtime.
Fewer branches, and fewer branch-prediction misses.

The question is if this is a route we want to go down?
Personally I think the code reduction is nice in and by itself.
Feedback is welcome =)

Thomas Helland (4):
  glsl: Consolidate opt_noop_swizzle, and opt_swizzle_swizzle
  glsl: Merge if_simplification and nested-if-flattening
  glsl: Merge if-simplification and conditional discard optimization
  glsl: Fold constant folding of assignments into constant propagation

 src/compiler/Makefile.sources                      |   4 -
 src/compiler/glsl/glsl_parser_extras.cpp           |   4 -
 src/compiler/glsl/ir_optimization.h                |   5 -
 src/compiler/glsl/opt_conditional_discard.cpp      |  88 ---------
 src/compiler/glsl/opt_constant_folding.cpp         | 211 ---------------------
 src/compiler/glsl/opt_constant_propagation.cpp     |  97 ++++++++++
 src/compiler/glsl/opt_flatten_nested_if_blocks.cpp | 103 ----------
 src/compiler/glsl/opt_if_simplification.cpp        |  95 ++++++++--
 src/compiler/glsl/opt_noop_swizzle.cpp             |  43 ++++-
 src/compiler/glsl/opt_swizzle_swizzle.cpp          |  97 ----------
 10 files changed, 223 insertions(+), 524 deletions(-)
 delete mode 100644 src/compiler/glsl/opt_conditional_discard.cpp
 delete mode 100644 src/compiler/glsl/opt_constant_folding.cpp
 delete mode 100644 src/compiler/glsl/opt_flatten_nested_if_blocks.cpp
 delete mode 100644 src/compiler/glsl/opt_swizzle_swizzle.cpp

-- 
2.11.1



More information about the mesa-dev mailing list