Skip to content

Commit 1b80a5b

Browse files
authored
Merge pull request #153 from sx-aurora-dev/feature/merge-upstream-20220207
Feature/merge upstream 20220207
2 parents efe779a + 9e3a51e commit 1b80a5b

File tree

5,026 files changed

+81800
-50729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,026 files changed

+81800
-50729
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# This contains the workflow definitions that allow users to test backports
2+
# to the release branch using comments on issues.
3+
#
4+
# /cherry-pick <commit> <...>
5+
#
6+
# This comment will attempt to cherry-pick the given commits to the latest
7+
# release branch (release/Y.x) and if successful push the result to a branch
8+
# on github.
9+
#
10+
# /branch <owner>/<repo>/<branch>
11+
#
12+
# This comment will create a pull request from <branch> to the latest release
13+
# branch.
14+
15+
name: Issue Release Workflow
16+
17+
on:
18+
issue_comment:
19+
types:
20+
- created
21+
- edited
22+
23+
env:
24+
COMMENT_BODY: ${{ github.event.comment.body }}
25+
26+
jobs:
27+
backport-commits:
28+
name: Backport Commits
29+
runs-on: ubuntu-20.04
30+
if: >-
31+
(github.repository == 'llvm/llvm-project') &&
32+
!startswith(github.event.comment.body, '<!--IGNORE-->') &&
33+
contains(github.event.comment.body, '/cherry-pick')
34+
steps:
35+
- name: Fetch LLVM sources
36+
uses: actions/checkout@v2
37+
with:
38+
repository: llvm/llvm-project
39+
# GitHub stores the token used for checkout and uses it for pushes
40+
# too, but we want to use a different token for pushing, so we need
41+
# to disable persist-credentials here.
42+
persist-credentials: false
43+
fetch-depth: 0
44+
45+
- name: Setup Environment
46+
run: |
47+
pip install -r ./llvm/utils/git/requirements.txt
48+
./llvm/utils/git/github-automation.py --token ${{ github.token }} setup-llvmbot-git
49+
50+
- name: Backport Commits
51+
run: |
52+
printf "$COMMENT_BODY" |
53+
./llvm/utils/git/github-automation.py \
54+
--repo $GITHUB_REPOSITORY \
55+
--token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
56+
release-workflow \
57+
--issue-number ${{ github.event.issue.number }} \
58+
auto
59+
60+
create-pull-request:
61+
name: Create Pull Request
62+
runs-on: ubuntu-20.04
63+
if: >-
64+
(github.repository == 'llvm/llvm-project') &&
65+
!startswith(github.event.comment.body, '<!--IGNORE-->') &&
66+
contains(github.event.comment.body, '/branch')
67+
68+
steps:
69+
- name: Fetch LLVM sources
70+
uses: actions/checkout@v2
71+
72+
- name: Setup Environment
73+
run: |
74+
pip install -r ./llvm/utils/git/requirements.txt
75+
76+
- name: Create Pull Request
77+
run: |
78+
printf "$COMMENT_BODY" |
79+
./llvm/utils/git/github-automation.py \
80+
--repo $GITHUB_REPOSITORY \
81+
--token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
82+
release-workflow \
83+
--issue-number ${{ github.event.issue.number }} \
84+
auto

.github/workflows/issue-subscriber.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ jobs:
1313
- name: Setup Automation Script
1414
run: |
1515
curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA/llvm/utils/git/github-automation.py
16+
curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA/llvm/utils/git/requirements.txt
1617
chmod a+x github-automation.py
17-
pip install PyGithub
18+
pip install -r requirements.txt
1819
1920
- name: Update watchers
2021
run: |

bolt/docs/Heatmaps.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ $ perf record -e cycles:u -j any,u [-p PID|-a] -- sleep <interval>
2323
Note that at the moment running with LBR (`-j any,u` or `-b`) is
2424
a requirement.
2525

26-
Once the run is complete, and `perf.data` is generated, run BOLT in
27-
a heatmap mode:
26+
Once the run is complete, and `perf.data` is generated, run llvm-bolt-heatmap:
2827

2928
```bash
30-
$ llvm-bolt heatmap -p perf.data <executable>
29+
$ llvm-bolt-heatmap -p perf.data <executable>
3130
```
3231

3332
By default the heatmap will be dumped to *stdout*. You can change it

bolt/include/bolt/Utils/CommandLineOpts.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ extern llvm::cl::OptionCategory BoltRelocCategory;
2727
extern llvm::cl::OptionCategory BoltOutputCategory;
2828
extern llvm::cl::OptionCategory AggregatorCategory;
2929
extern llvm::cl::OptionCategory BoltInstrCategory;
30-
31-
extern llvm::cl::SubCommand HeatmapCommand;
30+
extern llvm::cl::OptionCategory HeatmapCategory;
3231

3332
extern llvm::cl::opt<unsigned> AlignText;
3433
extern llvm::cl::opt<bool> AggregateOnly;
@@ -38,7 +37,6 @@ extern llvm::cl::opt<bool> EnableBAT;
3837
extern llvm::cl::opt<bool> RemoveSymtab;
3938
extern llvm::cl::opt<unsigned> ExecutionCountThreshold;
4039
extern llvm::cl::opt<unsigned> HeatmapBlock;
41-
extern llvm::cl::opt<std::string> HeatmapFile;
4240
extern llvm::cl::opt<unsigned long long> HeatmapMaxAddress;
4341
extern llvm::cl::opt<unsigned long long> HeatmapMinAddress;
4442
extern llvm::cl::opt<bool> HotData;

bolt/lib/Passes/IndirectCallPromotion.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,6 @@ size_t IndirectCallPromotion::canPromoteCallsite(
962962
}
963963

964964
// Pick the top N targets.
965-
uint64_t TotalCallsTopN = 0;
966965
uint64_t TotalMispredictsTopN = 0;
967966
size_t N = 0;
968967

@@ -1015,7 +1014,6 @@ size_t IndirectCallPromotion::canPromoteCallsite(
10151014
if (N + (Targets[I].JTIndices.empty() ? 1 : Targets[I].JTIndices.size()) >
10161015
TrialN)
10171016
break;
1018-
TotalCallsTopN += Targets[I].Branches;
10191017
TotalMispredictsTopN += Targets[I].Mispreds;
10201018
NumRemainingCalls -= Targets[I].Branches;
10211019
N += Targets[I].JTIndices.empty() ? 1 : Targets[I].JTIndices.size();

bolt/lib/Passes/Inliner.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,6 @@ void Inliner::runOnFunctions(BinaryContext &BC) {
526526
if (!opts::inliningEnabled())
527527
return;
528528

529-
uint64_t TotalSize = 0;
530-
for (auto &BFI : BC.getBinaryFunctions())
531-
TotalSize += BFI.second.getSize();
532-
533529
bool InlinedOnce;
534530
unsigned NumIters = 0;
535531
do {

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,11 +1348,11 @@ std::error_code DataAggregator::printLBRHeatMap() {
13481348
exit(1);
13491349
}
13501350

1351-
HM.print(opts::HeatmapFile);
1352-
if (opts::HeatmapFile == "-")
1353-
HM.printCDF(opts::HeatmapFile);
1351+
HM.print(opts::OutputFilename);
1352+
if (opts::OutputFilename == "-")
1353+
HM.printCDF(opts::OutputFilename);
13541354
else
1355-
HM.printCDF(opts::HeatmapFile + ".csv");
1355+
HM.printCDF(opts::OutputFilename + ".csv");
13561356

13571357
return std::error_code();
13581358
}

bolt/lib/Rewrite/BinaryPassManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ void BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
408408
Manager.registerPass(
409409
std::make_unique<DynoStatsPrintPass>(
410410
InitialDynoStats, "after all optimizations before SCTC and FOP"),
411-
opts::PrintDynoStats | opts::DynoStatsAll);
411+
opts::PrintDynoStats || opts::DynoStatsAll);
412412

413413
// Add the StokeInfo pass, which extract functions for stoke optimization and
414414
// get the liveness information for them

bolt/lib/Target/X86/X86MCPlusBuilder.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,13 +1873,9 @@ class X86MCPlusBuilder : public MCPlusBuilder {
18731873
NewOpcode = Check.second;
18741874
if (Check.first == NOCHECK)
18751875
break;
1876-
if (Check.first == CHECK8 &&
1877-
ImmVal >= std::numeric_limits<int8_t>::min() &&
1878-
ImmVal <= std::numeric_limits<int8_t>::max())
1876+
if (Check.first == CHECK8 && isInt<8>(ImmVal))
18791877
break;
1880-
if (Check.first == CHECK32 &&
1881-
ImmVal >= std::numeric_limits<int32_t>::min() &&
1882-
ImmVal <= std::numeric_limits<int32_t>::max())
1878+
if (Check.first == CHECK32 && isInt<32>(ImmVal))
18831879
break;
18841880
}
18851881
if (NewOpcode == Inst.getOpcode())
@@ -3012,12 +3008,9 @@ class X86MCPlusBuilder : public MCPlusBuilder {
30123008
NewOpcode = Check.second;
30133009
if (Check.first == NOCHECK)
30143010
break;
3015-
if (Check.first == CHECK8 && Imm >= std::numeric_limits<int8_t>::min() &&
3016-
Imm <= std::numeric_limits<int8_t>::max())
3011+
if (Check.first == CHECK8 && isInt<8>(Imm))
30173012
break;
3018-
if (Check.first == CHECK32 &&
3019-
Imm >= std::numeric_limits<int32_t>::min() &&
3020-
Imm <= std::numeric_limits<int32_t>::max())
3013+
if (Check.first == CHECK32 && isInt<32>(Imm))
30213014
break;
30223015
}
30233016
if (NewOpcode == Inst.getOpcode())

bolt/lib/Utils/CommandLineOpts.cpp

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ cl::OptionCategory BoltRelocCategory("BOLT options in relocation mode");
3333
cl::OptionCategory BoltOutputCategory("Output options");
3434
cl::OptionCategory AggregatorCategory("Data aggregation options");
3535
cl::OptionCategory BoltInstrCategory("BOLT instrumentation options");
36-
37-
cl::SubCommand HeatmapCommand("heatmap", "generate heatmap");
36+
cl::OptionCategory HeatmapCategory("Heatmap options");
3837

3938
cl::opt<unsigned>
4039
AlignText("align-text",
@@ -50,11 +49,9 @@ AggregateOnly("aggregate-only",
5049
cl::cat(AggregatorCategory));
5150

5251
cl::opt<unsigned>
53-
BucketsPerLine("line-size",
54-
cl::desc("number of entries per line (default 256)"),
55-
cl::init(256),
56-
cl::Optional,
57-
cl::sub(HeatmapCommand));
52+
BucketsPerLine("line-size",
53+
cl::desc("number of entries per line (default 256)"),
54+
cl::init(256), cl::Optional, cl::cat(HeatmapCategory));
5855

5956
cl::opt<bool>
6057
DiffOnly("diff-only",
@@ -83,31 +80,19 @@ ExecutionCountThreshold("execution-count-threshold",
8380
cl::cat(BoltOptCategory));
8481

8582
cl::opt<unsigned>
86-
HeatmapBlock("block-size",
87-
cl::desc("size of a heat map block in bytes (default 64)"),
88-
cl::init(64),
89-
cl::sub(HeatmapCommand));
90-
91-
cl::opt<std::string>
92-
HeatmapFile("o",
93-
cl::init("-"),
94-
cl::desc("heatmap output file (default stdout)"),
95-
cl::Optional,
96-
cl::sub(HeatmapCommand));
97-
98-
cl::opt<unsigned long long>
99-
HeatmapMaxAddress("max-address",
100-
cl::init(0xffffffff),
101-
cl::desc("maximum address considered valid for heatmap (default 4GB)"),
102-
cl::Optional,
103-
cl::sub(HeatmapCommand));
104-
105-
cl::opt<unsigned long long>
106-
HeatmapMinAddress("min-address",
107-
cl::init(0x0),
108-
cl::desc("minimum address considered valid for heatmap (default 0)"),
109-
cl::Optional,
110-
cl::sub(HeatmapCommand));
83+
HeatmapBlock("block-size",
84+
cl::desc("size of a heat map block in bytes (default 64)"),
85+
cl::init(64), cl::cat(HeatmapCategory));
86+
87+
cl::opt<unsigned long long> HeatmapMaxAddress(
88+
"max-address", cl::init(0xffffffff),
89+
cl::desc("maximum address considered valid for heatmap (default 4GB)"),
90+
cl::Optional, cl::cat(HeatmapCategory));
91+
92+
cl::opt<unsigned long long> HeatmapMinAddress(
93+
"min-address", cl::init(0x0),
94+
cl::desc("minimum address considered valid for heatmap (default 0)"),
95+
cl::Optional, cl::cat(HeatmapCategory));
11196

11297
cl::opt<bool>
11398
HotData("hot-data",

0 commit comments

Comments
 (0)