Skip to content

Commit 3786716

Browse files
committed
Merge branch 'amd-staging' into reinstate-upstream-unrolling-patch
2 parents 49be73a + 5d0726a commit 3786716

File tree

5,285 files changed

+957903
-308050
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,285 files changed

+957903
-308050
lines changed

.ci/generate_test_report_lib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ def plural(num_tests):
9292
]
9393
)
9494
elif failures:
95-
report.extend(["", "## Failed Tests", "(click on a test name to see its output)"])
95+
report.extend(
96+
["", "## Failed Tests", "(click on a test name to see its output)"]
97+
)
9698

9799
for testsuite_name, failures in failures.items():
98100
report.extend(["", f"### {testsuite_name}"])

.ci/metrics/metrics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
# remain small.
6868
BUILDKITE_GRAPHQL_BUILDS_PER_PAGE = 50
6969

70+
7071
@dataclass
7172
class JobMetrics:
7273
job_name: str
@@ -77,6 +78,7 @@ class JobMetrics:
7778
workflow_id: int
7879
workflow_name: str
7980

81+
8082
@dataclass
8183
class GaugeMetric:
8284
name: str
@@ -258,6 +260,7 @@ def buildkite_get_metrics(
258260

259261
return output, incomplete_now
260262

263+
261264
def github_get_metrics(
262265
github_repo: github.Repository, last_workflows_seen_as_completed: set[int]
263266
) -> tuple[list[JobMetrics], int]:

.github/new-prs-labeler.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ mlgo:
702702
- llvm/unittests/CodeGen/ML*
703703
- llvm/test/CodeGen/MLRegAlloc/**
704704
- llvm/utils/mlgo-utils/**
705+
- llvm/docs/MLGO.rst
705706

706707
tools:llvm-exegesis:
707708
- llvm/tools/llvm-exegesis/**
@@ -791,6 +792,12 @@ lld:wasm:
791792
- lld/**/wasm/**
792793
- lld/Common/**
793794

795+
backend:ARC:
796+
- llvm/lib/Target/ARC/**
797+
- clang/lib/Basic/Targets/ARC.h
798+
- clang/lib/Basic/Targets/ARC.cpp
799+
- clang/lib/CodeGen/Targets/ARC.cpp
800+
794801
backend:ARM:
795802
- llvm/include/llvm/IR/IntrinsicsARM.td
796803
- llvm/test/MC/ARM/**
@@ -817,6 +824,19 @@ backend:AArch64:
817824
- clang/include/clang/Sema/SemaARM.h
818825
- clang/lib/Sema/SemaARM.cpp
819826

827+
backend:CSKY:
828+
- llvm/lib/Target/CSKY/**
829+
- llvm/include/llvm/TargetParser/CSKYTargetParser.def
830+
- llvm/include/llvm/TargetParser/CSKYTargetParser.h
831+
- llvm/include/llvm/BinaryFormat/ELFRelocs/CSKY.def
832+
- llvm/lib/TargetParser/CSKYTargetParser.cpp
833+
- llvm/lib/Support/CSKYAttributes.cpp
834+
- llvm/lib/Support/CSKYAttributeParser.cpp
835+
- clang/lib/Basic/Targets/CSKY.h
836+
- clang/lib/Basic/Targets/CSKY.cpp
837+
- clang/lib/CodeGen/Targets/CSKY.cpp
838+
- clang/lib/Driver/ToolChains/CSKY*
839+
820840
backend:Hexagon:
821841
- clang/include/clang/Basic/BuiltinsHexagon*.def
822842
- clang/include/clang/Sema/SemaHexagon.h
@@ -840,6 +860,13 @@ backend:Hexagon:
840860
- llvm/test/MC/Hexagon/**
841861
- llvm/test/tools/llvm-objdump/ELF/Hexagon/**
842862

863+
backend:Lanai:
864+
- llvm/lib/Target/Lanai/**
865+
- clang/lib/Basic/Targets/Lanai.h
866+
- clang/lib/Basic/Targets/Lanai.cpp
867+
- clang/lib/CodeGen/Targets/Lanai.cpp
868+
- clang/lib/Driver/ToolChains/Lanai*
869+
843870
backend:loongarch:
844871
- llvm/include/llvm/IR/IntrinsicsLoongArch.td
845872
- llvm/test/MC/LoongArch/**

.github/workflows/compute-rocm-dkmd-afar-trigger.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ on:
88

99
jobs:
1010
trigger_jenkins:
11-
runs-on: self-hosted
12-
11+
runs-on:
12+
group: compiler-generic-runners
13+
1314
steps:
1415
- name: Set environment variable for container image
1516
run: |

.github/workflows/containers/github-action-ci-windows/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ RUN choco install -y handle
108108
109109
RUN pip3 install pywin32 buildbot-worker==2.8.4
110110
111-
ARG RUNNER_VERSION=2.323.0
111+
ARG RUNNER_VERSION=2.324.0
112112
ENV RUNNER_VERSION=$RUNNER_VERSION
113113
114114
RUN powershell -Command \

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM docker.io/library/ubuntu:24.04 as base
22
ENV LLVM_SYSROOT=/opt/llvm
33

44
FROM base as stage1-toolchain
5-
ENV LLVM_VERSION=20.1.1
5+
ENV LLVM_VERSION=20.1.4
66

77
RUN apt-get update && \
88
apt-get install -y \
@@ -86,7 +86,7 @@ WORKDIR /home/gha
8686

8787
FROM ci-container as ci-container-agent
8888

89-
ENV GITHUB_RUNNER_VERSION=2.323.0
89+
ENV GITHUB_RUNNER_VERSION=2.324.0
9090

9191
RUN mkdir actions-runner && \
9292
cd actions-runner && \

amd/comgr/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,27 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 4)
265265
set_target_properties(amd_comgr PROPERTIES OUTPUT_NAME "amd_comgr32")
266266
endif()
267267

268+
option(LLVM_BUILD_INSTRUMENTED_COVERAGE "Build LLVM and tools with Code Coverage instrumentation" Off)
269+
mark_as_advanced(LLVM_BUILD_INSTRUMENTED_COVERAGE)
270+
if(LLVM_BUILD_INSTRUMENTED_COVERAGE)
271+
if(NOT LLVM_PROFILE_MERGE_POOL_SIZE)
272+
# A pool size of 1-2 is probably sufficient on an SSD. 3-4 should be fine
273+
# for spinning disks. Anything higher may only help on slower mediums.
274+
set(LLVM_PROFILE_MERGE_POOL_SIZE "4")
275+
endif()
276+
if(NOT LLVM_PROFILE_FILE_PATTERN)
277+
if(NOT LLVM_PROFILE_DATA_DIR)
278+
file(TO_NATIVE_PATH "${LLVM_BINARY_DIR}/profiles" LLVM_PROFILE_DATA_DIR)
279+
endif()
280+
file(TO_NATIVE_PATH "${LLVM_PROFILE_DATA_DIR}/%${LLVM_PROFILE_MERGE_POOL_SIZE}m.profraw" LLVM_PROFILE_FILE_PATTERN)
281+
endif()
282+
set(INSTRUMENTED_COVERAGE_FLAGS -O0 -fprofile-instr-generate=${LLVM_PROFILE_FILE_PATTERN} -fcoverage-mapping)
283+
list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS ${INSTRUMENTED_COVERAGE_FLAGS})
284+
list(APPEND AMD_COMGR_PUBLIC_COMPILE_OPTIONS ${INSTRUMENTED_COVERAGE_FLAGS})
285+
list(APPEND AMD_COMGR_PRIVATE_LINKER_OPTIONS ${INSTRUMENTED_COVERAGE_FLAGS} -L${LLVM_LIBRARY_DIRS})
286+
list(APPEND AMD_COMGR_PUBLIC_LINKER_OPTIONS ${INSTRUMENTED_COVERAGE_FLAGS} -L${LLVM_LIBRARY_DIRS})
287+
endif()
288+
268289
target_compile_options(amd_comgr
269290
PRIVATE "${AMD_COMGR_PRIVATE_COMPILE_OPTIONS}")
270291
target_compile_definitions(amd_comgr

amd/comgr/README.md

Lines changed: 61 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,68 +20,67 @@ branch. LLVM should be built with at least
2020

2121
An example `bash` session to build Comgr on Linux using GNUMakefiles is:
2222

23-
$ LLVM_PROJECT=~/llvm-project
24-
$ DEVICE_LIBS=~/llvm-project/amd/device-libs
25-
$ COMGR=~/llvm-project/amd/comgr
26-
$ mkdir -p "$LLVM_PROJECT/build"
27-
$ cd "$LLVM_PROJECT/build"
23+
$ LLVM_PROJECT=~/llvm-project/build
24+
$ DEVICE_LIBS=~/llvm-project/amd/device-libs/build
25+
$ mkdir -p "$LLVM_PROJECT"
26+
$ cd "$LLVM_PROJECT"
2827
$ cmake \
2928
-DCMAKE_BUILD_TYPE=Release \
3029
-DLLVM_ENABLE_PROJECTS="llvm;clang;lld" \
3130
-DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" \
3231
../llvm
3332
$ make
34-
$ mkdir -p "$DEVICE_LIBS/build"
35-
$ cd "$DEVICE_LIBS/build"
33+
$ mkdir -p "$DEVICE_LIBS"
34+
$ cd "$DEVICE_LIBS"
3635
$ cmake \
3736
-DCMAKE_BUILD_TYPE=Release \
38-
-DCMAKE_PREFIX_PATH="$LLVM_PROJECT/build" \
37+
-DCMAKE_PREFIX_PATH="$LLVM_PROJECT" \
3938
..
4039
$ make
41-
$ mkdir -p "$COMGR/build"
42-
$ cd "$COMGR/build"
40+
$ cd ~/llvm-project/amd/comgr
41+
$ mkdir -p build; cd build;
4342
$ cmake \
4443
-DCMAKE_BUILD_TYPE=Release \
45-
-DCMAKE_PREFIX_PATH="$LLVM_PROJECT/build;$DEVICE_LIBS/build" \
44+
-DCMAKE_PREFIX_PATH="$LLVM_PROJECT;$DEVICE_LIBS" \
4645
..
4746
$ make
4847
$ make test
4948

5049
The equivalent on Windows in `cmd.exe` using Visual Studio project files is:
5150

52-
> set LLVM_PROJECT="%HOMEPATH%\llvm-project"
53-
> set DEVICE_LIBS="%HOMEPATH%\llvm-project\amd\device-libs"
54-
> set COMGR="%HOMEPATH%\llvm-project\amd\comgr"
55-
> mkdir "%LLVM_PROJECT%\build"
56-
> cd "%LLVM_PROJECT%\build"
51+
> set LLVM_PROJECT="%HOMEPATH%\llvm-project\build"
52+
> set DEVICE_LIBS="%HOMEPATH%\llvm-project\amd\device-libs\build"
53+
> mkdir "%LLVM_PROJECT%"
54+
> cd "%LLVM_PROJECT%"
5755
> cmake ^
5856
-DLLVM_ENABLE_PROJECTS="llvm;clang;lld" ^
5957
-DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" ^
6058
..\llvm
6159
> msbuild /p:Configuration=Release ALL_BUILD.vcxproj
62-
> mkdir "%DEVICE_LIBS%\build"
63-
> cd "%DEVICE_LIBS%\build"
60+
> mkdir "%DEVICE_LIBS%"
61+
> cd "%DEVICE_LIBS%"
6462
> cmake ^
65-
-DCMAKE_PREFIX_PATH="%LLVM_PROJECT%\build" ^
63+
-DCMAKE_PREFIX_PATH="%LLVM_PROJECT%" ^
6664
..
6765
> msbuild /p:Configuration=Release ALL_BUILD.vcxproj
68-
> mkdir "%COMGR%\build"
69-
> cd "%COMGR%\build"
66+
> cd "%HOMEPATH%\llvm-project\amd\comgr"
67+
> mkdir build
68+
> cd build
7069
> cmake ^
71-
-DCMAKE_PREFIX_PATH="%LLVM_PROJECT%\build;%DEVICE_LIBS%\build" ^
70+
-DCMAKE_PREFIX_PATH="%LLVM_PROJECT%;%DEVICE_LIBS%" ^
7271
..
7372
> msbuild /p:Configuration=Release ALL_BUILD.vcxproj
7473
> msbuild /p:Configuration=Release RUN_TESTS.vcxproj
7574

76-
Optionally,
75+
**ASAN support:** Optionally,
7776
[AddressSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer)
7877
may be enabled during development via `-DADDRESS_SANITIZER=On` during the Comgr
7978
`cmake` step.
8079

81-
Comgr can be built as a static library by passing
80+
**Static Comgr:** Comgr can be built as a static library by passing
8281
`-DCOMGR_BUILD_SHARED_LIBS=OFF` during the Comgr `cmake` step.
8382

84-
To enable SPIRV support, checkout
83+
**SPIRV Support:** To enable SPIRV support, checkout
8584
[SPIRV-LLVM-Translator](https://github.com/ROCm/SPIRV-LLVM-Translator) in
8685
`llvm/projects` or `llvm/tools` and build using the above instructions, with the
8786
exception that the `-DCMAKE_PREFIX_PATH` for llvm-project must be an install
@@ -92,6 +91,37 @@ Comgr SPIRV-related APIs can be disabled by passing
9291
`-DCOMGR_DISABLE_SPIRV=1` during the Comgr `cmake` step. This removes any
9392
dependency on LLVM SPIRV libraries or the llvm-spirv tool.
9493

94+
**Code Coverage Instrumentation:** Comgr supports source-based [code coverage
95+
via clang](https://clang.llvm.org/docs/SourceBasedCodeCoverage.html), and
96+
leverages the same CMake variables as
97+
[LLVM](https://www.llvm.org/docs/CMake.html#llvm-related-variables)
98+
(LLVM_BUILD_INSTRUMENTED_COVERAGE, etc.).
99+
100+
Example of insturmenting with covereage, generating profiles, and creating an
101+
HTML for investigation:
102+
103+
$ cmake -DCMAKE_STRIP="" -DLLVM_PROFILE_DATA_DIR=`pwd`/profiles \
104+
-DLLVM_BUILD_INSTRUMENTED_COVERAGE=On \
105+
-DCMAKE_CXX_COMPILER="$LLVM_PROJECT/bin/clang++" \
106+
-DCMAKE_C_COMPILER="$LLVM_PROJECT/bin/clang" \
107+
-DCMAKE_BUILD_TYPE=Release \
108+
-DCMAKE_PREFIX_PATH="$LLVM_PROJECT;$DEVICE_LIBS" ..
109+
$ make -j
110+
$ make test test-lit
111+
$ cd profiles
112+
# Manually aggregate the data and create text report.
113+
$ $LLVM_PROJECT/bin/llvm-profdata merge -sparse *.profraw -o \
114+
comgr_test.profdata # merge and index data
115+
$ $LLVM_PROJECT/bin/llvm-cov report ../libamd_comgr.so \
116+
-instr-profile=comgr_test.profdata \
117+
-ignore-filename-regex="[cl].*/include/*" # show test report without \
118+
includes
119+
# Or use python script to aggregate the data and create html report.
120+
$ $LLVM_PROJECT/../llvm/utils/prepare-code-coverage-artifact.py \
121+
--preserve-profiles $LLVM_PROJECT/bin/llvm-profdata \
122+
$LLVM_PROJECT/bin/llvm-cov . html ../libamd_comgr.so \
123+
# create html report
124+
95125
Depending on the Code Object Manager
96126
------------------------------------
97127

@@ -233,3 +263,9 @@ A script at `utils/tidy-and-format.sh` can be run to help automate the task of
233263
ensuring all sources conform to the coding standards. To support the use of
234264
this script, any exceptions must be annotated in source comments, as described
235265
in the clang-tidy manual.
266+
267+
Aligning with the purpose of being a stable interface into LLVM functionality,
268+
the core enum values (AMD\_COMGR\_LANGUAGE_\*, AMD\_COMGR\_DATA\_KIND\_\*,
269+
AMD\_COMGR\_ACTION\_\*, etc.) should remain consistent between versions, even if
270+
some enum values are deprecated and removed. This will avoid potential breakages
271+
and binary incompatibilities.

amd/comgr/docs/ReleaseNotes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ Comgr Testing, Debugging, and Logging Updates
6060
---------------------------------------------
6161
- Removed HIP\_PATH and ROCM\_PATH environment variables. These were used for
6262
now-removed Comgr actions, such as \*COMPILE\_SOURCE\_TO\_FATBIN.
63-
- Added a new Comgr LIT testing infrastrucutre, which can be found in
63+
- Added a new Comgr LIT testing infrastructure, which can be found in
6464
amd/comgr/test-lit. This will allow us to write more in-depth and targeted
6565
tests.
66+
- Added support for source-based code coverage. See README.md for more details.
6667

6768
New Targets
6869
-----------

amd/comgr/src/comgr-isa-metadata.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx904", false, true, EF_AMDGPU_MAC
4747
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx906", true, true, EF_AMDGPU_MACH_AMDGCN_GFX906, true, true, 65536, 32, 4, 40, 1024, 16, 800, 102, 4, 256, 256)
4848
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx908", true, true, EF_AMDGPU_MACH_AMDGCN_GFX908, true, true, 65536, 32, 4, 40, 1024, 16, 800, 102, 4, 256, 256)
4949
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx909", false, true, EF_AMDGPU_MACH_AMDGCN_GFX909, true, true, 65536, 32, 4, 40, 1024, 16, 800, 102, 4, 256, 256)
50-
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx90a", true, true, EF_AMDGPU_MACH_AMDGCN_GFX90A, true, true, 65536, 32, 4, 40, 1024, 16, 800, 102, 4, 256, 256)
50+
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx90a", true, true, EF_AMDGPU_MACH_AMDGCN_GFX90A, true, true, 65536, 32, 4, 40, 1024, 16, 800, 102, 8, 512, 512)
5151
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx90c", false, true, EF_AMDGPU_MACH_AMDGCN_GFX90C, true, true, 65536, 32, 4, 40, 1024, 16, 800, 102, 4, 256, 256)
52-
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx942", true, true, EF_AMDGPU_MACH_AMDGCN_GFX942, true, false, 65536, 32, 4, 40, 1024, 16, 800, 102, 4, 256, 256)
53-
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx950", true, true, EF_AMDGPU_MACH_AMDGCN_GFX950, true, false, 65536, 32, 4, 40, 1024, 16, 800, 102, 4, 256, 256)
52+
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx942", true, true, EF_AMDGPU_MACH_AMDGCN_GFX942, true, false, 65536, 32, 4, 40, 1024, 16, 800, 102, 8, 512, 512)
53+
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx950", true, true, EF_AMDGPU_MACH_AMDGCN_GFX950, true, false, 65536, 32, 4, 40, 1024, 16, 800, 102, 8, 512, 512)
5454
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1010", false, true, EF_AMDGPU_MACH_AMDGCN_GFX1010, true, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 8, 1024, 256)
5555
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1011", false, true, EF_AMDGPU_MACH_AMDGCN_GFX1011, true, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 8, 1024, 256)
5656
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1012", false, true, EF_AMDGPU_MACH_AMDGCN_GFX1012, true, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 8, 1024, 256)
@@ -74,7 +74,7 @@ HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1200", false, false, EF_AMDGPU_MAC
7474
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1201", false, false, EF_AMDGPU_MACH_AMDGCN_GFX1201, true, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 24, 1536, 256)
7575

7676
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx9-generic", false, true, EF_AMDGPU_MACH_AMDGCN_GFX9_GENERIC, true, true, 65536, 32, 4, 40, 1024, 16, 800, 102, 4, 256, 256)
77-
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx9-4-generic", true, true, EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC, true, false, 65536, 32, 4, 40, 1024, 16, 800, 102, 4, 256, 256)
77+
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx9-4-generic", true, true, EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC, true, false, 65536, 32, 4, 40, 1024, 16, 800, 102, 8, 512, 512)
7878
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx10-1-generic", false, true, EF_AMDGPU_MACH_AMDGCN_GFX10_1_GENERIC, true, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 8, 1024, 256)
7979
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx10-3-generic", false, false, EF_AMDGPU_MACH_AMDGCN_GFX10_3_GENERIC, true, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 8, 1024, 256)
8080
HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx11-generic", false, false, EF_AMDGPU_MACH_AMDGCN_GFX11_GENERIC, true, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 16, 1024, 256)

0 commit comments

Comments
 (0)