Skip to content

ir3, turnip: Use isam for readonly SSBO access

Connor Abbott requested to merge cwabbott0/mesa:review/tu-ssbo-isam into main

In addition to images, we can also use isam for read-only SSBO access to take advantage of the faster cache. This isn't yet possible on freedreno becase the texture array doesn't contain shadowed SSBO descriptors, but it's easier with bindless access, and the Vulkan blob already does this seemingly unconditionally.

One wrinkle is that there's nothing like the untyped modifier for isam, so fetching multiple components doesn't work (it sees it as a normal R32 textureBuffer so later components return 0) and we have to scalarize the load, resulting in more instructions. The trick introduced on a650+ of reinterpreting a 16-bit descriptor as 32-bit also doesn't work, so following the blob we need two actual descriptors per user storage descriptor, the normal 16-bit one and a 32-bit one for isam. We also have to add an extra dummy 0 coordinate which increases register pressure and adds more moves. But this is probably all counteracted by isam being much, much faster, as the experimentally-determined latency numbers attest to.

shader-db numbers:

Totals from 36605 (25.10% of 145857) affected shaders:                                                                                                                                                                                        
MaxWaves: 321398 -> 272532 (-15.20%); split: +0.23%, -15.44%                                                                                                                                                                                  
Instrs: 30958435 -> 32384824 (+4.61%); split: -0.26%, +4.87%                                                                                                                                                                                  
CodeSize: 50088144 -> 53194618 (+6.20%); split: -0.16%, +6.36%                                                                                                                                                                                
NOPs: 7189370 -> 6937303 (-3.51%); split: -4.63%, +1.12%                                                                                                                                                                                      
MOVs: 1201902 -> 2577561 (+114.46%); split: -2.61%, +117.06%                                                                                                                                                                                  
Full: 633040 -> 744724 (+17.64%); split: -0.43%, +18.07%                                                                                                                                                                                      
(ss): 762400 -> 773896 (+1.51%); split: -8.48%, +9.98%                                                                                                                                                                                        
(sy): 383279 -> 358309 (-6.51%); split: -8.90%, +2.39%                                                                                                                                                                                        
(ss)-stall: 2060567 -> 2025844 (-1.69%); split: -4.44%, +2.75%                                                                                                                                                                                
(sy)-stall: 16808165 -> 8433109 (-49.83%); split: -50.55%, +0.72%                                                                                                                                                                             
STPs: 7197 -> 35993 (+400.11%); split: -1.31%, +401.42%                                                                                                                                                                                       
LDPs: 12229 -> 46398 (+279.41%); split: -0.77%, +280.18%                                                                                                                                                                                      
Cat0: 7561862 -> 7309015 (-3.34%); split: -4.42%, +1.07%                                                                                                                                                                                      
Cat1: 1627239 -> 3159183 (+94.14%); split: -1.96%, +96.10%                                                                                                                                                                                    
Cat2: 15783357 -> 15798607 (+0.10%); split: -0.00%, +0.10%                                                                                                                                                                                    
Cat5: 403266 -> 1533190 (+280.19%)                                                                                                                                                                                                            
Cat6: 1241114 -> 243232 (-80.40%); split: -80.86%, +0.46%
Edited by Connor Abbott

Merge request reports