summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2014-07-09 16:58:14 -0700
committerKenneth Graunke <kenneth@whitecape.org>2014-07-13 23:32:44 -0700
commitd6abf71e6390e0aaacc675209ae6863b82b3cbf9 (patch)
tree9025788ea482119fe9bc1f5ea1cc45f51d2fd38f
parente442ad9dbe5e2c950d4a30d465d1f91e84253df2 (diff)
run.py: Use shader counts provided by mesa
Instead of counting lines to determine the number of lines in the .out file, walk the .out file looking for the results that mesa printed into the out file. (Note by Ken): This also makes run.py strict - if a shader fails to compile, it will generate an exception. This helps prevent people from commiting corrupt shader files. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
-rwxr-xr-xrun.py48
1 files changed, 18 insertions, 30 deletions
diff --git a/run.py b/run.py
index 54a1ef0..3b35fce 100755
--- a/run.py
+++ b/run.py
@@ -55,38 +55,26 @@ def run_test(filename):
with open(filename + '.out', 'w') as file:
file.write(results)
- current_type = 'UNKNOWN'
counts = {}
- lines = list(results.split('\n'))
-
- re_builtin_shader = re.compile(r"shader 0")
- re_fs_8 = re.compile(r"^Native code for .*fragment.*(8-wide|SIMD8)")
- re_fs_16 = re.compile(r"^Native code for .*fragment.*(16-wide|SIMD16)")
- re_gs = re.compile(r"^Native code for .*geometry")
- re_vs = re.compile(r"^Native code for .*vertex")
- re_align = re.compile(r"{ align")
- re_2q = re.compile(r"\(8\).* 2Q };")
- counts["vs "] = 0
- counts["gs "] = 0
- counts["fs8 "] = 0
- counts["fs16"] = 0
+
+ lines = (line for line in results.splitlines())
+ re_number = re.compile(
+ r'Native code for unnamed (fragment|vertex|geometry) shader (?P<number>\d+)')
for line in lines:
- if (re_builtin_shader.search(line)):
- continue
- elif (re_vs.search(line)):
- current_type = "vs "
- elif (re_gs.search(line)):
- current_type = "gs "
- elif (re_fs_8.search(line)):
- current_type = "fs8 "
- elif (re_fs_16.search(line)):
- current_type = "fs16"
- elif (re_align.search(line)):
- # Skip the 2Q (second half) SIMD8 instructions, since the
- # 1Q+2Q pair should be the same cost as a single 1H
- # (SIMD16) instruction, other than icache pressure.
- if current_type != "fs16" or not re_2q.search(line):
- counts[current_type] = counts[current_type] + 1
+ shader = re_number.match(line)
+ if shader and int(shader.group('number')) > 0:
+ break
+ else:
+ raise Exception('Only shader 0 found. {}'.format(filename))
+
+ re_search = re.compile(
+ r'(?P<stage>[A-Za-z0-9]+) shader\: (?P<count>\d+) instructions.')
+ for line in lines:
+ match = re_search.match(line)
+ if match is not None:
+ counts[match.group('stage')] = int(match.group('count'))
+
+ assert counts, 'File: {} does not have any shaders'.format(filename)
timestr = " {:.3f} secs".format(timeafter - timebefore)
out = ''