[Mesa-dev] [PATCH shader-db] si-report: Track max waves per CU

Tom Stellard thomas.stellard at amd.com
Mon Jan 4 16:21:38 PST 2016


---
 si-report.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/si-report.py b/si-report.py
index ec88112..e717af0 100755
--- a/si-report.py
+++ b/si-report.py
@@ -65,6 +65,12 @@ def get_scratch_str(value, suffixes = True):
         suffix = 'bytes per wave'
     return get_value_str(value, 'Scratch', suffix)
 
+def get_waves_per_cu_str(value, suffixes = True):
+    suffix = ''
+    if suffixes:
+        suffix = 'waves'
+    return get_value_str(value, 'Max Waves / CU', suffix)
+
 def calculate_percent_change(b, a):
     if b == 0:
         return 0
@@ -89,15 +95,17 @@ class si_stats:
         self.code_size = 0
         self.lds = 0
         self.scratch = 0
+        self.max_waves_per_cu = 0
 
 
     def to_string(self, suffixes = True):
-        return "{}{}{}{}{}".format(
+        return "{}{}{}{}{}{}".format(
                 get_sgpr_str(self.sgprs, suffixes),
                 get_vgpr_str(self.vgprs, suffixes),
                 get_code_size_str(self.code_size, suffixes),
                 get_lds_str(self.lds, suffixes),
-                get_scratch_str(self.scratch, suffixes))
+                get_scratch_str(self.scratch, suffixes),
+                get_waves_per_cu_str(self.max_waves_per_cu, suffixes))
 
 
     def __str__(self):
@@ -109,6 +117,7 @@ class si_stats:
         self.code_size += other.code_size
         self.lds += other.lds
         self.scratch += other.scratch
+        self.max_waves_per_cu += other.max_waves_per_cu
 
     def update(self, comp, cmp_fn):
         for name in self.__dict__.keys():
@@ -153,6 +162,48 @@ class si_stats:
                 return False
         return True
 
+#TODO: Handle VI+ and take LDS into account.
+def compute_max_waves_per_cu(sgprs, vgprs):
+    sgpr_waves = 10
+    if sgprs <= 48:
+        sgpr_waves = 10
+    elif sgprs <= 56:
+        sgpr_waves = 9
+    elif sgprs <= 64:
+        sgpr_waves = 8
+    elif sgprs <= 72:
+        sgpr_waves = 7
+    elif sgprs <= 80:
+        sgpr_waves = 6
+    elif sgprs <= 96:
+        sgpr_waves = 5
+    else:
+        sgpr_waves = 4
+
+    vgpr_waves = 10
+    if vgprs <= 24:
+        vgpr_waves = 10
+    elif vgprs <= 28:
+        vgpr_waves = 9
+    elif vgprs <= 32:
+        vgpr_waves = 8
+    elif vgprs <= 36:
+        vgpr_waves = 7
+    elif vgprs <= 40:
+        vgpr_waves = 6
+    elif vgprs <= 48:
+        vgpr_waves = 5
+    elif vgprs <= 64:
+        vgpr_waves = 4
+    elif vgprs <= 84:
+        vgpr_waves = 3
+    elif vgprs <= 128:
+        vgpr_waves = 2
+    else:
+        vgpr_waves = 1
+
+    return min(sgpr_waves, vgpr_waves)
+
 def get_results(filename):
     file = open(filename, "r")
     lines = file.read().split('\n')
@@ -199,6 +250,7 @@ def get_results(filename):
             current_stats.scratch = int(match.groups()[0])
             continue
 
+        current_stats.max_waves_per_cu = compute_max_waves_per_cu(current_stats.sgprs, current_stats.vgprs)
         match = re.search(re_end, line)
         if match:
             results.append(current_stats)
-- 
2.0.4



More information about the mesa-dev mailing list