Skip to content

Commit

Permalink
Merge branch 'sycl' into change-MAX_MEMORY_BANDWIDTH-device-query-to-…
Browse files Browse the repository at this point in the history
…int64
  • Loading branch information
omarahmed1111 committed Feb 11, 2025
2 parents 259ed04 + d160d75 commit a1a2565
Show file tree
Hide file tree
Showing 236 changed files with 4,023 additions and 1,195 deletions.
16 changes: 16 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ sycl/doc/design/spirv-extensions/ @intel/dpcpp-spirv-doc-reviewers
sycl/doc/extensions/ @intel/dpcpp-specification-reviewers

# Unified Runtime
unified-runtime/ @intel/unified-runtime-reviewers
# TODO: Use specific UR Level Zero adapter team
unified-runtime/*/adapters/level_zero/ @intel/unified-runtime-reviewers
# TODO: Use specific UR OpenCL adapter team
unified-runtime/*/adapters/opencl/ @intel/unified-runtime-reviewers
unified-runtime/*/adapters/cuda/ @intel/llvm-reviewers-cuda
unified-runtime/*/adapters/hip/ @intel/llvm-reviewers-cuda
unified-runtime/*/adapters/native_cpu/ @intel/dpcpp-nativecpu-reviewers
unified-runtime/source/adapters/**/command_buffer.* @intel/sycl-graphs-reviewers
unified-runtime/scripts/core/EXP-COMMAND-BUFFER.rst @intel/sycl-graphs-reviewers
unified-runtime/scripts/core/exp-command-buffer.yml @intel/sycl-graphs-reviewers
unified-runtime/test/conformance/exp_command_buffer** @intel/sycl-graphs-reviewers
unified-runtime/source/adapters/**/image.* @intel/bindless-images-reviewers
unified-runtime/scripts/core/EXP-BINDLESS-IMAGES.rst @intel/bindless-images-reviewers
unified-runtime/scripts/core/exp-bindless-images.yml @intel/bindless-images-reviewers
unified-runtime/test/conformance/exp_bindless_images** @intel/bindless-images-reviewers
sycl/cmake/modules/FetchUnifiedRuntime.cmake @intel/unified-runtime-reviewers
sycl/cmake/modules/UnifiedRuntimeTag.cmake @intel/unified-runtime-reviewers
sycl/include/sycl/detail/ur.hpp @intel/unified-runtime-reviewers
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Coverity
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'

permissions: read-all

jobs:
coverity:
name: Coverity
runs-on: [Linux, build]
container:
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps
options: -u 1001:1001

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
devops/actions
- name: Register cleanup after job is finished
uses: ./devops/actions/cleanup

- uses: ./devops/actions/cached_checkout
with:
path: src
ref: ${{ github.sha }}
cache_path: "/__w/repo_cache/"

- name: Get coverity tool
run: |
wget https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=intel%2Fllvm" -O coverity_tool.tgz
tar -xf coverity_tool.tgz
- name: Configure
env:
CC: gcc
CXX: g++
CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs"
run: |
mkdir -p $GITHUB_WORKSPACE/build
cd $GITHUB_WORKSPACE/build
python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release \
--ci-defaults --hip --cuda \
--cmake-opt="-DNATIVECPU_USE_OCK=Off" \
--cmake-opt="-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SPIRV"
- name: Build with coverity
run: $GITHUB_WORKSPACE/cov-analysis-linux64-*/bin/cov-build --dir cov-int cmake --build $GITHUB_WORKSPACE/build

- name: Compress results
run: tar -czf intel_llvm.tgz cov-int

- name: Submit build
run: |
# Initialize a build. Fetch a cloud upload url.
curl -X POST \
-d version="sycl: ${{ github.sha }}" \
-d description="Regular build" \
-d email=${{ secrets.COVERITY_EMAIL }} \
-d token=${{ secrets.COVERITY_TOKEN }} \
-d file_name="intel_llvm.tgz" \
https://scan.coverity.com/projects/31090/builds/init \
| tee response
# Store response data to use in later stages.
upload_url=$(jq -r '.url' response)
build_id=$(jq -r '.build_id' response)
# Upload the tarball to the Cloud.
curl -X PUT \
--header 'Content-Type: application/json' \
--upload-file $PWD/intel_llvm.tgz \
$upload_url
# Trigger the build on Scan.
curl -X PUT \
-d token=${{ secrets.COVERITY_TOKEN }} \
https://scan.coverity.com/projects/31090/builds/$build_id/enqueue
37 changes: 37 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow performs a trivy check of docker config files.

name: Trivy

on:
pull_request:
paths:
- 'devops/containers/**'
- 'devops/.trivyignore.yaml'
- '.github/workflows/trivy.yml'
workflow_dispatch:

jobs:
build:
name: Trivy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: devops

# There is a github action, but for some reason it ignores ignore-file.
- name: Install Trivy
run: |
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh
./bin/trivy --version
- name: Run Trivy vulnerability scanner
run: ./bin/trivy config --format json --output trivy-report.json --ignorefile=devops/.trivyignore.yaml devops/containers --exit-code 1

- name: Upload report artifact
uses: actions/upload-artifact@v4
with:
name: trivy-report
path: trivy-report.json
retention-days: 3
21 changes: 18 additions & 3 deletions clang/lib/Driver/ToolChains/SYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,13 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
{"libsycl-asan-cpu", "internal"},
{"libsycl-asan-dg2", "internal"},
{"libsycl-asan-pvc", "internal"}};
const SYCLDeviceLibsList SYCLDeviceMsanLibs = {{"libsycl-msan", "internal"}};
const SYCLDeviceLibsList SYCLDeviceMsanLibs = {
{"libsycl-msan", "internal"},
{"libsycl-msan-cpu", "internal"},
// Currently, we only provide aot msan libdevice for PVC and CPU.
// For DG2, we just use libsycl-msan as placeholder.
{"libsycl-msan", "internal"},
{"libsycl-msan-pvc", "internal"}};
#endif

const SYCLDeviceLibsList SYCLNativeCpuDeviceLibs = {
Expand Down Expand Up @@ -769,7 +775,7 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
if (SanitizeVal == "address")
addSingleLibrary(SYCLDeviceAsanLibs[sanitizer_lib_idx]);
else if (SanitizeVal == "memory")
addLibraries(SYCLDeviceMsanLibs);
addSingleLibrary(SYCLDeviceMsanLibs[sanitizer_lib_idx]);
#endif

if (isNativeCPU)
Expand Down Expand Up @@ -2055,9 +2061,18 @@ void SYCLToolChain::AddImpliedTargetArgs(const llvm::Triple &Triple,
if (Args.hasFlag(options::OPT_ftarget_export_symbols,
options::OPT_fno_target_export_symbols, false))
BeArgs.push_back("-library-compilation");
} else if (IsJIT)
// -foffload-fp32-prec-[sqrt/div]
if (Args.hasArg(options::OPT_foffload_fp32_prec_div) ||
Args.hasArg(options::OPT_foffload_fp32_prec_sqrt))
BeArgs.push_back("-ze-fp32-correctly-rounded-divide-sqrt");
} else if (IsJIT) {
// -ftarget-compile-fast JIT
Args.AddLastArg(BeArgs, options::OPT_ftarget_compile_fast);
// -foffload-fp32-prec-div JIT
Args.AddLastArg(BeArgs, options::OPT_foffload_fp32_prec_div);
// -foffload-fp32-prec-sqrt JIT
Args.AddLastArg(BeArgs, options::OPT_foffload_fp32_prec_sqrt);
}
if (IsGen) {
for (auto [DeviceName, BackendArgStr] : PerDeviceArgs) {
CmdArgs.push_back("-device_options");
Expand Down
23 changes: 23 additions & 0 deletions clang/test/Driver/sycl-device-lib-old-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,26 @@
// SYCL_DEVICE_MSAN_MACRO-SAME: "USE_SYCL_DEVICE_MSAN"
// SYCL_DEVICE_MSAN_MACRO: llvm-link{{.*}} "-only-needed"
// SYCL_DEVICE_MSAN_MACRO-SAME: "{{.*}}libsycl-msan.bc"

/// ###########################################################################
/// test behavior of linking libsycl-msan-pvc for PVC target AOT compilation when msan flag is applied.
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc --no-offload-new-driver %s --sysroot=%S/Inputs/SYCL \
// RUN: -Xarch_device -fsanitize=memory -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_MSAN_PVC
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device pvc" --no-offload-new-driver %s \
// RUN: --sysroot=%S/Inputs/SYCL -Xarch_device -fsanitize=memory -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_MSAN_PVC
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" --no-offload-new-driver %s \
// RUN: --sysroot=%S/Inputs/SYCL -Xarch_device -fsanitize=memory -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_MSAN_PVC
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device 12.60.7" --no-offload-new-driver %s \
// RUN: --sysroot=%S/Inputs/SYCL -Xarch_device -fsanitize=memory -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_MSAN_PVC
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xs "-device 12.60.7" --no-offload-new-driver %s --sysroot=%S/Inputs/SYCL \
// RUN: -Xarch_device -fsanitize=memory -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_MSAN_PVC
// SYCL_DEVICE_LIB_MSAN_PVC: llvm-link{{.*}} "{{.*}}libsycl-crt.bc"
// SYCL_DEVICE_LIB_MSAN_PVC-SAME: "{{.*}}libsycl-msan-pvc.bc"


/// ###########################################################################
/// test behavior of linking libsycl-msan-cpu for CPU target AOT compilation when msan flag is applied.
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 --no-offload-new-driver %s --sysroot=%S/Inputs/SYCL \
// RUN: -Xarch_device -fsanitize=memory -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_MSAN_CPU
// SYCL_DEVICE_LIB_MSAN_CPU: llvm-link{{.*}} "{{.*}}libsycl-crt.bc"
// SYCL_DEVICE_LIB_MSAN_CPU-SAME: "{{.*}}libsycl-msan-cpu.bc"
13 changes: 13 additions & 0 deletions clang/test/Driver/sycl-device-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,16 @@
// SYCL_DEVICE_MSAN_MACRO: "-cc1"
// SYCL_DEVICE_MSAN_MACRO-SAME: "USE_SYCL_DEVICE_MSAN"
// SYCL_DEVICE_MSAN_MACRO: libsycl-msan.new.o

/// test behavior of msan libdevice linking when -fsanitize=memory is available for AOT targets
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc --offload-new-driver %s --sysroot=%S/Inputs/SYCL \
// RUN: -fsanitize=memory -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_MSAN_PVC
// SYCL_DEVICE_LIB_MSAN_PVC: clang-linker-wrapper{{.*}} "-sycl-device-libraries
// SYCL_DEVICE_LIB_MSAN_PVC-SAME: {{.*}}libsycl-msan-pvc.new.o

/// test behavior of msan libdevice linking when -fsanitize=memory is available for AOT targets
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 --offload-new-driver %s --sysroot=%S/Inputs/SYCL \
// RUN: -fsanitize=memory -### 2>&1 | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_MSAN_CPU
// SYCL_DEVICE_LIB_MSAN_CPU: clang-linker-wrapper{{.*}} "-sycl-device-libraries
// SYCL_DEVICE_LIB_MSAN_CPU-SAME: {{.*}}libsycl-msan-cpu.new.o

13 changes: 13 additions & 0 deletions clang/test/Driver/sycl-foffload-fp32-prec-div-old-model.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Test SYCL -foffload-fp32-prec-div

// RUN: %clang -### -fsycl --no-offload-new-driver \
// RUN: -fsycl-targets=spir64_gen -foffload-fp32-prec-div %s 2>&1 \
// RUN: | FileCheck -check-prefix=AOT %s

// RUN: %clang -### -fsycl --no-offload-new-driver \
// RUN: -foffload-fp32-prec-div %s 2>&1 \
// RUN: | FileCheck -check-prefix=JIT %s

// AOT: "-ze-fp32-correctly-rounded-divide-sqrt"

// JIT: clang-offload-wrapper{{.*}} "-compile-opts={{.*}}-foffload-fp32-prec-div"
13 changes: 13 additions & 0 deletions clang/test/Driver/sycl-foffload-fp32-prec-div.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Test SYCL -foffload-fp32-prec-div

// RUN: %clang -### -fsycl --offload-new-driver \
// RUN: -fsycl-targets=spir64_gen -foffload-fp32-prec-div %s 2>&1 \
// RUN: | FileCheck -check-prefix=AOT %s

// RUN: %clang -### -fsycl --offload-new-driver \
// RUN: -foffload-fp32-prec-div %s 2>&1 \
// RUN: | FileCheck -check-prefix=JIT %s

// AOT: clang-offload-packager{{.*}} "--image=file={{.*}}.bc,triple=spir64_gen-unknown-unknown,arch={{.*}},kind=sycl,compile-opts=-options -ze-fp32-correctly-rounded-divide-sqrt{{.*}}"

// JIT: clang-offload-packager{{.*}} "--image=file={{.*}}.bc,triple=spir64-unknown-unknown,arch={{.*}}compile-opts={{.*}}-foffload-fp32-prec-div"
13 changes: 13 additions & 0 deletions clang/test/Driver/sycl-foffload-fp32-prec-sqrt-old-model.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Test SYCL -foffload-fp32-prec-sqrt

// RUN: %clang -### -fsycl --no-offload-new-driver \
// RUN: -fsycl-targets=spir64_gen -foffload-fp32-prec-sqrt %s 2>&1 \
// RUN: | FileCheck -check-prefix=AOT %s

// RUN: %clang -### -fsycl --no-offload-new-driver \
// RUN: -foffload-fp32-prec-sqrt %s 2>&1 \
// RUN: | FileCheck -check-prefix=JIT %s

// AOT: "-ze-fp32-correctly-rounded-divide-sqrt"

// JIT: clang-offload-wrapper{{.*}} "-compile-opts={{.*}}-foffload-fp32-prec-sqrt"
13 changes: 13 additions & 0 deletions clang/test/Driver/sycl-foffload-fp32-prec-sqrt.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Test SYCL -foffload-fp32-prec-sqrt

// RUN: %clang -### -fsycl --offload-new-driver \
// RUN: -fsycl-targets=spir64_gen -foffload-fp32-prec-sqrt %s 2>&1 \
// RUN: | FileCheck -check-prefix=AOT %s

// RUN: %clang -### -fsycl --offload-new-driver \
// RUN: -foffload-fp32-prec-sqrt %s 2>&1 \
// RUN: | FileCheck -check-prefix=JIT %s

// AOT: clang-offload-packager{{.*}} "--image=file={{.*}}.bc,triple=spir64_gen-unknown-unknown,arch={{.*}},kind=sycl,compile-opts=-options -ze-fp32-correctly-rounded-divide-sqrt{{.*}}"

// JIT: clang-offload-packager{{.*}} "--image=file={{.*}}.bc,triple=spir64-unknown-unknown,arch={{.*}}compile-opts={{.*}}-foffload-fp32-prec-sqrt"
8 changes: 3 additions & 5 deletions clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Parallel.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/SimpleTable.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/TargetSelect.h"
Expand Down Expand Up @@ -156,7 +154,7 @@ static std::optional<llvm::module_split::IRSplitMode> SYCLModuleSplitMode;

static bool UseSYCLPostLinkTool;

SmallString<128> SPIRVDumpDir;
static SmallString<128> SPIRVDumpDir;

using OffloadingImage = OffloadBinary::OffloadingImage;

Expand Down Expand Up @@ -1480,7 +1478,7 @@ Error extractBundledObjects(StringRef Filename, const ArgList &Args,
if (Magic == file_magic::spirv_object)
return createStringError(
"SPIR-V fat objects must be generated with --offload-new-driver");
auto Arg = Args.MakeArgString(
const auto *Arg = Args.MakeArgString(
"sycl-" +
(Triple.isSPIROrSPIRV() ? Triple.str() + "-" : Triple.str()) + "=" +
ObjectFilePath);
Expand Down Expand Up @@ -2237,7 +2235,7 @@ DerivedArgList getLinkerArgs(ArrayRef<OffloadFile> Input,
DAL.AddJoinedArg(nullptr, Tbl.getOption(OPT_triple_EQ),
Args.MakeArgString(Input.front().getBinary()->getTriple()));

auto Bin = Input.front().getBinary();
const auto *Bin = Input.front().getBinary();
DAL.AddJoinedArg(
nullptr, Tbl.getOption(OPT_sycl_backend_compile_options_from_image_EQ),
Args.MakeArgString(Bin->getString(COMPILE_OPTS)));
Expand Down
5 changes: 5 additions & 0 deletions devops/.trivyignore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
misconfigurations:
- id: AVD-DS-0001
statement: "We use our own containers, no uncontrolled behavior is expected when the image is updated"
- id: AVD-DS-0026
statement: "Our containers do not provide running services, but only preinstalled tools, there is not much value in adding HEALTHCHECK directives"
2 changes: 1 addition & 1 deletion devops/actions/run-tests/e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ runs:
- name: SYCL End-to-end tests
shell: bash {0}
env:
LIT_OPTS: -v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests --param test-mode=${{ inputs.testing_mode }} --param sycl_devices=${{ inputs.target_devices }} ${{ inputs.extra_lit_opts }}
LIT_OPTS: -v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests --param print_features=True --param test-mode=${{ inputs.testing_mode }} --param sycl_devices=${{ inputs.target_devices }} ${{ inputs.extra_lit_opts }}
run: |
ninja -C build-e2e check-sycl-e2e > e2e.log 2>&1
exit_code=$?
Expand Down
2 changes: 1 addition & 1 deletion devops/scripts/windows_detect_hung_tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ $hungTests = Get-Process | Where-Object { ($_.Path -match "llvm\\install") -or (
$hungTests | Foreach-Object {
$exitCode = 1
echo "Test $($_.Path) hung!"
Stop-Process -Force $_
tskill $_.ID
}
exit $exitCode
2 changes: 0 additions & 2 deletions libclc/generic/lib/common/radians.cl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <clc/clc.h>
#include <clc/clcmacro.h>
#include <clc/common/clc_radians.h>
#include <libspirv/spirv.h>


_CLC_DEFINE_UNARY_BUILTIN(float, radians, __clc_radians, float)

Expand Down
1 change: 0 additions & 1 deletion libclc/generic/lib/common/smoothstep.cl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include <clc/clc.h>
#include <clc/clcmacro.h>
#include <libspirv/spirv.h>
#include <clc/common/clc_smoothstep.h>

#define SMOOTHSTEP_SINGLE_DEF(X_TYPE) \
Expand Down
3 changes: 0 additions & 3 deletions libclc/generic/lib/math/mad.inc

This file was deleted.

1 change: 1 addition & 0 deletions libclc/libspirv/include/libspirv/spirv.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include <libspirv/workitem/get_global_size.h>
#include <libspirv/workitem/get_group_id.h>
#include <libspirv/workitem/get_local_id.h>
#include <libspirv/workitem/get_local_linear_id.h>
#include <libspirv/workitem/get_local_size.h>
#include <libspirv/workitem/get_max_sub_group_size.h>
#include <libspirv/workitem/get_num_groups.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@
//
//===----------------------------------------------------------------------===//

_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __spirv_ocl_mad(__CLC_GENTYPE a,
__CLC_GENTYPE b,
__CLC_GENTYPE c) {
return a * b + c;
}
_CLC_DECL _CLC_OVERLOAD size_t __spirv_LocalInvocationIndex();
Loading

0 comments on commit a1a2565

Please sign in to comment.