brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · 6951d09 Raw
104 lines · plain
1## This script checks that perf2bolt is reading pre-aggregated perf information2## correctly for a simple example. The perf.data of this example was generated3## with the following command:4##5##  $ perf record -j any,u -e branch -o perf.data -- ./blarge6##7##  blarge is the binary for "basicmath large inputs" taken from Mibench.8 9## Currently failing in MacOS / generating different hash for usqrt10REQUIRES: system-linux11 12RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe13RUN: perf2bolt %t.exe -o %t --pa -p %p/Inputs/pre-aggregated.txt -w %t.new \14RUN:   --show-density --heatmap %t.hm \15RUN:   --profile-density-threshold=9 --profile-density-cutoff-hot=970000 \16RUN:   --profile-use-dfs | FileCheck %s --check-prefix=CHECK-P2B17RUN: FileCheck --input-file %t.hm-section-hotness.csv --check-prefix=CHECK-HM %s18 19CHECK-P2B: HEATMAP: building heat map20CHECK-P2B: BOLT-INFO: 4 out of 7 functions in the binary (57.1%) have non-empty execution profile21CHECK-P2B: BOLT-INFO: Functions with density >= 21.7 account for 97.00% total sample counts.22CHECK-HM: .text, 0x400680, 0x401232, 100.0000, 4.2553, 0.042623 24RUN: perf2bolt %t.exe -o %t --pa -p %p/Inputs/pre-aggregated.txt -w %t.new \25RUN:   --show-density \26RUN:   --profile-density-cutoff-hot=970000 \27RUN:   --profile-use-dfs 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING28 29CHECK-WARNING: BOLT-INFO: 4 out of 7 functions in the binary (57.1%) have non-empty execution profile30CHECK-WARNING: BOLT-WARNING: BOLT is estimated to optimize better with 2.8x more samples.31CHECK-WARNING: BOLT-INFO: Functions with density >= 21.7 account for 97.00% total sample counts.32 33RUN: llvm-bolt %t.exe -data %t -o %t.null | FileCheck %s34RUN: llvm-bolt %t.exe -data %t.new -o %t.null | FileCheck %s35RUN: llvm-bolt %t.exe -p %p/Inputs/pre-aggregated.txt --pa -o %t.null | FileCheck %s36 37CHECK: BOLT-INFO: 4 out of 7 functions in the binary (57.1%) have non-empty execution profile38 39RUN: FileCheck %s -check-prefix=PERF2BOLT --input-file %t40RUN: FileCheck %s -check-prefix=NEWFORMAT --input-file %t.new41 42## Test --profile-format option with perf2bolt43RUN: perf2bolt %t.exe -o %t.fdata --pa -p %p/Inputs/pre-aggregated.txt \44RUN:   --profile-format=fdata45RUN: FileCheck %s -check-prefix=PERF2BOLT --input-file %t.fdata46 47RUN: perf2bolt %t.exe -o %t.yaml --pa -p %p/Inputs/pre-aggregated.txt \48RUN:   --profile-format=yaml --profile-use-dfs49RUN: FileCheck %s -check-prefix=NEWFORMAT --input-file %t.yaml50 51## Test --profile-format option with llvm-bolt --aggregate-only52RUN: llvm-bolt %t.exe -o %t.bolt.fdata --pa -p %p/Inputs/pre-aggregated.txt \53RUN:   --aggregate-only --profile-format=fdata54RUN: FileCheck %s -check-prefix=PERF2BOLT --input-file %t.bolt.fdata55 56RUN: llvm-bolt %t.exe -o %t.bolt.yaml --pa -p %p/Inputs/pre-aggregated.txt \57RUN:   --aggregate-only --profile-format=yaml --profile-use-dfs58RUN: FileCheck %s -check-prefix=NEWFORMAT --input-file %t.bolt.yaml59 60## Test pre-aggregated basic profile61RUN: perf2bolt %t.exe -o %t --pa -p %p/Inputs/pre-aggregated-basic.txt -o %t.ba \62RUN:   2>&1 | FileCheck %s --check-prefix=BASIC-ERROR63RUN: perf2bolt %t.exe -o %t --pa -p %p/Inputs/pre-aggregated-basic.txt -o %t.ba.nl \64RUN:   -ba 2>&1 | FileCheck %s --check-prefix=BASIC-SUCCESS65RUN: FileCheck %s --input-file %t.ba.nl --check-prefix CHECK-BASIC-BA66BASIC-ERROR: BOLT-INFO: 0 out of 7 functions in the binary (0.0%) have non-empty execution profile67BASIC-SUCCESS: BOLT-INFO: 4 out of 7 functions in the binary (57.1%) have non-empty execution profile68CHECK-BASIC-BA: no_lbr cycles69 70PERF2BOLT: 1 frame_dummy/1 1e 1 frame_dummy/1 0 0 171PERF2BOLT-NEXT: 1 main 451 1 SolveCubic 0 0 272PERF2BOLT-NEXT: 1 main 490 0 [unknown] 0 0 173PERF2BOLT-NEXT: 1 main 537 0 [unknown] 0 0 174PERF2BOLT-NEXT: 0 [unknown] 0 1 main 53c 0 275PERF2BOLT-NEXT: 1 usqrt a 1 usqrt 10 0 2276PERF2BOLT-NEXT: 1 usqrt 30 1 usqrt 32 0 2277PERF2BOLT-NEXT: 1 usqrt 30 1 usqrt 39 4 3378PERF2BOLT-NEXT: 1 usqrt 35 1 usqrt 39 0 2279PERF2BOLT-NEXT: 1 usqrt 3d 1 usqrt 10 0 5880PERF2BOLT-NEXT: 1 usqrt 3d 1 usqrt 3f 0 2281 82NEWFORMAT:  - name:            'frame_dummy/1'83NEWFORMAT:    fid:             384NEWFORMAT:    hash:            0x28C72085C0BD8D3785NEWFORMAT:    exec:            186 87NEWFORMAT:  - name:            usqrt88NEWFORMAT:    fid:             789NEWFORMAT:    exec:            090NEWFORMAT:    nblocks:         591NEWFORMAT:    blocks:92NEWFORMAT:      - bid:             093NEWFORMAT:        insns:           494NEWFORMAT:        succ:            [ { bid: 1, cnt: 22 } ]95NEWFORMAT:      - bid:             196NEWFORMAT:        insns:           997NEWFORMAT:        succ:            [ { bid: 3, cnt: 33, mis: 4 }, { bid: 2, cnt: 22 } ]98NEWFORMAT:      - bid:             299NEWFORMAT:        insns:           2100NEWFORMAT:        succ:            [ { bid: 3, cnt: 22 } ]101NEWFORMAT:      - bid:             3102NEWFORMAT:        insns:           2103NEWFORMAT:        succ:            [ { bid: 1, cnt: 58 }, { bid: 4, cnt: 22 } ]104