[PATCH] D150890: [BOLT][test] Add fdata vs yaml e2e tests

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 11:14:18 PDT 2023


Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

Add tests that check if BOLT produces the same binaries when supplied with
fdata and yaml profiles collected from the same base profile, whether 
from pre-aggregated perf profile or yaml converted from fdata.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150890

Files:
  bolt/test/X86/fdata-yaml.test
  bolt/test/runtime/meta-merge-fdata.test


Index: bolt/test/runtime/meta-merge-fdata.test
===================================================================
--- bolt/test/runtime/meta-merge-fdata.test
+++ bolt/test/runtime/meta-merge-fdata.test
@@ -42,12 +42,21 @@
 RUN: cmp %t.fdata.base %t.fdata.inst
 
 # Optimize using merged fdata
-RUN: llvm-bolt merge-fdata -o %t.opt --data %t.fdata.base \
+RUN: llvm-bolt merge-fdata -o %t.opt.fdata --data %t.fdata.base \
 RUN:   --reorder-blocks=ext-tsp --reorder-functions=hfsort+ \
-RUN:   --split-functions \
+RUN:   --split-functions --bolt-info=0 \
 RUN:   | FileCheck %s --check-prefix=CHECK-BOLT2
 CHECK-BOLT2-NOT: invalid (possibly stale) profile
 
 # Check that optimized binary produces the same result
-RUN: %t.opt %t.fdata1 %t.fdata2 > %t.fdata.opt
+RUN: %t.opt.fdata %t.fdata1 %t.fdata2 > %t.fdata.opt
 RUN: cmp %t.fdata.base %t.fdata.opt
+
+# Fdata -> yaml conversion testing
+RUN: llvm-bolt merge-fdata --aggregate-only --perfdata %t.fdata.base \
+RUN:   --profile-format=yaml -o %t.yaml.base
+RUN: llvm-bolt merge-fdata -o %t.opt.yaml --data %t.yaml.base \
+RUN:   --reorder-blocks=ext-tsp --reorder-functions=hfsort+ \
+RUN:   --split-functions --bolt-info=0 \
+RUN:   | FileCheck %s --check-prefix=CHECK-BOLT2
+RUN: cmp %t.opt.fdata %t.opt.yaml
Index: bolt/test/X86/fdata-yaml.test
===================================================================
--- /dev/null
+++ bolt/test/X86/fdata-yaml.test
@@ -0,0 +1,30 @@
+# This test checks that BOLT produces the same binary with yaml and fdata
+# profiles obtained from the same pre-aggregated perf profile.
+REQUIRES: system-linux
+
+RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe
+RUN: perf2bolt %t.exe -o %t.fdata --pa -p %p/Inputs/pre-aggregated.txt -w %t.yaml
+
+RUN: llvm-bolt %t.exe -data %t.fdata -o %t.exe.fdata \
+RUN:   --reorder-blocks=ext-tsp --split-functions --bolt-info=0
+RUN: llvm-bolt %t.exe -data %t.yaml -o %t.exe.yaml \
+RUN:   --reorder-blocks=ext-tsp --split-functions --bolt-info=0
+RUN: cmp %t.exe.fdata %t.exe.yaml
+
+# Check that converted profiles are identical:
+# fdata from pre-aggregated perf -> yaml
+# vs
+# yaml from pre-aggregated perf
+RUN: llvm-bolt %t.exe --aggregate-only \
+RUN:   --perfdata %t.fdata --profile-format=yaml -o %t.fdata.yaml
+RUN: cmp <(grep -v profile-origin %t.yaml) <(grep -v profile-origin %t.fdata.yaml)
+
+# Check that using yaml profile obtained from converting fdata produces the same
+# output binary as using the original fdata profile.
+RUN: llvm-bolt %t.exe --aggregate-only \
+RUN:   --perfdata %p/Inputs/blarge.fdata --profile-format=yaml -o %t.fdata.yaml2
+RUN: llvm-bolt %t.exe -data %p/Inputs/blarge.fdata -o %t.exe.fdata2 \
+RUN:   --reorder-blocks=ext-tsp --split-functions --bolt-info=0
+RUN: llvm-bolt %t.exe -data %t.fdata.yaml2 -o %t.exe.yaml2 \
+RUN:   --reorder-blocks=ext-tsp --split-functions --bolt-info=0
+RUN: cmp %t.exe.fdata2 %t.exe.yaml2


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150890.523458.patch
Type: text/x-patch
Size: 2892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230518/baf54491/attachment.bin>


More information about the llvm-commits mailing list