Skip to content

Commit

Permalink
Merge branch 'sycl' of https://github.com/intel/llvm into ianayl/2way…
Browse files Browse the repository at this point in the history
…-prefetch
  • Loading branch information
ianayl committed Dec 20, 2024
2 parents 0ec09f8 + 7146eec commit 653df4f
Show file tree
Hide file tree
Showing 89 changed files with 1,673 additions and 1,784 deletions.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,16 @@ sycl/test-e2e/LLVMIntrinsicLowering/ @intel/dpcpp-spirv-reviewers
# Sanitizer
clang/lib/Driver/SanitizerArgs.cpp @intel/dpcpp-sanitizers-review
libdevice/include/asan_rtl.hpp @intel/dpcpp-sanitizers-review
libdevice/include/msan_rtl.hpp @intel/dpcpp-sanitizers-review
libdevice/include/sanitizer_defs.hpp @intel/dpcpp-sanitizers-review
libdevice/sanitizer/ @intel/dpcpp-sanitizers-review
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h @intel/dpcpp-sanitizers-review
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h @intel/dpcpp-sanitizers-review
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h @intel/dpcpp-sanitizers-review
llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h @intel/dpcpp-sanitizers-review
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @intel/dpcpp-sanitizers-review
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @intel/dpcpp-sanitizers-review
llvm/test/Instrumentation/AddressSanitizer/ @intel/dpcpp-sanitizers-review
llvm/test/Instrumentation/MemorySanitizer/ @intel/dpcpp-sanitizers-review
sycl/test-e2e/AddressSanitizer/ @intel/dpcpp-sanitizers-review
sycl/test-e2e/MemorySanitizer/ @intel/dpcpp-sanitizers-review
1 change: 0 additions & 1 deletion .github/workflows/sycl-containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ jobs:
file: ${{ matrix.file }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
sycl_ci_passwd: ${{ secrets.DOCKER_SUDO_PASSWORD }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.file }}:${{ matrix.tag }}-${{ github.sha }}
ghcr.io/${{ github.repository }}/${{ matrix.file }}:${{ matrix.tag }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sycl-linux-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ jobs:
reset_intel_gpu: false
- name: Intel
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
target_devices: level_zero:gpu;opencl:gpu;opencl:cpu
reset_intel_gpu: true
extra_lit_opts: --param gpu-intel-gen12=True
- name: E2E tests on Intel Arc A-Series Graphics
runner: '["Linux", "arc"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
target_devices: level_zero:gpu;opencl:gpu
reset_intel_gpu: true
Expand Down Expand Up @@ -161,12 +161,12 @@ jobs:
include:
- name: Intel GEN12 Graphics system
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_extra_opts: --device=/dev/dri
reset_intel_gpu: true
- name: Intel Arc A-Series Graphics system
runner: '["Linux", "arc"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_extra_opts: --device=/dev/dri
reset_intel_gpu: true
- name: AMD system
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/sycl-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

- name: Intel L0 GPU
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
target_devices: level_zero:gpu
reset_intel_gpu: true
Expand All @@ -61,7 +61,7 @@ jobs:

- name: Intel OCL GPU
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
target_devices: opencl:gpu
reset_intel_gpu: true
Expand All @@ -70,35 +70,35 @@ jobs:

- name: OCL CPU (AMD)
runner: '["Linux", "amdgpu"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001
target_devices: opencl:cpu
tests_selector: e2e

- name: OCL CPU (Intel/GEN12)
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --privileged --cap-add SYS_ADMIN
target_devices: opencl:cpu
tests_selector: e2e

- name: OCL CPU (Intel/Arc)
runner: '["Linux", "arc"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001
target_devices: opencl:cpu
tests_selector: e2e

- name: SYCL-CTS on OCL CPU
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
target_devices: opencl:cpu
tests_selector: cts

- name: SYCL-CTS on L0 gen12
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
target_devices: level_zero:gpu
tests_selector: cts
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
build-args: |
base_image=ghcr.io/intel/llvm/ubuntu2204_intel_drivers
base_image=ghcr.io/intel/llvm/ubuntu2404_intel_drivers
base_tag=latest
tags: |
ghcr.io/${{ github.repository }}/sycl_ubuntu2204_nightly:${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sycl-post-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
with:
name: ${{ matrix.name }}
runner: ${{ matrix. runner }}
image: ${{ matrix.image || 'ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest' }}
image: ${{ matrix.image || 'ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest' }}
image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }}
target_devices: ${{ matrix.target_devices || 'level_zero:gpu' }}
reset_intel_gpu: ${{ matrix.reset_intel_gpu }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/sycl-rel-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ jobs:
include:
- name: AMD/HIP
runner: '["Linux", "amdgpu"]'
image: ghcr.io/intel/llvm/ubuntu2204_build:latest
image: ghcr.io/intel/llvm/ubuntu2404_build:latest
image_options: -u 1001 --device=/dev/dri --device=/dev/kfd
target_devices: ext_oneapi_hip:gpu
tests_selector: e2e

- name: Intel L0 GPU
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
target_devices: level_zero:gpu
reset_intel_gpu: true
Expand All @@ -70,7 +70,7 @@ jobs:

- name: Intel OCL GPU
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
target_devices: opencl:gpu
reset_intel_gpu: true
Expand All @@ -79,21 +79,21 @@ jobs:

- name: Intel OCL CPU
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --privileged --cap-add SYS_ADMIN
target_devices: opencl:cpu
tests_selector: e2e

- name: SYCL-CTS on OCL CPU
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
target_devices: opencl:cpu
tests_selector: cts

- name: SYCL-CTS on L0 gen12
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
target_devices: level_zero:gpu
tests_selector: cts
Expand Down
44 changes: 40 additions & 4 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5665,9 +5665,27 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-Wno-sycl-strict");
}

// Set O2 optimization level by default
if (!Args.getLastArg(options::OPT_O_Group))
CmdArgs.push_back("-O2");
// If no optimization controlling flags (-O) are provided, check if
// any debug information flags(-g) are passed.
// "-fintelfpga" implies "-g" and we preserve the default optimization for
// this flow(-O2).
// if "-g" is explicitly passed from the command-line, set default
// optimization to -O0.

if (!Args.hasArgNoClaim(options::OPT_O_Group, options::OPT__SLASH_O)) {
StringRef OptLevel = "-O2";
const Arg *DebugInfoGroup = Args.getLastArg(options::OPT_g_Group);
// -fintelfpga -g case
if ((Args.hasArg(options::OPT_fintelfpga) &&
Args.hasMultipleArgs(options::OPT_g_Group)) ||
/* -fsycl -g case */ (!Args.hasArg(options::OPT_fintelfpga) &&
DebugInfoGroup)) {
if (!DebugInfoGroup->getOption().matches(options::OPT_g0)) {
OptLevel = "-O0";
}
}
CmdArgs.push_back(OptLevel.data());
}

// Add the integration header option to generate the header.
StringRef Header(D.getIntegrationHeader(Input.getBaseInput()));
Expand Down Expand Up @@ -10931,7 +10949,25 @@ static std::string getSYCLPostLinkOptimizationLevel(const ArgList &Args) {
[=](char c) { return c == S[0]; }))
return std::string("-O") + S[0];
}

// If no optimization controlling flags (-O) are provided, check if
// any debug information flags(-g) are passed.
// "-fintelfpga" implies "-g" and we preserve the default optimization for
// this flow(-O2).
// if "-g" is explicitly passed from the command-line, set default
// optimization to -O0.

if (!Args.hasArg(options::OPT_O_Group)) {
const Arg *DebugInfoGroup = Args.getLastArg(options::OPT_g_Group);
// -fintelfpga -g case
if ((Args.hasArg(options::OPT_fintelfpga) &&
Args.hasMultipleArgs(options::OPT_g_Group)) ||
/* -fsycl -g case */
(!Args.hasArg(options::OPT_fintelfpga) && DebugInfoGroup)) {
if (!DebugInfoGroup->getOption().matches(options::OPT_g0)) {
return "-O0";
}
}
}
// The default for SYCL device code optimization
return "-O2";
}
Expand Down
56 changes: 56 additions & 0 deletions clang/test/Driver/sycl-device-optimizations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,59 @@
// RUN: %clang -### -fsycl --offload-new-driver %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-NO-THRESH %s
// CHECK-NO-THRESH-NOT: "-mllvm" "-inline-threshold

/// Check that optimizations for sycl device are disabled with -g passed:
// RUN: %clang -### -fsycl -g %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-DEBUG %s
// RUN: %clang_cl -### -fsycl -g %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-DEBUG %s
// CHECK-DEBUG: clang{{.*}} "-fsycl-is-device{{.*}}" "-O0"
// CHECK-DEBUG: sycl-post-link{{.*}} "-O0"
// CHECK-DEBUG-NOT: "-O2"

/// Check that optimizations for sycl device are enabled with -g and O2 passed:
// RUN: %clang -### -fsycl -O2 -g %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-G-O2 %s
// For clang_cl, -O2 maps to -O3
// RUN: %clang_cl -### -fsycl -O2 -g %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-G-O3 %s
// CHECK-G-O2: clang{{.*}} "-fsycl-is-device{{.*}}" "-O2"
// CHECK-G-O2: sycl-post-link{{.*}} "-O2"
// CHECK-G-O2-NOT: "-O0"
// CHECK-G-O3: clang{{.*}} "-fsycl-is-device{{.*}}" "-O3"
// CHECK-G-O3: sycl-post-link{{.*}} "-O3"
// CHECK-G-O3-NOT: "-O0"

/// Check that -O2 is passed for FPGA
// RUN: %clang -### -fintelfpga -fsycl-early-optimizations %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-FPGA %s
// RUN: %clang_cl -### -fintelfpga -fsycl-early-optimizations %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-FPGA %s
// CHECK-FPGA: clang{{.*}} "-fsycl-is-device{{.*}}" "-O2"
// CHECK-FPGA: sycl-post-link{{.*}} "-O2"
// CHECK-FPGA-NOT: "-O0"

/// Check that -O2 preserves for FPGA when it's explicitly passed
// RUN: %clang -### -O2 -fintelfpga -fsycl-early-optimizations %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-FPGA-O2 %s
// For clang_cl, -O2 maps to -O3
// RUN: %clang_cl -### -O2 -fintelfpga -fsycl-early-optimizations %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-FPGA-O3 %s
// CHECK-FPGA-O2: clang{{.*}} "-fsycl-is-device{{.*}}" "-O2"
// CHECK-FPGA-O2: sycl-post-link{{.*}} "-O2"
// CHECK-FPGA-O2-NOT: "-O0"
// CHECK-FPGA-O3: clang{{.*}} "-fsycl-is-device{{.*}}" "-O3"
// CHECK-FPGA-O3: sycl-post-link{{.*}} "-O3"
// CHECK-FPGA-O3-NOT: "-O0"

/// Check that -O0 is passed for FPGA when -g is explicitly passed
// RUN: %clang -### -fintelfpga -g %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-FPGA-O0 %s
// RUN: %clang_cl -### -fintelfpga -g %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-FPGA-O0 %s
// CHECK-FPGA-O0: clang{{.*}} "-fsycl-is-device{{.*}}" "-O0"
// CHECK-FPGA-O0: sycl-post-link{{.*}} "-O0"
// CHECK-FPGA-O0-NOT: "-O2"



4 changes: 2 additions & 2 deletions clang/test/Driver/sycl-offload-intelfpga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@
// RUN: | FileCheck -check-prefix=CHK-TOOLS-IMPLIED-OPTS %s
// RUN: %clang_cl -### -fintelfpga -Zi -Od -Xs "-DFOO1 -DFOO2" -Xshardware %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-TOOLS-IMPLIED-OPTS %s
// CHK-TOOLS-IMPLIED-OPTS-NOT: clang{{.*}} "-fsycl-is-device"{{.*}} "-O0"
// CHK-TOOLS-IMPLIED-OPTS: sycl-post-link{{.*}} "-O2"
// CHK-TOOLS-IMPLIED-OPTS: clang{{.*}} "-fsycl-is-device"{{.*}} "-fno-sycl-early-optimizations"{{.*}} "-O0"
// CHK-TOOLS-IMPLIED-OPTS: sycl-post-link{{.*}} "-O0"
// CHK-TOOLS-IMPLIED-OPTS: aoc{{.*}} "-g" "-DFOO1" "-DFOO2"

/// shared objects should not be checked for FPGA contents
Expand Down
3 changes: 3 additions & 0 deletions clang/tools/clang-offload-bundler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ add_clang_tool(clang-offload-bundler
intrinsics_gen
)

setup_host_tool(clang-offload-bundler CLANG_OFFLOAD_BUNDLER
clang-offload-bundler_exe clang-offload-bundler_target)

set(CLANG_OFFLOAD_BUNDLER_LIB_DEPS
clangBasic
clangDriver
Expand Down
3 changes: 3 additions & 0 deletions clang/tools/clang-offload-packager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ add_clang_tool(clang-offload-packager
${tablegen_deps}
)

setup_host_tool(clang-offload-packager CLANG_OFFLOAD_PACKAGER_EXE
clang-offload-packager_exe clang-offload-packager_target)

clang_target_link_libraries(clang-offload-packager
PRIVATE
clangBasic
Expand Down
4 changes: 0 additions & 4 deletions devops/actions/build_container/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ inputs:
file:
description: "Dockerfile"
required: true
sycl_ci_passwd:
description: "Password to assign to sycl_ci user within a container"
required: true

runs:
using: "composite"
Expand All @@ -44,4 +41,3 @@ runs:
file: ${{ github.workspace }}/devops/containers/${{ inputs.file }}.Dockerfile
secrets: |
github_token=${{ github.token }}
sycl_ci_passwd=${{ inputs.sycl_ci_passwd }}
19 changes: 4 additions & 15 deletions devops/containers/ubuntu2204_base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,14 @@ USER root
COPY scripts/install_build_tools.sh /install.sh
RUN /install.sh

# By default Ubuntu sets an arbitrary UID value, that is different from host
# system. When CI passes default UID value of 1001, some of LLVM tools fail to
# discover user home directory and fail a few LIT tests. Fixes UID and GID to
# 1001, that is used as default by GitHub Actions.
RUN groupadd -g 1001 sycl && useradd sycl -u 1001 -g 1001 -m -s /bin/bash
# Add sycl user to video/irc groups so that it can access GPU
RUN usermod -aG video sycl
RUN usermod -aG irc sycl

# group 109 is required for sycl user to access PVC card.
RUN groupadd -g 109 render
RUN usermod -aG render sycl

# Allow sycl user to run as sudo
RUN echo "sycl ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
COPY scripts/create-sycl-user.sh /user-setup.sh
RUN /user-setup.sh

COPY actions/cached_checkout /actions/cached_checkout
COPY actions/cleanup /actions/cleanup
COPY scripts/docker_entrypoint.sh /docker_entrypoint.sh
COPY scripts/install_drivers.sh /opt/install_drivers.sh

USER sycl

ENTRYPOINT ["/docker_entrypoint.sh"]
Loading

0 comments on commit 653df4f

Please sign in to comment.