Skip to content

Commit

Permalink
Merge branch 'llvm:main' into Select-v_sat_pk
Browse files Browse the repository at this point in the history
  • Loading branch information
Shoreshen authored Jan 13, 2025
2 parents 553bc7d + acbd822 commit e37d342
Show file tree
Hide file tree
Showing 1,088 changed files with 73,331 additions and 34,643 deletions.
12 changes: 12 additions & 0 deletions .ci/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ def get_metrics(github_repo: github.Repository, workflows_to_track: dict[str, in
completed_at = workflow_jobs[0].completed_at

job_result = int(workflow_jobs[0].conclusion == "success")
if job_result:
# We still might want to mark the job as a failure if one of the steps
# failed. This is required due to use setting continue-on-error in
# the premerge pipeline to prevent sending emails while we are
# testing the infrastructure.
# TODO(boomanaiden154): Remove this once the premerge pipeline is no
# longer in a testing state and we can directly assert the workflow
# result.
for step in workflow_jobs[0].steps:
if step.conclusion != "success":
job_result = 0
break

queue_time = started_at - created_at
run_time = completed_at - started_at
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/containers/github-action-ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ RUN apt-get update && \
nodejs \
perl-modules \
python3-psutil \
sudo \

# These are needed by the premerge pipeline. Pip is used to install
# dependent python packages and ccache is used for build caching. File and
Expand All @@ -66,12 +67,28 @@ RUN apt-get update && \
file \
tzdata

# Install sccache as it is needed by most of the project test workflows and
# cannot be installed by the ccache action when executing as a non-root user.
# TODO(boomanaiden154): This should be switched to being installed with apt
# once we bump to Ubuntu 24.04.
RUN curl -L 'https://github.com/mozilla/sccache/releases/download/v0.7.6/sccache-v0.7.6-x86_64-unknown-linux-musl.tar.gz' > /tmp/sccache.tar.gz && \
echo "2902a5e44c3342132f07b62e70cca75d9b23252922faf3b924f449808cc1ae58 /tmp/sccache.tar.gz" | sha256sum -c && \
tar xzf /tmp/sccache.tar.gz -O --wildcards '*/sccache' > '/usr/local/bin/sccache' && \
rm /tmp/sccache.tar.gz && \
chmod +x /usr/local/bin/sccache

ENV LLVM_SYSROOT=$LLVM_SYSROOT
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}

# Create a new user to avoid test failures related to a lack of expected
# permissions issues in some tests. Set the user id to 1001 as that is the
# user id that Github Actions uses to perform the checkout action.
RUN useradd gha -u 1001 -m -s /bin/bash

# Also add the user to passwordless sudoers so that we can install software
# later on without having to rebuild the container.
RUN adduser gha sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER gha

30 changes: 30 additions & 0 deletions .github/workflows/hlsl-matrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: HLSL Tests

permissions:
contents: read

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- llvm/**/DirectX/**
- .github/workflows/hlsl*
- clang/*HLSL*/**/*
- clang/**/*HLSL*
- llvm/**/Frontend/HLSL/**/*

jobs:
HLSL-Tests:
strategy:
fail-fast: false
matrix:
runs-on:
- hlsl-macos

uses: ./.github/workflows/hlsl-test-all.yaml
with:
SKU: hlsl-macos
TestTarget: check-hlsl-clang-mtl # TODO: This target changes based on SKU
LLVM-ref: ${{ github.ref }}
87 changes: 87 additions & 0 deletions .github/workflows/hlsl-test-all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: HLSL Test

permissions:
contents: read

on:
workflow_call:
inputs:
OffloadTest-branch:
description: 'Test Suite Branch'
required: false
default: 'main'
type: string
LLVM-ref:
description: 'LLVM Branch'
required: false
default: 'main'
type: string
SKU:
required: true
type: string
TestTarget:
required: false
default: 'check-hlsl'
type: string

jobs:
build:
runs-on: ${{ inputs.SKU }}
steps:
- name: Checkout DXC
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: Microsoft/DirectXShaderCompiler
ref: main
path: DXC
submodules: true
- name: Checkout LLVM
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ inputs.LLVM-branch }}
path: llvm-project
- name: Checkout OffloadTest
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: llvm-beanz/offload-test-suite
ref: main
path: OffloadTest
- name: Checkout Golden Images
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: llvm-beanz/offload-golden-images
ref: main
path: golden-images
- name: Setup Windows
if: runner.os == 'Windows'
uses: llvm/actions/setup-windows@main
with:
arch: amd64
- name: Build DXC
run: |
cd DXC
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On ${{ github.workspace }}/DXC/
ninja dxv llvm-dis
- name: Build LLVM
run: |
cd llvm-project
mkdir build
cd build
cmake -G Ninja -DDXIL_DIS=${{ github.workspace }}/DXC/build/bin/llvm-dis -DLLVM_INCLUDE_DXIL_TESTS=On -DCMAKE_BUILD_TYPE=Release -C ${{ github.workspace }}/llvm-project/clang/cmake/caches/HLSL.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DDXC_DIR=${{ github.workspace }}/DXC/build/bin -DLLVM_EXTERNAL_OFFLOADTEST_SOURCE_DIR=${{ github.workspace }}/OffloadTest -DLLVM_EXTERNAL_PROJECTS="OffloadTest" -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v" -DGOLDENIMAGE_DIR=${{ github.workspace }}/golden-images ${{ github.workspace }}/llvm-project/llvm/
ninja hlsl-test-depends llvm-test-depends clang-test-depends
- name: Run HLSL Tests
run: |
cd llvm-project
cd build
ninja check-llvm
ninja check-clang
ninja check-hlsl-unit
ninja ${{ inputs.TestTarget }}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/macos@170bf24d20d201b842d7a52403b73ed297e6645b # v2
if: always() && runner.os == 'macOS'
with:
comment_mode: off
files: llvm-project/build/**/testresults.xunit.xml
2 changes: 1 addition & 1 deletion .github/workflows/libclang-python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ jobs:
projects: clang
# There is an issue running on "windows-2019".
# See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
os_list: '["ubuntu-latest"]'
os_list: '["ubuntu-22.04"]'
python_version: ${{ matrix.python-version }}
10 changes: 8 additions & 2 deletions .github/workflows/llvm-project-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ on:
type: string
# Use windows-2019 due to:
# https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
default: '["ubuntu-latest", "windows-2019", "macOS-13"]'
# Use ubuntu-22.04 rather than ubuntu-latest to match the ubuntu
# version in the CI container. Without this, setup-python tries
# to install a python version linked against a newer version of glibc.
# TODO(boomanaiden154): Bump the Ubuntu version once the version in the
# container is bumped.
default: '["ubuntu-22.04", "windows-2019", "macOS-13"]'

python_version:
required: false
Expand Down Expand Up @@ -113,7 +118,8 @@ jobs:
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
builddir="/mnt/build/"
mkdir -p $builddir
sudo mkdir -p $builddir
sudo chown gha $builddir
extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
else
builddir="$(pwd)"/build
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/premerge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ jobs:
- name: Setup ccache
uses: hendrikmuhs/[email protected]
- name: Build and Test
# Mark the job as a success even if the step fails so that people do
# not get notified while the new premerge pipeline is in an
# experimental state.
# TODO(boomanaiden154): Remove this once the pipeline is stable and we
# are ready for people to start recieving notifications.
continue-on-error: true
run: |
git config --global --add safe.directory '*'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spirv-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
build_target: check-llvm-codegen-spirv
projects:
extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV" -DLLVM_INCLUDE_SPIRV_TOOLS_TESTS=ON'
os_list: '["ubuntu-latest"]'
os_list: '["ubuntu-22.04"]'
15 changes: 7 additions & 8 deletions clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@ void ClangTidyCheck::OptionsView::store<bool>(
store(Options, LocalName, Value ? StringRef("true") : StringRef("false"));
}

std::optional<int64_t> ClangTidyCheck::OptionsView::getEnumInt(
StringRef LocalName, ArrayRef<NameAndValue> Mapping, bool CheckGlobal,
bool IgnoreCase) const {
std::optional<int64_t>
ClangTidyCheck::OptionsView::getEnumInt(StringRef LocalName,
ArrayRef<NameAndValue> Mapping,
bool CheckGlobal) const {
if (!CheckGlobal && Context->getOptionsCollector())
Context->getOptionsCollector()->insert((NamePrefix + LocalName).str());
auto Iter = CheckGlobal ? findPriorityOption(CheckOptions, NamePrefix,
Expand All @@ -178,12 +179,10 @@ std::optional<int64_t> ClangTidyCheck::OptionsView::getEnumInt(
StringRef Closest;
unsigned EditDistance = 3;
for (const auto &NameAndEnum : Mapping) {
if (IgnoreCase) {
if (Value.equals_insensitive(NameAndEnum.second))
return NameAndEnum.first;
} else if (Value == NameAndEnum.second) {
if (Value == NameAndEnum.second) {
return NameAndEnum.first;
} else if (Value.equals_insensitive(NameAndEnum.second)) {
}
if (Value.equals_insensitive(NameAndEnum.second)) {
Closest = NameAndEnum.second;
EditDistance = 0;
continue;
Expand Down
23 changes: 11 additions & 12 deletions clang-tools-extra/clang-tidy/ClangTidyCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
/// supply the mapping required to convert between ``T`` and a string.
template <typename T>
std::enable_if_t<std::is_enum_v<T>, std::optional<T>>
get(StringRef LocalName, bool IgnoreCase = false) const {
get(StringRef LocalName) const {
if (std::optional<int64_t> ValueOr =
getEnumInt(LocalName, typeEraseMapping<T>(), false, IgnoreCase))
getEnumInt(LocalName, typeEraseMapping<T>(), false))
return static_cast<T>(*ValueOr);
return std::nullopt;
}
Expand All @@ -353,9 +353,9 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
/// \ref clang::tidy::OptionEnumMapping must be specialized for ``T`` to
/// supply the mapping required to convert between ``T`` and a string.
template <typename T>
std::enable_if_t<std::is_enum_v<T>, T> get(StringRef LocalName, T Default,
bool IgnoreCase = false) const {
return get<T>(LocalName, IgnoreCase).value_or(Default);
std::enable_if_t<std::is_enum_v<T>, T> get(StringRef LocalName,
T Default) const {
return get<T>(LocalName).value_or(Default);
}

/// Read a named option from the ``Context`` and parse it as an
Expand All @@ -373,9 +373,9 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
/// supply the mapping required to convert between ``T`` and a string.
template <typename T>
std::enable_if_t<std::is_enum_v<T>, std::optional<T>>
getLocalOrGlobal(StringRef LocalName, bool IgnoreCase = false) const {
getLocalOrGlobal(StringRef LocalName) const {
if (std::optional<int64_t> ValueOr =
getEnumInt(LocalName, typeEraseMapping<T>(), true, IgnoreCase))
getEnumInt(LocalName, typeEraseMapping<T>(), true))
return static_cast<T>(*ValueOr);
return std::nullopt;
}
Expand All @@ -394,10 +394,9 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
/// \ref clang::tidy::OptionEnumMapping must be specialized for ``T`` to
/// supply the mapping required to convert between ``T`` and a string.
template <typename T>
std::enable_if_t<std::is_enum_v<T>, T>
getLocalOrGlobal(StringRef LocalName, T Default,
bool IgnoreCase = false) const {
return getLocalOrGlobal<T>(LocalName, IgnoreCase).value_or(Default);
std::enable_if_t<std::is_enum_v<T>, T> getLocalOrGlobal(StringRef LocalName,
T Default) const {
return getLocalOrGlobal<T>(LocalName).value_or(Default);
}

/// Stores an option with the check-local name \p LocalName with
Expand Down Expand Up @@ -454,7 +453,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {

std::optional<int64_t> getEnumInt(StringRef LocalName,
ArrayRef<NameAndValue> Mapping,
bool CheckGlobal, bool IgnoreCase) const;
bool CheckGlobal) const;

template <typename T>
std::enable_if_t<std::is_enum_v<T>, std::vector<NameAndValue>>
Expand Down
Loading

0 comments on commit e37d342

Please sign in to comment.