aboutsummaryrefslogtreecommitdiff
path: root/bolt/test
diff options
context:
space:
mode:
authorshaw young <58664393+shawbyoung@users.noreply.github.com>2024-06-17 13:27:56 -0700
committershawbyoung <shawbyoung@gmail.com>2024-06-17 15:14:35 -0700
commit68fc8dffe4669fed1f7eb88e6770509505f9960a (patch)
tree830bc57368944cde8d5b2133680f50727792e440 /bolt/test
parent6c17f1cabdee3399feceb478921a8369bde18b16 (diff)
downloadllvm-68fc8dffe4669fed1f7eb88e6770509505f9960a.zip
llvm-68fc8dffe4669fed1f7eb88e6770509505f9960a.tar.gz
llvm-68fc8dffe4669fed1f7eb88e6770509505f9960a.tar.bz2
[BOLT] Drop high discrepancy profiles in matching (#95156)
Summary: Functions with high discrepancy (measured by matched function blocks) can be ignored with an added command line argument for better performance. Test Plan: Added stale-matching-min-matched-block.test --------- Co-authored-by: Amir Ayupov <aaupov@fb.com>
Diffstat (limited to 'bolt/test')
-rw-r--r--bolt/test/X86/Inputs/blarge_profile_stale_low_matched_blocks.yaml57
-rw-r--r--bolt/test/X86/stale-matching-min-matched-block.test10
2 files changed, 67 insertions, 0 deletions
diff --git a/bolt/test/X86/Inputs/blarge_profile_stale_low_matched_blocks.yaml b/bolt/test/X86/Inputs/blarge_profile_stale_low_matched_blocks.yaml
new file mode 100644
index 0000000..785e239
--- /dev/null
+++ b/bolt/test/X86/Inputs/blarge_profile_stale_low_matched_blocks.yaml
@@ -0,0 +1,57 @@
+---
+header:
+ profile-version: 1
+ binary-name: 'reader-yaml.test.tmp.exe'
+ binary-build-id: '<unknown>'
+ profile-flags: [ lbr ]
+ profile-origin: branch profile reader
+ profile-events: ''
+ dfs-order: false
+ hash-func: xxh3
+functions:
+ - name: SolveCubic
+ fid: 6
+ hash: 0x0000000000000000
+ exec: 151
+ nblocks: 18
+ blocks:
+ - bid: 0
+ insns: 43
+ hash: 0x4600940a609c0000
+ exec: 151
+ succ: [ { bid: 1, cnt: 151, mis: 2 }, { bid: 7, cnt: 0 } ]
+ - bid: 1
+ insns: 7
+ hash: 0x167a1f084f130088
+ succ: [ { bid: 13, cnt: 151 }, { bid: 2, cnt: 0 } ]
+ - bid: 13
+ insns: 26
+ hash: 0xa8d50000f81902a7
+ succ: [ { bid: 3, cnt: 89 }, { bid: 2, cnt: 10 } ]
+ - bid: 3
+ insns: 9
+ hash: 0xc516000073dc00a0
+ succ: [ { bid: 5, cnt: 151 } ]
+ - bid: 5
+ insns: 9
+ hash: 0x6446e1ea500111
+ - name: usqrt
+ fid: 7
+ hash: 0x0000000000000000
+ exec: 20
+ nblocks: 6
+ blocks:
+ - bid: 0
+ insns: 4
+ hash: 0x0000000000000001
+ exec: 20
+ succ: [ { bid: 1, cnt: 0 } ]
+ - bid: 1
+ insns: 9
+ hash: 0x0000000000000001
+ succ: [ { bid: 3, cnt: 320, mis: 171 }, { bid: 2, cnt: 0 } ]
+ - bid: 3
+ insns: 2
+ hash: 0x0000000000000001
+ succ: [ { bid: 1, cnt: 300, mis: 33 }, { bid: 4, cnt: 20 } ]
+...
diff --git a/bolt/test/X86/stale-matching-min-matched-block.test b/bolt/test/X86/stale-matching-min-matched-block.test
new file mode 100644
index 0000000..383d4d7
--- /dev/null
+++ b/bolt/test/X86/stale-matching-min-matched-block.test
@@ -0,0 +1,10 @@
+## This script checks the stale-matching-min-matched-block flag.
+
+RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe
+
+## Testing "usqrt"
+RUN: llvm-bolt %t.exe -o %t.null --b %p/Inputs/blarge_profile_stale_low_matched_blocks.yaml \
+RUN: --infer-stale-profile=1 --stale-matching-min-matched-block=75 \
+RUN: --profile-ignore-hash=1 --debug-only=bolt-prof 2>&1 | FileCheck %s
+
+CHECK: BOLT-INFO: inferred profile for 1 (50.00% of profiled, 50.00% of stale) functions responsible for 46.31% samples (552 out of 1192)