summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-11-01 12:02:05 -0700
committerEric Anholt <eric@anholt.net>2013-11-01 12:36:22 -0700
commit703de8e8150dc8bdff44f56e50cced1456b54269 (patch)
tree868a2ef916e132302626163966b722ace55b607d
parentccfaca5d1f641d7909cf98fd2e065454acc67851 (diff)
Skip counting the second pair of an instruction in 16-wide mode.
Generally we want our count to approximate time, and the two SIMD8 instructions are same time as a SIMD16 instruction, except for the cost to instruction cache pressure. This pattern happens for MAD and LRP a lot, and there are other cases, too. Double-counting these meant that we basically couldn't use shader-db to validate optimizations involving those instructions.
-rwxr-xr-xrun.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/run.py b/run.py
index 4c12f2d..025ec2e 100755
--- a/run.py
+++ b/run.py
@@ -72,10 +72,12 @@ def run_test(filename):
re_fs_16 = re.compile("^Native code for fragment.*16-wide")
re_vs = re.compile("^Native code for vertex")
re_align = re.compile("{ align")
+ re_2q = re.compile("\(8\).* 2Q };")
counts["ignore"] = 0
counts["vs "] = 0
counts["fs8 "] = 0
counts["fs16"] = 0
+ last_was_paired8 = False
for line in lines:
if (re_builtin_shader.search(line)):
current_type = "ignore"
@@ -86,7 +88,11 @@ def run_test(filename):
elif (re_fs_16.search(line)):
current_type = "fs16"
elif (re_align.search(line)):
- counts[current_type] = counts[current_type] + 1
+ # 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
del counts["ignore"]
timestr = " {:.3f} secs".format(timeafter - timebefore)