-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[BOLT][NFCI] Skip validation in parseLBRSample #143288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BOLT][NFCI] Skip validation in parseLBRSample #143288
Conversation
Created using spr 1.3.4
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
@llvm/pr-subscribers-bolt Author: Amir Ayupov (aaupov) ChangesParsed branches and fall-throughs are validated in Test Plan: NFC Full diff: https://github.com/llvm/llvm-project/pull/143288.diff 1 Files Affected:
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index b1172fd13bc72..addff196f4f5b 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -1425,54 +1425,16 @@ void DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
const uint64_t TraceTo = NextLBR->From;
const BinaryFunction *TraceBF =
getBinaryFunctionContainingAddress(TraceFrom);
- if (opts::HeatmapMode == opts::HeatmapModeKind::HM_Exclusive) {
- FTInfo &Info = FallthroughLBRs[Trace(TraceFrom, TraceTo)];
+ FTInfo &Info = FallthroughLBRs[Trace(TraceFrom, TraceTo)];
+ if (TraceBF && TraceBF->containsAddress(LBR.From))
++Info.InternCount;
- } else if (TraceBF && TraceBF->containsAddress(TraceTo)) {
- FTInfo &Info = FallthroughLBRs[Trace(TraceFrom, TraceTo)];
- if (TraceBF->containsAddress(LBR.From))
- ++Info.InternCount;
- else
- ++Info.ExternCount;
- } else {
- const BinaryFunction *ToFunc =
- getBinaryFunctionContainingAddress(TraceTo);
- if (TraceBF && ToFunc) {
- LLVM_DEBUG({
- dbgs() << "Invalid trace starting in " << TraceBF->getPrintName()
- << formatv(" @ {0:x}", TraceFrom - TraceBF->getAddress())
- << formatv(" and ending @ {0:x}\n", TraceTo);
- });
- ++NumInvalidTraces;
- } else {
- LLVM_DEBUG({
- dbgs() << "Out of range trace starting in "
- << (TraceBF ? TraceBF->getPrintName() : "None")
- << formatv(" @ {0:x}",
- TraceFrom - (TraceBF ? TraceBF->getAddress() : 0))
- << " and ending in "
- << (ToFunc ? ToFunc->getPrintName() : "None")
- << formatv(" @ {0:x}\n",
- TraceTo - (ToFunc ? ToFunc->getAddress() : 0));
- });
- ++NumLongRangeTraces;
- }
- }
+ else
+ ++Info.ExternCount;
++NumTraces;
}
NextLBR = &LBR;
- // Record branches outside binary functions for heatmap.
- if (opts::HeatmapMode == opts::HeatmapModeKind::HM_Exclusive) {
- TakenBranchInfo &Info = BranchLBRs[Trace(LBR.From, LBR.To)];
- ++Info.TakenCount;
- continue;
- }
- uint64_t From = getBinaryFunctionContainingAddress(LBR.From) ? LBR.From : 0;
- uint64_t To = getBinaryFunctionContainingAddress(LBR.To) ? LBR.To : 0;
- if (!From && !To)
- continue;
- TakenBranchInfo &Info = BranchLBRs[Trace(From, To)];
+ TakenBranchInfo &Info = BranchLBRs[Trace(LBR.From, LBR.To)];
++Info.TakenCount;
Info.MispredCount += LBR.Mispred;
}
|
Created using spr 1.3.4
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
Created using spr 1.3.4 [skip ci]
The test could be simplified after llvm#143288 PR since the validation phase is removed from parseLBRSample. Now we can use branchLBRs container for the testing. Formerly if Bolt was supplied with mock addresses, branchLBRs container was empty due to validation phase.
Parsed branches and fall-throughs are validated in `doBranch` and `doTrace` respectively. Simplify parseLBRSample by omitting the validation. This also speeds up perf data processing as checks are only done once for aggregated branches/fall-throughs and not individual LBR entries. Since invalid/external addresses are no longer sanitized during parsing, sanitize them in `doBranch`. Test Plan: updated X86/pre-aggregated-perf.test
Parsed branches and fall-throughs are validated in `doBranch` and `doTrace` respectively. Simplify parseLBRSample by omitting the validation. This also speeds up perf data processing as checks are only done once for aggregated branches/fall-throughs and not individual LBR entries. Since invalid/external addresses are no longer sanitized during parsing, sanitize them in `doBranch`. Test Plan: updated X86/pre-aggregated-perf.test
Parsed branches and fall-throughs are validated in `doBranch` and `doTrace` respectively. Simplify parseLBRSample by omitting the validation. This also speeds up perf data processing as checks are only done once for aggregated branches/fall-throughs and not individual LBR entries. Since invalid/external addresses are no longer sanitized during parsing, sanitize them in `doBranch`. Test Plan: updated X86/pre-aggregated-perf.test
The test could be simplified after llvm#143288 PR since the validation phase is removed from parseLBRSample. Now we can use branchLBRs container for the testing. Formerly if Bolt was supplied with mock addresses, branchLBRs container was empty due to validation phase.
The test could be simplified after llvm#143288 PR since the validation phase is removed from parseLBRSample. Now we can use branchLBRs container for the testing. Formerly if Bolt was supplied with mock addresses, branchLBRs container was empty due to validation phase.
Parsed branches and fall-throughs are validated in
doBranch
anddoTrace
respectively. Simplify parseLBRSample by omitting thevalidation. This also speeds up perf data processing as checks are only
done once for aggregated branches/fall-throughs and not individual LBR
entries.
Since invalid/external addresses are no longer sanitized during parsing,
sanitize them in
doBranch
.Test Plan: NFC