Skip to content

WIP: aco: A few more uniform bool optimizations

Timur Kristóf requested to merge Venemo/mesa:aco-more-unibool into main

These are a few more simple uniform boolean optimizations. They don't have any notable effect on our pipeline db, but they do help some other games. The pathological case that illustrates the usefulness is this pipeline test from Dead or Alive 6.

What it does is it makes it possible to transform the uniform per-lane boolean s_not into a 32-bit instruction performed on a 1-bit boolean in the same way how s_and, s_or, etc. are handled.

In the following example, in "before" the s[14:15] is a per-lane boolean (resulting from some s_cselect instructions), while in "after" the s14 is a 1-bit boolean (resulting from the SCC of a preceding boolean instruction).

Before:

BB34:
	s_not_b64 s[14:15], s[14:15]   ; NOTE: s[14:15] is a per-lane boolean that comes from an s_cselect
	s_and_b32 s3, src_scc, s3
	s_cmp_lg_i32 s3, 0
	s_cbranch_scc0 BB64

After:

BB34:
	s_andn2_b32 s3, s3, s14   ; NOTE: s14 is a 1-bit boolean that comes from the SCC of a previous instruction
	s_cbranch_scc0 BB64

Here are the pipeline DB results. As mentioned before there is not much effect, but it does help some games here and also one not in our pipeline DB.

 PERCENTAGE DELTAS    Shaders     SGPRs     VGPRs SpillSGPR SpillVGPR  PrivVGPR   Scratch  CodeSize  MaxWaves     Waits
 battlefront2            4566     .         .         .         .         .         .         .         .         .    
 britannia                465     .         .         .         .         .         .         .         .         .    
 dark_souls_3           11975     .         .         .         .         .         .         .         .         .    
 detroit_become_human   19417     .         .         .         .         .         .       -0.09 %     .         .    
 deus_ex_md              8063     .         .         .         .         .         .         .         .         .    
 dirt4                   4030     .         .         .         .         .         .         .         .         .    
 doom                    5775     .         .         .         .         .         .         .         .         .    
 dota2                    985     .         .         .         .         .         .         .         .         .    
 dow3                     294     .         .         .         .         .         .         .         .         .    
 evilwithin_demo          740     .         .         .         .         .         .         .         .         .    
 f12017                  5462     .         .         .         .         .         .         .         .         .    
 gtav                    2955     .         .         .         .         .         .         .         .         .    
 hitman                  3131     .         .         .         .         .         .         .         .         .    
 madmax                   922     .         .         .         .         .         .         .         .         .    
 nier                    7030     .         .         .         .         .         .         .         .         .    
 redout                  2488     .         .         .         .         .         .         .         .         .    
 rottr                   8039     .         .         .         .         .         .         .         .         .    
 shadowofmordor          2055     .         .         .         .         .         .         .         .         .    
 sottr_demo              5620     .         .         .         .         .         .         .         .         .    
 strange_brigade         1412   -0.34 %     .         .         .         .         .       -0.06 %     .         .    
 talos                    782     .         .         .         .         .         .         .         .         .    
 thewitness              3150     .         .         .         .         .         .         .         .         .    
 threekingdoms            887     .         .         .         .         .         .         .         .         .    
 warhammer2              1871     .         .         .         .         .         .         .         .         .    
 worldofwarships         8536     .         .         .         .         .         .         .         .         .    
 youngblood               843     .         .         .         .         .         .         .         .         .    
 ----------------------------------------------------------------------------------------------------------------------
 All affected            7162   -0.03 %     .         .         .         .         .       -0.11 %     .         .    
 ----------------------------------------------------------------------------------------------------------------------
 Total                 111493     .         .         .         .         .         .       -0.03 %     .         .    
Edited by Timur Kristóf

Merge request reports

Loading