Skip to content
  • Francisco Jerez's avatar
    intel/fs: Implement GRF bank conflict mitigation pass. · af2c3201
    Francisco Jerez authored
    
    
    Unnecessary GRF bank conflicts increase the issue time of ternary
    instructions (the overwhelmingly most common of which is MAD) by
    roughly 50%, leading to reduced ALU throughput.  This pass attempts to
    minimize the number of bank conflicts by rearranging the layout of the
    GRF space post-register allocation.  It's in general not possible to
    eliminate all of them without introducing extra copies, which are
    typically more expensive than the bank conflict itself.
    
    In a shader-db run on SKL this helps roughly 46k shaders:
    
       total conflicts in shared programs: 1008981 -> 600461 (-40.49%)
       conflicts in affected programs: 816222 -> 407702 (-50.05%)
       helped: 46234
       HURT: 72
    
    The running time of shader-db itself on SKL seems to be increased by
    roughly 2.52%±1.13% with n=20 due to the additional work done by the
    compiler back-end.
    
    On earlier generations the pass is somewhat less effective in relative
    terms because the hardware incurs a bank conflict anytime the last two
    sources of the instruction are duplicate (e.g. while trying to square
    a value using MAD), which is impossible to avoid without introducing
    copies.  E.g. for a shader-db run on SNB:
    
       total conflicts in shared programs: 944636 -> 623185 (-34.03%)
       conflicts in affected programs: 853258 -> 531807 (-37.67%)
       helped: 31052
       HURT: 19
    
    And on BDW:
    
       total conflicts in shared programs: 1418393 -> 987539 (-30.38%)
       conflicts in affected programs: 1179787 -> 748933 (-36.52%)
       helped: 47592
       HURT: 70
    
    On SKL GT4e this improves performance of GpuTest Volplosion by 3.64%
    ±0.33% with n=16.
    
    NOTE: This patch intentionally disregards some i965 coding conventions
          for the sake of reviewability.  This is addressed by the next
          squash patch which introduces an amount of (for the most part
          boring) boilerplate that might distract reviewers from the
          non-trivial algorithmic details of the pass.
    
    The following patch is squashed in:
    
    SQUASH: intel/fs/bank_conflicts: Roll back to the nineties.
    
    Acked-by: default avatarMatt Turner <mattst88@gmail.com>
    af2c3201