[PATCH] D122442: [CSSPGO] Turn on profi and ext-tsp when using probe-based profile.
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 24 18:09:13 PDT 2022
hoy updated this revision to Diff 418099.
hoy added a comment.
Fixing test failures by explictly turning off profi.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122442/new/
https://reviews.llvm.org/D122442
Files:
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/function_metadata.ll
llvm/test/Transforms/SampleProfile/profile-correlation-irreducible-loops.ll
llvm/test/Transforms/SampleProfile/pseudo-probe-profile-metadata.ll
llvm/test/Transforms/SampleProfile/pseudo-probe-profile.ll
Index: llvm/test/Transforms/SampleProfile/pseudo-probe-profile.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/pseudo-probe-profile.ll
+++ llvm/test/Transforms/SampleProfile/pseudo-probe-profile.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-profile.prof -pass-remarks=sample-profile -pass-remarks-output=%t.opt.yaml -S | FileCheck %s
+; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-profile.prof -pass-remarks=sample-profile -pass-remarks-output=%t.opt.yaml -sample-profile-use-profi=0 -S | FileCheck %s
; RUN: FileCheck %s -check-prefix=YAML < %t.opt.yaml
define dso_local i32 @foo(i32 %x, void (i32)* %f) #0 !dbg !4 {
Index: llvm/test/Transforms/SampleProfile/pseudo-probe-profile-metadata.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/pseudo-probe-profile-metadata.ll
+++ llvm/test/Transforms/SampleProfile/pseudo-probe-profile-metadata.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-profile-metadata.prof -S | FileCheck %s
+; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-profile-metadata.prof -sample-profile-use-profi=0 -S | FileCheck %s
; The test verifies the presence of prof metadata for BranchInst, SwitchInst,
; and IndirectBrInst
Index: llvm/test/Transforms/SampleProfile/profile-correlation-irreducible-loops.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/profile-correlation-irreducible-loops.ll
+++ llvm/test/Transforms/SampleProfile/profile-correlation-irreducible-loops.ll
@@ -1,5 +1,5 @@
-; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profile-correlation-irreducible-loops.prof | opt -passes='print<block-freq>' -disable-output -use-iterative-bfi-inference 2>&1 | FileCheck %s
-; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profile-correlation-irreducible-loops.prof -S | FileCheck %s --check-prefix=CHECK2
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profile-correlation-irreducible-loops.prof -sample-profile-use-profi=0 | opt -passes='print<block-freq>' -disable-output -use-iterative-bfi-inference 2>&1 | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profile-correlation-irreducible-loops.prof -sample-profile-use-profi=0 -S | FileCheck %s --check-prefix=CHECK2
; RUN: opt < %s -passes='print<block-freq>' -use-iterative-bfi-inference -disable-output 2>&1 | FileCheck %s --check-prefix=CHECK3
; The C++ code for this test case is from c-parse.c in 403.gcc (SPEC2006)
Index: llvm/test/Transforms/SampleProfile/function_metadata.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/function_metadata.ll
+++ llvm/test/Transforms/SampleProfile/function_metadata.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/function_metadata.prof -S | FileCheck %s
; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/function_metadata.compact.afdo -S | FileCheck %s
-; RUN: opt < %s -passes='pseudo-probe,thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/pseudo-probe-func-metadata.prof -S | FileCheck %s
+; RUN: opt < %s -passes='pseudo-probe,thinlto-pre-link<O2>' -pgo-kind=pgo-sample-use-pipeline -profile-file=%S/Inputs/pseudo-probe-func-metadata.prof -sample-profile-use-profi=0 -S | FileCheck %s
;; Validate that with replay in effect, we import call sites even if they are below the threshold
;; Baseline import decisions
Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -2001,7 +2001,17 @@
/*EmitRemarks=*/false);
}
- // Apply tweaks if context-sensitive profile is available.
+ // Apply tweaks if context-sensitive or probe-based profile is available.
+ if (Reader->profileIsCSFlat() || Reader->profileIsCSNested() ||
+ Reader->profileIsProbeBased()) {
+ if (!UseIterativeBFIInference.getNumOccurrences())
+ UseIterativeBFIInference = true;
+ if (!SampleProfileUseProfi.getNumOccurrences())
+ SampleProfileUseProfi = true;
+ if (!EnableExtTspBlockPlacement.getNumOccurrences())
+ EnableExtTspBlockPlacement = true;
+ }
+
if (Reader->profileIsCSFlat() || Reader->profileIsCSNested()) {
ProfileIsCSFlat = Reader->profileIsCSFlat();
// Enable priority-base inliner and size inline by default for CSSPGO.
@@ -2018,17 +2028,6 @@
if (!AllowRecursiveInline.getNumOccurrences())
AllowRecursiveInline = true;
- // Enable iterative-BFI by default for CSSPGO.
- if (!UseIterativeBFIInference.getNumOccurrences())
- UseIterativeBFIInference = true;
- // Enable Profi by default for CSSPGO.
- if (!SampleProfileUseProfi.getNumOccurrences())
- SampleProfileUseProfi = true;
-
- // Enable EXT-TSP block layout for CSSPGO.
- if (!EnableExtTspBlockPlacement.getNumOccurrences())
- EnableExtTspBlockPlacement = true;
-
if (FunctionSamples::ProfileIsCSFlat) {
// Tracker for profiles under different context
ContextTracker = std::make_unique<SampleContextTracker>(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122442.418099.patch
Type: text/x-patch
Size: 5621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220325/233fe0dd/attachment.bin>
More information about the llvm-commits
mailing list