Skip to content

Commit b443733

Browse files
authored
Merge branch 'llvm:main' into mmiwp-constructor
2 parents 74f8445 + 4084e31 commit b443733

File tree

4,890 files changed

+327980
-182491
lines changed

Some content is hidden

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

4,890 files changed

+327980
-182491
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,6 @@ b9079baaddfed5e604fbfaa1d81a7a1c38e78c26
8484

8585
# [libc++][NFC] Run clang-format on libcxx/include again (#95874)
8686
e2c2ffbe7a1b5d9e32a2ce64279475b50c4cba5b
87+
88+
# [lldb][nfc] Deindent ProcessGDBRemote::SetThreadStopInfo by two levels
89+
b32931c5b32eb0d2cf37d688b34f8548c9674c19

.github/CODEOWNERS

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ clang/test/AST/Interp/ @tbaederr
6767
/mlir/include/mlir/Dialect/Linalg @dcaballe @nicolasvasilache @rengolin
6868
/mlir/lib/Dialect/Linalg @dcaballe @nicolasvasilache @rengolin
6969
/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp @MaheshRavishankar @nicolasvasilache
70-
/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp @MaheshRavishankar @nicolasvasilache
70+
/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp @dcaballe @MaheshRavishankar @nicolasvasilache
7171
/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp @MaheshRavishankar @nicolasvasilache
7272
/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp @hanhanW @nicolasvasilache
73-
/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp @hanhanW @nicolasvasilache
74-
/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp @hanhanW @nicolasvasilache
73+
/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp @dcaballe @hanhanW @nicolasvasilache
74+
/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp @banach-space @dcaballe @hanhanW @nicolasvasilache
7575

7676
# MemRef Dialect in MLIR.
7777
/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp @MaheshRavishankar @nicolasvasilache
@@ -85,10 +85,11 @@ clang/test/AST/Interp/ @tbaederr
8585
/mlir/**/*VectorToSCF* @banach-space @dcaballe @matthias-springer @nicolasvasilache
8686
/mlir/**/*VectorToLLVM* @banach-space @dcaballe @nicolasvasilache
8787
/mlir/**/*X86Vector* @aartbik @dcaballe @nicolasvasilache
88-
/mlir/include/mlir/Dialect/Vector @dcaballe @nicolasvasilache
89-
/mlir/lib/Dialect/Vector @dcaballe @nicolasvasilache
90-
/mlir/lib/Dialect/Vector/Transforms/* @hanhanW @nicolasvasilache
91-
/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @MaheshRavishankar @nicolasvasilache
88+
/mlir/include/mlir/Dialect/Vector @banach-space @dcaballe @nicolasvasilache
89+
/mlir/include/mlir/Dialect/Vector/IR @kuhar
90+
/mlir/lib/Dialect/Vector @banach-space @dcaballe @nicolasvasilache
91+
/mlir/lib/Dialect/Vector/Transforms/* @banach-space @dcaballe @hanhanW @nicolasvasilache
92+
/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @banach-space @dcaballe @MaheshRavishankar @nicolasvasilache
9293
/mlir/**/*EmulateNarrowType* @dcaballe @hanhanW
9394

9495
# Presburger library in MLIR

.github/workflows/issue-write.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@ jobs:
2424
github.event.workflow_run.conclusion == 'failure'
2525
)
2626
steps:
27+
- name: Fetch Sources
28+
uses: actions/checkout@v4
29+
with:
30+
sparse-checkout: |
31+
.github/workflows/unprivileged-download-artifact/action.yml
32+
sparse-checkout-cone-mode: false
2733
- name: 'Download artifact'
28-
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
34+
uses: ./.github/workflows/unprivileged-download-artifact
35+
id: download-artifact
2936
with:
30-
github-token: ${{ secrets.ISSUE_WRITE_DOWNLOAD_ARTIFACT }}
3137
run-id: ${{ github.event.workflow_run.id }}
32-
name: workflow-args
38+
artifact-name: workflow-args
3339

3440
- name: 'Comment on PR'
41+
if: steps.download-artifact.outputs.artifact-id != ''
3542
uses: actions/github-script@v3
3643
with:
3744
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -144,5 +151,7 @@ jobs:
144151
});
145152
146153
- name: Dump comments file
147-
if: always()
154+
if: >-
155+
always() &&
156+
steps.download-artifact.outputs.artifact-id != ''
148157
run: cat comments

.github/workflows/release-sources.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
steps:
4848
- id: inputs
4949
run: |
50-
ref=${{ inputs.release-version || github.sha }}
50+
ref=${{ (inputs.release-version && format('llvmorg-{0}', inputs.release-version)) || github.sha }}
5151
if [ -n "${{ inputs.release-version }}" ]; then
5252
export_args="-release ${{ inputs.release-version }} -final"
5353
else
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Unprivileged Download Artifact
2+
description: >-
3+
Download artifacts from another workflow run without using an access token.
4+
inputs:
5+
run-id:
6+
description: >-
7+
The run-id for the workflow run that you want to download the artifact
8+
from. If ommitted it will download the most recently created artifact
9+
from the repo with the artifact-name.
10+
required: false
11+
artifact-name:
12+
desciption: The name of the artifact to download.
13+
required: true
14+
15+
16+
outputs:
17+
filename:
18+
description: >-
19+
The filename of the downloaded artifact or the empty string if the
20+
artifact was not found.
21+
value: ${{ steps.download-artifact.outputs.filename }}
22+
artifact-id:
23+
description: "The id of the artifact being downloaded."
24+
value: ${{ steps.artifact-url.outputs.id }}
25+
26+
27+
runs:
28+
using: "composite"
29+
steps:
30+
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
31+
id: artifact-url
32+
with:
33+
script: |
34+
var response;
35+
if (!"${{ inputs.run-id }}") {
36+
response = await github.rest.actions.listArtifactsForRepo({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
name: "${{ inputs.artifact-name }}"
40+
})
41+
} else {
42+
response = await github.rest.actions.listWorkflowRunArtifacts({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
run_id: "${{ inputs.run-id }}",
46+
name: "${{ inputs.artifact-name }}"
47+
})
48+
}
49+
50+
console.log(response)
51+
52+
for (artifact of response.data.artifacts) {
53+
console.log(artifact);
54+
}
55+
56+
if (response.data.artifacts.length == 0) {
57+
console.log("Could not find artifact ${{ inputs.artifact-name }} for workflow run ${{ inputs.run-id }}")
58+
return;
59+
}
60+
61+
const url_response = await github.rest.actions.downloadArtifact({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
artifact_id: response.data.artifacts[0].id,
65+
archive_format: "zip"
66+
})
67+
68+
core.setOutput("url", url_response.url);
69+
core.setOutput("id", response.data.artifacts[0].id);
70+
71+
- shell: bash
72+
if: steps.artifact-url.outputs.url != ''
73+
id: download-artifact
74+
run: |
75+
curl -L -o ${{ inputs.artifact-name }}.zip "${{ steps.artifact-url.outputs.url }}"
76+
echo "filename=${{ inputs.artifact-name }}.zip" >> $GITHUB_OUTPUT
77+
78+
- shell: bash
79+
if: steps.download-artifact.outputs.filename != ''
80+
run: |
81+
unzip ${{ steps.download-artifact.outputs.filename }}

.github/workflows/version-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ jobs:
2727
2828
- name: Version Check
2929
run: |
30-
version=$(grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' llvm/CMakeLists.txt | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g')
30+
version=$(grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' cmake/Modules/LLVMVersion.cmake | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g')
3131
.github/workflows/version-check.py "$version"

bolt/CMakeLists.txt

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1+
cmake_minimum_required(VERSION 3.20.0)
2+
13
set(LLVM_SUBPROJECT_TITLE "BOLT")
24

3-
include(ExternalProject)
5+
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
6+
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
7+
endif()
8+
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
9+
NO_POLICY_SCOPE)
10+
11+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
12+
project(bolt)
13+
set(BOLT_BUILT_STANDALONE TRUE)
14+
endif()
415

516
set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
617
set(BOLT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
@@ -9,6 +20,42 @@ set(CMAKE_CXX_STANDARD 17)
920
# Add path for custom modules.
1021
list(INSERT CMAKE_MODULE_PATH 0 "${BOLT_SOURCE_DIR}/cmake/modules")
1122

23+
include(GNUInstallDirs)
24+
25+
# standalone build, copied from clang
26+
if(BOLT_BUILT_STANDALONE)
27+
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
28+
set(CMAKE_CXX_STANDARD_REQUIRED YES)
29+
set(CMAKE_CXX_EXTENSIONS NO)
30+
31+
if(NOT MSVC_IDE)
32+
set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
33+
CACHE BOOL "Enable assertions")
34+
# Assertions should follow llvm-config's.
35+
mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
36+
endif()
37+
38+
find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}")
39+
list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")
40+
41+
set(LLVM_MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm" CACHE PATH "Path to LLVM source tree")
42+
find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
43+
NO_DEFAULT_PATH)
44+
45+
# They are used as destination of target generators.
46+
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
47+
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
48+
49+
include(AddLLVM)
50+
include(TableGen)
51+
include_directories(${LLVM_INCLUDE_DIRS})
52+
link_directories("${LLVM_LIBRARY_DIR}")
53+
54+
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_INSTALL_BINDIR}" )
55+
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_INSTALL_LIBDIR}/${LLVM_LIBDIR_SUFFIX}" )
56+
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_INSTALL_LIBDIR}/${LLVM_LIBDIR_SUFFIX}")
57+
endif() # standalone
58+
1259
# Determine default set of targets to build -- the intersection of
1360
# those BOLT supports and those LLVM is targeting.
1461
set(BOLT_TARGETS_TO_BUILD_all "AArch64;X86;RISCV")
@@ -94,6 +141,8 @@ if (BOLT_ENABLE_RUNTIME)
94141
if(CMAKE_SYSROOT)
95142
list(APPEND extra_args -DCMAKE_SYSROOT=${CMAKE_SYSROOT})
96143
endif()
144+
145+
include(ExternalProject)
97146
ExternalProject_Add(bolt_rt
98147
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/runtime"
99148
STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-stamps
@@ -104,6 +153,7 @@ if (BOLT_ENABLE_RUNTIME)
104153
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
105154
-DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX}
106155
-DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
156+
-DBOLT_BUILT_STANDALONE=${BOLT_BUILT_STANDALONE}
107157
${extra_args}
108158
INSTALL_COMMAND ""
109159
BUILD_ALWAYS True
@@ -113,6 +163,8 @@ if (BOLT_ENABLE_RUNTIME)
113163
add_llvm_install_targets(install-bolt_rt
114164
DEPENDS bolt_rt bolt
115165
COMPONENT bolt)
166+
set(LIBBOLT_RT_INSTR "${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins/lib/libbolt_rt_instr.a")
167+
set(LIBBOLT_RT_HUGIFY "${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins/lib/libbolt_rt_hugify.a")
116168
endif()
117169

118170
find_program(GNU_LD_EXECUTABLE NAMES ${LLVM_DEFAULT_TARGET_TRIPLE}-ld.bfd ld.bfd DOC "GNU ld")

bolt/docs/CommandLineArgumentReference.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
- `--comp-dir-override=<string>`
9090

91-
Overrides DW_AT_comp_dir, and provides an alterantive base location, which is
91+
Overrides DW_AT_comp_dir, and provides an alternative base location, which is
9292
used with DW_AT_dwo_name to construct a path to *.dwo files.
9393

9494
- `--create-debug-names-section`
@@ -113,11 +113,6 @@
113113

114114
Prints out offsets for abbrev and debug_info of Skeleton CUs that get patched.
115115

116-
- `--deterministic-debuginfo`
117-
118-
Disables parallel execution of tasks that may produce nondeterministic debug
119-
info
120-
121116
- `--dot-tooltip-code`
122117

123118
Add basic block instructions as tool tips on nodes
@@ -283,6 +278,12 @@
283278

284279
List of functions to pad with amount of bytes
285280

281+
- `--print-mappings`
282+
283+
Print mappings in the legend, between characters/blocks and text sections
284+
(default false).
285+
286+
286287
- `--profile-format=<value>`
287288

288289
Format to dump profile output in aggregation mode, default is fdata
@@ -680,6 +681,10 @@
680681
threshold means fewer functions to process. E.g threshold of 90 means only top
681682
10 percent of functions with profile will be processed.
682683

684+
- `--match-with-call-graph`
685+
686+
Match functions with call graph
687+
683688
- `--memcpy1-spec=<func1,func2:cs1:cs2,func3:cs1,...>`
684689

685690
List of functions with call sites for which to specialize memcpy() for size 1
@@ -1240,4 +1245,4 @@
12401245

12411246
- `--print-options`
12421247

1243-
Print non-default options after command line parsing
1248+
Print non-default options after command line parsing

bolt/docs/HeatmapHeader.png

75 KB
Loading

bolt/docs/Heatmaps.md

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Code Heatmaps
22

33
BOLT has gained the ability to print code heatmaps based on
4-
sampling-based LBR profiles generated by `perf`. The output is produced
5-
in colored ASCII to be displayed in a color-capable terminal. It looks
6-
something like this:
4+
sampling-based profiles generated by `perf`, either with `LBR` data or not.
5+
The output is produced in colored ASCII to be displayed in a color-capable
6+
terminal. It looks something like this:
77

88
![](./Heatmap.png)
99

@@ -32,20 +32,64 @@ $ llvm-bolt-heatmap -p perf.data <executable>
3232
```
3333

3434
By default the heatmap will be dumped to *stdout*. You can change it
35-
with `-o <heatmapfile>` option. Each character/block in the heatmap
36-
shows the execution data accumulated for corresponding 64 bytes of
37-
code. You can change this granularity with a `-block-size` option.
38-
E.g. set it to 4096 to see code usage grouped by 4K pages.
39-
Other useful options are:
35+
with `-o <heatmapfile>` option.
4036

41-
```bash
42-
-line-size=<uint> - number of entries per line (default 256)
43-
-max-address=<uint> - maximum address considered valid for heatmap (default 4GB)
44-
```
4537

4638
If you prefer to look at the data in a browser (or would like to share
4739
it that way), then you can use an HTML conversion tool. E.g.:
4840

4941
```bash
5042
$ aha -b -f <heatmapfile> > <heatmapfile>.html
5143
```
44+
45+
---
46+
47+
## Background on heatmaps:
48+
A heatmap is effectively a histogram that is rendered into a grid for better
49+
visualization.
50+
In theory we can generate a heatmap using any binary and a perf profile.
51+
52+
Each block/character in the heatmap shows the execution data accumulated for
53+
corresponding 64 bytes of code. You can change this granularity with a
54+
`-block-size` option.
55+
E.g. set it to 4096 to see code usage grouped by 4K pages.
56+
57+
58+
When a block is shown as a dot, it means that no samples were found for that
59+
address.
60+
When it is shown as a letter, it indicates a captured sample on a particular
61+
text section of the binary.
62+
To show a mapping between letters and text sections in the legend, use
63+
`-print-mappings`.
64+
When a sampled address does not belong to any of the text sections, the
65+
characters 'o' or 'O' will be shown.
66+
67+
The legend shows by default the ranges in the heatmap according to the number
68+
of samples per block.
69+
A color is assigned per range, except the first two ranges that distinguished by
70+
lower and upper case letters.
71+
72+
On the Y axis, each row/line starts with an actual address of the binary.
73+
Consecutive lines in the heatmap advance by the same amount, with the binary
74+
size covered by a line dependent on the block size and the line size.
75+
An empty new line is inserted for larger gaps between samples.
76+
77+
On the X axis, the horizontally emitted hex numbers can help *estimate* where
78+
in the line the samples lie, but they cannot be combined to provide a full
79+
address, as they are relative to both the bucket and line sizes.
80+
81+
In the example below, the highlighted `0x100` column is not an offset to each
82+
row's address, but instead, it points to the middle of the line.
83+
For the generation, the default bucket size was used with a line size of 128.
84+
85+
86+
![](./HeatmapHeader.png)
87+
88+
89+
Some useful options are:
90+
91+
```
92+
-line-size=<uint> - number of entries per line (default 256)
93+
-max-address=<uint> - maximum address considered valid for heatmap (default 4GB)
94+
-print-mappings - print mappings in the legend, between characters/blocks and text sections (default false)
95+
```

0 commit comments

Comments
 (0)