Skip to content

nir: add a new ubo uniform loading intrinsic for intel

What does this MR do and why?

This MR try to optimize UBO loads on Intel when the offset is uniform by reducing register pressure.

Iris shader-db run on DG2 :

total instructions in shared programs: 21686123 -> 21722889 (0.17%)
instructions in affected programs: 1539333 -> 1576099 (2.39%)
helped: 812
HURT: 2049
helped stats (abs) min: 1 max: 57 x̄: 6.08 x̃: 2
helped stats (rel) min: 0.02% max: 29.21% x̄: 1.54% x̃: 0.75%
HURT stats (abs)   min: 1 max: 489 x̄: 20.35 x̃: 3
HURT stats (rel)   min: 0.04% max: 45.45% x̄: 2.97% x̃: 1.37%
95% mean confidence interval for instructions value: 10.86 14.85
95% mean confidence interval for instructions %-change: 1.53% 1.85%
Instructions are HURT.

total loops in shared programs: 5857 -> 5857 (0.00%)
loops in affected programs: 0 -> 0
helped: 0
HURT: 0

total cycles in shared programs: 829144050 -> 832042372 (0.35%)
cycles in affected programs: 125170935 -> 128069257 (2.32%)
helped: 1460
HURT: 1973
helped stats (abs) min: 1 max: 100364 x̄: 1115.54 x̃: 30
helped stats (rel) min: <.01% max: 68.16% x̄: 4.11% x̃: 1.55%
HURT stats (abs)   min: 1 max: 93858 x̄: 2294.48 x̃: 45
HURT stats (rel)   min: <.01% max: 80.65% x̄: 5.41% x̃: 1.31%
95% mean confidence interval for cycles value: 552.95 1135.55
95% mean confidence interval for cycles %-change: 1.06% 1.65%
Cycles are HURT.

total spills in shared programs: 8471 -> 8366 (-1.24%)
spills in affected programs: 7705 -> 7600 (-1.36%)
helped: 29
HURT: 2

total fills in shared programs: 7374 -> 7379 (0.07%)
fills in affected programs: 5328 -> 5333 (0.09%)
helped: 25
HURT: 2

total sends in shared programs: 1034795 -> 1031338 (-0.33%)
sends in affected programs: 33129 -> 29672 (-10.43%)
helped: 990
HURT: 0
helped stats (abs) min: 1 max: 22 x̄: 3.49 x̃: 3
helped stats (rel) min: 1.72% max: 60.00% x̄: 15.03% x̃: 14.29%
95% mean confidence interval for sends value: -3.71 -3.27
95% mean confidence interval for sends %-change: -15.65% -14.41%
Sends are helped.

LOST:   28
GAINED: 210

shader-db on a number of VK/DX titles on DG2 :

Totals:
Instrs: 251749 -> 251797 (+0.02%); split: -0.05%, +0.07%
Cycles: 3818502 -> 3811377 (-0.19%); split: -0.32%, +0.13%

Totals from 204 (10.58% of 1928) affected shaders:
Instrs: 56896 -> 56944 (+0.08%); split: -0.24%, +0.32%
Cycles: 601141 -> 594016 (-1.19%); split: -2.01%, +0.83%

 PERCENTAGE DELTAS  Shaders   Instrs    Cycles  
 age_of_wonders_III 1928      +0.02%    -0.19%  
 ------------------------------------------------
 All affected       204       +0.08%    -1.19%  
 ------------------------------------------------
 Total              1928      +0.02%    -0.19%  
*** Shaders only in 'after' results are ignored:
assassins_creed_odyssey/f55fdc0f17039179/fs.32, assassins_creed_odyssey/38ce6eb033bad3ad/fs.32, assassins_creed_odyssey/3fb2921f1c70cef5/fs.32, assassins_creed_odyssey/ee2f9a5ca9c8abdc/fs.16, assassins_creed_odyssey/fca6b98690634bcd/fs.16, and 5 more
from 1 apps: assassins_creed_odyssey

*** Shaders only in 'before' results are ignored:
assassins_creed_odyssey/6b9aebea5cba8ba4/fs.32
from 1 apps: assassins_creed_odyssey

Totals:
Instrs: 1216979 -> 1230229 (+1.09%); split: -0.56%, +1.65%
Cycles: 395999490 -> 394797881 (-0.30%); split: -1.64%, +1.34%
Send messages: 53122 -> 52972 (-0.28%)
Spill count: 4569 -> 4153 (-9.10%)
Fill count: 7934 -> 7596 (-4.26%)
Max live registers: 112208 -> 111509 (-0.62%); split: -0.63%, +0.01%
Max dispatch width: 31976 -> 32192 (+0.68%); split: +0.78%, -0.10%

Totals from 616 (29.07% of 2119) affected shaders:
Instrs: 883738 -> 896988 (+1.50%); split: -0.77%, +2.27%
Cycles: 388913130 -> 387711521 (-0.31%); split: -1.67%, +1.36%
Send messages: 35371 -> 35221 (-0.42%)
Spill count: 4569 -> 4153 (-9.10%)
Fill count: 7934 -> 7596 (-4.26%)
Max live registers: 57335 -> 56636 (-1.22%); split: -1.24%, +0.02%
Max dispatch width: 7240 -> 7456 (+2.98%); split: +3.43%, -0.44%

 PERCENTAGE DELTAS       Shaders   Instrs    Cycles  Send messages Spill count Fill count Max live registers Max dispatch width 
 assassins_creed_odyssey 2119      +1.09%    -0.30%      -0.28%       -9.10%     -4.26%         -0.62%             +0.68%       
 --------------------------------------------------------------------------------------------------------------------------------
 All affected            616       +1.50%    -0.31%      -0.42%       -9.10%     -4.26%         -1.22%             +2.98%       
 --------------------------------------------------------------------------------------------------------------------------------
 Total                   2119      +1.09%    -0.30%      -0.28%       -9.10%     -4.26%         -0.62%             +0.68%       
Totals:
Instrs: 85425 -> 85549 (+0.15%); split: -0.09%, +0.24%
Cycles: 1666970 -> 1682208 (+0.91%); split: -0.08%, +1.00%
Spill count: 1047 -> 1044 (-0.29%)
Fill count: 110 -> 102 (-7.27%)
Max live registers: 5496 -> 5478 (-0.33%)

Totals from 6 (2.23% of 269) affected shaders:
Instrs: 53276 -> 53400 (+0.23%); split: -0.15%, +0.38%
Cycles: 1137044 -> 1152282 (+1.34%); split: -0.12%, +1.46%
Spill count: 1047 -> 1044 (-0.29%)
Fill count: 110 -> 102 (-7.27%)
Max live registers: 641 -> 623 (-2.81%)

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  Spill count Fill count Max live registers 
 aztec_ruins_high  269       +0.15%    +0.91%     -0.29%     -7.27%         -0.33%       
 -----------------------------------------------------------------------------------------
 All affected      6         +0.23%    +1.34%     -0.29%     -7.27%         -2.81%       
 -----------------------------------------------------------------------------------------
 Total             269       +0.15%    +0.91%     -0.29%     -7.27%         -0.33%       
Totals:
Instrs: 7661376 -> 7662177 (+0.01%)
Cycles: 148636149 -> 148639571 (+0.00%); split: -0.00%, +0.00%

Totals from 18 (0.17% of 10301) affected shaders:
Instrs: 11689 -> 12490 (+6.85%)
Cycles: 300698 -> 304120 (+1.14%); split: -0.47%, +1.61%

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  
 cyberpunk_2077    10301     +0.01%    +0.00%  
 -----------------------------------------------
 All affected      18        +6.85%    +1.14%  
 -----------------------------------------------
 Total             10301     +0.01%    +0.00%  
*** Shaders only in 'after' results are ignored:
dark_souls_3_dxvk_g2/10a17e0c3f123b7a/fs.32
from 1 apps: dark_souls_3_dxvk_g2

Totals:
Instrs: 293388 -> 293639 (+0.09%); split: -0.09%, +0.17%
Cycles: 5234657 -> 5243076 (+0.16%); split: -0.50%, +0.66%
Max live registers: 48021 -> 48124 (+0.21%); split: -0.05%, +0.27%
Max dispatch width: 26032 -> 26064 (+0.12%)

Totals from 182 (12.82% of 1420) affected shaders:
Instrs: 122928 -> 123179 (+0.20%); split: -0.21%, +0.41%
Cycles: 2001356 -> 2009775 (+0.42%); split: -1.31%, +1.73%
Max live registers: 10963 -> 11066 (+0.94%); split: -0.24%, +1.18%
Max dispatch width: 2368 -> 2400 (+1.35%)

 PERCENTAGE DELTAS    Shaders   Instrs    Cycles  Max live registers Max dispatch width 
 dark_souls_3_dxvk_g2 1420      +0.09%    +0.16%        +0.21%             +0.12%       
 ----------------------------------------------------------------------------------------
 All affected         182       +0.20%    +0.42%        +0.94%             +1.35%       
 ----------------------------------------------------------------------------------------
 Total                1420      +0.09%    +0.16%        +0.21%             +0.12%       
Totals:
Instrs: 238158 -> 238182 (+0.01%); split: -0.00%, +0.01%
Cycles: 6620708 -> 6620016 (-0.01%); split: -0.01%, +0.00%

Totals from 11 (0.92% of 1195) affected shaders:
Instrs: 5010 -> 5034 (+0.48%); split: -0.04%, +0.52%
Cycles: 52050 -> 51358 (-1.33%); split: -1.34%, +0.01%

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  
 doom_2016_g2      1195      +0.01%    -0.01%  
 -----------------------------------------------
 All affected      11        +0.48%    -1.33%  
 -----------------------------------------------
 Total             1195      +0.01%    -0.01%  
Totals:
Instrs: 275579 -> 275570 (-0.00%); split: -0.01%, +0.00%
Cycles: 3758875 -> 3759224 (+0.01%); split: -0.00%, +0.01%

Totals from 35 (2.21% of 1581) affected shaders:
Instrs: 12259 -> 12250 (-0.07%); split: -0.16%, +0.09%
Cycles: 78699 -> 79048 (+0.44%); split: -0.03%, +0.48%

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  
 dota2_g2          1581      -0.00%    +0.01%  
 -----------------------------------------------
 All affected      35        -0.07%    +0.44%  
 -----------------------------------------------
 Total             1581      -0.00%    +0.01%  
Totals:
Instrs: 374964 -> 377672 (+0.72%); split: -0.05%, +0.77%
Cycles: 7798955 -> 8451974 (+8.37%); split: -0.05%, +8.42%
Spill count: 618 -> 717 (+16.02%)
Fill count: 2372 -> 2542 (+7.17%)
Scratch Memory Size: 16384 -> 32768 (+100.00%)
Max live registers: 55337 -> 55605 (+0.48%); split: -0.01%, +0.50%

Totals from 186 (11.36% of 1638) affected shaders:
Instrs: 99646 -> 102354 (+2.72%); split: -0.20%, +2.91%
Cycles: 3682951 -> 4335970 (+17.73%); split: -0.10%, +17.83%
Spill count: 618 -> 717 (+16.02%)
Fill count: 2372 -> 2542 (+7.17%)
Scratch Memory Size: 16384 -> 32768 (+100.00%)
Max live registers: 8469 -> 8737 (+3.16%); split: -0.09%, +3.26%

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  Spill count Fill count Scratch Memory Size Max live registers 
 fallout_4_dxvk_g2 1638      +0.72%    +8.37%    +16.02%     +7.17%         +100.00%            +0.48%       
 -------------------------------------------------------------------------------------------------------------
 All affected      186       +2.72%   +17.73%    +16.02%     +7.17%         +100.00%            +3.16%       
 -------------------------------------------------------------------------------------------------------------
 Total             1638      +0.72%    +8.37%    +16.02%     +7.17%         +100.00%            +0.48%       
*** Shaders only in 'after' results are ignored:
red_dead_redemption2/415c41b399d40ac1/fs.32
from 1 apps: red_dead_redemption2

Totals:
Instrs: 3387225 -> 3394260 (+0.21%); split: -0.06%, +0.26%
Cycles: 5421668115 -> 5508842483 (+1.61%); split: -0.00%, +1.61%
Send messages: 168596 -> 168526 (-0.04%)
Spill count: 7202 -> 7203 (+0.01%)
Fill count: 16682 -> 16691 (+0.05%)
Max live registers: 268516 -> 267956 (-0.21%); split: -0.22%, +0.01%
Max dispatch width: 90392 -> 90424 (+0.04%)

Totals from 459 (7.69% of 5969) affected shaders:
Instrs: 792582 -> 799617 (+0.89%); split: -0.24%, +1.13%
Cycles: 5274644426 -> 5361818794 (+1.65%); split: -0.00%, +1.66%
Send messages: 38996 -> 38926 (-0.18%)
Spill count: 534 -> 535 (+0.19%)
Fill count: 900 -> 909 (+1.00%)
Max live registers: 38807 -> 38247 (-1.44%); split: -1.50%, +0.06%
Max dispatch width: 6432 -> 6464 (+0.50%)

 PERCENTAGE DELTAS    Shaders   Instrs    Cycles  Send messages Spill count Fill count Max live registers Max dispatch width 
 red_dead_redemption2 5969      +0.21%    +1.61%      -0.04%       +0.01%     +0.05%         -0.21%             +0.04%       
 -----------------------------------------------------------------------------------------------------------------------------
 All affected         459       +0.89%    +1.65%      -0.18%       +0.19%     +1.00%         -1.44%             +0.50%       
 -----------------------------------------------------------------------------------------------------------------------------
 Total                5969      +0.21%    +1.61%      -0.04%       +0.01%     +0.05%         -0.21%             +0.04%       
*** Shaders only in 'after' results are ignored:
rise_of_the_tomb_raider_g2/eb160a692b239ca4/fs.32, rise_of_the_tomb_raider_g2/b6c5ca06eb07c3b1/fs.32, rise_of_the_tomb_raider_g2/34a25df4eb99aa16/fs.32, rise_of_the_tomb_raider_g2/c0524be200e4b94c/fs.32, rise_of_the_tomb_raider_g2/763cfb60d22fc61d/fs.32, and 178 more
from 1 apps: rise_of_the_tomb_raider_g2

*** Shaders only in 'before' results are ignored:
rise_of_the_tomb_raider_g2/237bb764c4a84ac1/fs.32, rise_of_the_tomb_raider_g2/9864b873fa08b99d/fs.32, rise_of_the_tomb_raider_g2/26caf017d83f0e4f/fs.32, rise_of_the_tomb_raider_g2/11d3981fab2eb3dc/fs.32, rise_of_the_tomb_raider_g2/2711416714a7e0f7/fs.32, and 60 more
from 1 apps: rise_of_the_tomb_raider_g2

Totals:
Instrs: 3309177 -> 3382217 (+2.21%); split: -0.03%, +2.24%
Cycles: 1933715052 -> 1958611910 (+1.29%); split: -0.27%, +1.56%
Send messages: 177145 -> 174962 (-1.23%)
Max live registers: 503710 -> 501892 (-0.36%); split: -0.47%, +0.11%
Max dispatch width: 182992 -> 186720 (+2.04%); split: +3.17%, -1.14%

Totals from 4090 (33.72% of 12129) affected shaders:
Instrs: 1579934 -> 1652974 (+4.62%); split: -0.07%, +4.69%
Cycles: 623995314 -> 648892172 (+3.99%); split: -0.84%, +4.82%
Send messages: 75651 -> 73468 (-2.89%)
Max live registers: 192711 -> 190893 (-0.94%); split: -1.23%, +0.29%
Max dispatch width: 77536 -> 81264 (+4.81%); split: +7.49%, -2.68%

 PERCENTAGE DELTAS          Shaders   Instrs    Cycles  Send messages Max live registers Max dispatch width 
 rise_of_the_tomb_raider_g2 12129     +2.21%    +1.29%      -1.23%          -0.36%             +2.04%       
 ------------------------------------------------------------------------------------------------------------
 All affected               4090      +4.62%    +3.99%      -2.89%          -0.94%             +4.81%       
 ------------------------------------------------------------------------------------------------------------
 Total                      12129     +2.21%    +1.29%      -1.23%          -0.36%             +2.04%       
Totals:
Instrs: 107959 -> 108051 (+0.09%); split: -0.12%, +0.21%
Cycles: 1991475 -> 1988857 (-0.13%); split: -0.51%, +0.38%
Send messages: 5529 -> 5525 (-0.07%)
Max live registers: 14268 -> 14264 (-0.03%); split: -0.07%, +0.04%

Totals from 80 (23.67% of 338) affected shaders:
Instrs: 46086 -> 46178 (+0.20%); split: -0.29%, +0.49%
Cycles: 868424 -> 865806 (-0.30%); split: -1.17%, +0.87%
Send messages: 2457 -> 2453 (-0.16%)
Max live registers: 5398 -> 5394 (-0.07%); split: -0.19%, +0.11%

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  Send messages Max live registers 
 shooter_demo_g2   338       +0.09%    -0.13%      -0.07%          -0.03%       
 --------------------------------------------------------------------------------
 All affected      80        +0.20%    -0.30%      -0.16%          -0.07%       
 --------------------------------------------------------------------------------
 Total             338       +0.09%    -0.13%      -0.07%          -0.03%       
Totals:
Instrs: 225362 -> 225510 (+0.07%); split: -0.12%, +0.18%
Cycles: 3631441 -> 3601910 (-0.81%); split: -1.15%, +0.34%
Send messages: 11026 -> 11016 (-0.09%)
Max live registers: 28783 -> 28753 (-0.10%)

Totals from 160 (23.09% of 693) affected shaders:
Instrs: 100063 -> 100211 (+0.15%); split: -0.26%, +0.41%
Cycles: 1551619 -> 1522088 (-1.90%); split: -2.69%, +0.79%
Send messages: 4366 -> 4356 (-0.23%)
Max live registers: 9121 -> 9091 (-0.33%)

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  Send messages Max live registers 
 shooter-game      693       +0.07%    -0.81%      -0.09%          -0.10%       
 --------------------------------------------------------------------------------
 All affected      160       +0.15%    -1.90%      -0.23%          -0.33%       
 --------------------------------------------------------------------------------
 Total             693       +0.07%    -0.81%      -0.09%          -0.10%       
Totals:

Totals from 0 (0.00% of 4123) affected shaders:

 PERCENTAGE DELTAS Shaders 
 strange_brigade   4123    
 ---------------------------
 All affected      0       
 ---------------------------
 Total             4123    
Totals:
Instrs: 776392 -> 776501 (+0.01%); split: -0.00%, +0.01%
Cycles: 13858079 -> 13866919 (+0.06%); split: -0.00%, +0.06%

Totals from 20 (0.84% of 2367) affected shaders:
Instrs: 9587 -> 9696 (+1.14%); split: -0.06%, +1.20%
Cycles: 142886 -> 151726 (+6.19%); split: -0.01%, +6.20%

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  
 strange_brigade   2367      +0.01%    +0.06%  
 -----------------------------------------------
 All affected      20        +1.14%    +6.19%  
 -----------------------------------------------
 Total             2367      +0.01%    +0.06%  
*** Shaders only in 'after' results are ignored:
talos_g2/f6674d87942423b4/fs.32
from 1 apps: talos_g2

Totals:
Instrs: 356623 -> 357940 (+0.37%)
Cycles: 4086452 -> 4241746 (+3.80%)
Send messages: 11041 -> 10946 (-0.86%)
Max live registers: 52687 -> 52336 (-0.67%)
Max dispatch width: 16968 -> 17000 (+0.19%)

Totals from 97 (8.51% of 1140) affected shaders:
Instrs: 42293 -> 43610 (+3.11%)
Cycles: 716561 -> 871855 (+21.67%)
Send messages: 713 -> 618 (-13.32%)
Max live registers: 4267 -> 3916 (-8.23%)
Max dispatch width: 792 -> 824 (+4.04%)

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  Send messages Max live registers Max dispatch width 
 talos_g2          1140      +0.37%    +3.80%      -0.86%          -0.67%             +0.19%       
 ---------------------------------------------------------------------------------------------------
 All affected      97        +3.11%   +21.67%     -13.32%          -8.23%             +4.04%       
 ---------------------------------------------------------------------------------------------------
 Total             1140      +0.37%    +3.80%      -0.86%          -0.67%             +0.19%       
*** Shaders only in 'after' results are ignored:
total_war_warhammer2/d463b1c82061c81a/fs.16
from 1 apps: total_war_warhammer2

Totals:
Instrs: 162675 -> 163041 (+0.22%); split: -0.07%, +0.30%
Cycles: 4373972 -> 4377282 (+0.08%); split: -0.16%, +0.24%
Max live registers: 17238 -> 17178 (-0.35%); split: -0.36%, +0.01%
Max dispatch width: 7936 -> 7944 (+0.10%)

Totals from 43 (9.01% of 477) affected shaders:
Instrs: 54093 -> 54459 (+0.68%); split: -0.21%, +0.89%
Cycles: 1077034 -> 1080344 (+0.31%); split: -0.66%, +0.97%
Max live registers: 3048 -> 2988 (-1.97%); split: -2.03%, +0.07%
Max dispatch width: 632 -> 640 (+1.27%)

 PERCENTAGE DELTAS    Shaders   Instrs    Cycles  Max live registers Max dispatch width 
 total_war_warhammer2 477       +0.22%    +0.08%        -0.35%             +0.10%       
 ----------------------------------------------------------------------------------------
 All affected         43        +0.68%    +0.31%        -1.97%             +1.27%       
 ----------------------------------------------------------------------------------------
 Total                477       +0.22%    +0.08%        -0.35%             +0.10%       
Totals:
Instrs: 306751 -> 308641 (+0.62%); split: -0.10%, +0.72%
Cycles: 10162529 -> 8937061 (-12.06%); split: -12.78%, +0.72%
Subgroup size: 13840 -> 13848 (+0.06%)
Send messages: 12363 -> 12345 (-0.15%); split: -0.16%, +0.02%
Max live registers: 40623 -> 40524 (-0.24%)

Totals from 160 (14.88% of 1075) affected shaders:
Instrs: 158120 -> 160010 (+1.20%); split: -0.20%, +1.40%
Cycles: 5857694 -> 4632226 (-20.92%); split: -22.17%, +1.25%
Subgroup size: 1904 -> 1912 (+0.42%)
Send messages: 6152 -> 6134 (-0.29%); split: -0.33%, +0.03%
Max live registers: 10400 -> 10301 (-0.95%)

 PERCENTAGE DELTAS Shaders   Instrs    Cycles  Subgroup size Send messages Max live registers 
 witcher_3_dxvk_g2 1075      +0.62%   -12.06%      +0.06%        -0.15%          -0.24%       
 ----------------------------------------------------------------------------------------------
 All affected      160       +1.20%   -20.92%      +0.42%        -0.29%          -0.95%       
 ----------------------------------------------------------------------------------------------
 Total             1075      +0.62%   -12.06%      +0.06%        -0.15%          -0.24%       
Totals:
Instrs: 415127 -> 417303 (+0.52%); split: -0.03%, +0.55%
Cycles: 16177569 -> 16251017 (+0.45%); split: -1.28%, +1.73%
Send messages: 15679 -> 15586 (-0.59%)
Max live registers: 39937 -> 39925 (-0.03%); split: -0.03%, +0.00%

Totals from 120 (10.80% of 1111) affected shaders:
Instrs: 165554 -> 167730 (+1.31%); split: -0.07%, +1.39%
Cycles: 9659366 -> 9732814 (+0.76%); split: -2.14%, +2.90%
Send messages: 6152 -> 6059 (-1.51%)
Max live registers: 10002 -> 9990 (-0.12%); split: -0.13%, +0.01%

 PERCENTAGE DELTAS      Shaders   Instrs    Cycles  Send messages Max live registers 
 wolfenstein_youngblood 1111      +0.52%    +0.45%      -0.59%          -0.03%       
 -------------------------------------------------------------------------------------
 All affected           120       +1.31%    +0.76%      -1.51%          -0.12%       
 -------------------------------------------------------------------------------------
 Total                  1111      +0.52%    +0.45%      -0.59%          -0.03%       
Edited by Lionel Landwerlin

Merge request reports