Skip to content

Commit 9d646a7

Browse files
committed
resolve merge conflicts
2 parents 31d790d + a0b5f56 commit 9d646a7

File tree

55 files changed

+1231
-338
lines changed

Some content is hidden

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

55 files changed

+1231
-338
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,16 @@ void SYCLToolChain::AddImpliedTargetArgs(const llvm::Triple &Triple,
17801780
ArgStringList TargArgs;
17811781
Args.AddAllArgValues(TargArgs, options::OPT_Xs, options::OPT_Xs_separate);
17821782
Args.AddAllArgValues(TargArgs, options::OPT_Xsycl_backend);
1783+
// For -Xsycl-target-backend=<triple> the triple value is used to push
1784+
// specific options to the matching device compilation using that triple.
1785+
// Scrutinize this to make sure we are only checking the values needed
1786+
// for the current device compilation.
1787+
for (auto *A : Args) {
1788+
if (!A->getOption().matches(options::OPT_Xsycl_backend_EQ))
1789+
continue;
1790+
if (getDriver().MakeSYCLDeviceTriple(A->getValue()) == Triple)
1791+
TargArgs.push_back(A->getValue(1));
1792+
}
17831793
// Check for any -device settings.
17841794
std::string DevArg;
17851795
if (IsJIT || Device == "pvc" || hasPVCDevice(TargArgs, DevArg)) {

clang/test/Driver/sycl-ftarget-register-alloc-mode-old-model.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
// RUN: -fsycl-targets=spir64_gen -Xs "-device pvc" %s 2>&1 \
2121
// RUN: | FileCheck %if system-windows %{ -check-prefix=DEFAULT_AOT %} %else %{ -check-prefix=AUTO_AOT %} %s -DDEVICE=pvc
2222

23+
// RUN: %clang -### -fsycl --no-offload-new-driver \
24+
// RUN: -fsycl-targets=spir64_gen -Xsycl-target-backend "-device pvc" %s 2>&1 \
25+
// RUN: | FileCheck %if system-windows %{ -check-prefix=DEFAULT_AOT %} %else %{ -check-prefix=AUTO_AOT %} %s -DDEVICE=pvc
26+
27+
// RUN: %clang -### -fsycl --no-offload-new-driver \
28+
// RUN: -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" %s 2>&1 \
29+
// RUN: | FileCheck %if system-windows %{ -check-prefix=DEFAULT_AOT %} %else %{ -check-prefix=AUTO_AOT %} %s -DDEVICE=pvc
30+
2331
// RUN: %clang -### -fsycl --no-offload-new-driver \
2432
// RUN: -fsycl-targets=spir64_gen -Xs "-device 0x0BD5" %s 2>&1 \
2533
// RUN: | FileCheck %if system-windows %{ -check-prefix=DEFAULT_AOT %} %else %{ -check-prefix=AUTO_AOT %} %s -DDEVICE=pvc

clang/test/Driver/sycl-ftarget-register-alloc-mode.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
// RUN: -fsycl-targets=spir64_gen -Xs "-device pvc" %s 2>&1 \
2121
// RUN: | FileCheck %if system-windows %{ -check-prefix=DEFAULT_AOT %} %else %{ -check-prefix=AUTO_AOT %} %s -DDEVICE=pvc
2222

23+
// RUN: %clang -### -fsycl --offload-new-driver \
24+
// RUN: -fsycl-targets=spir64_gen -Xsycl-target-backend "-device pvc" %s 2>&1 \
25+
// RUN: | FileCheck %if system-windows %{ -check-prefix=DEFAULT_AOT %} %else %{ -check-prefix=AUTO_AOT %} %s -DDEVICE=pvc
26+
27+
// RUN: %clang -### -fsycl --offload-new-driver \
28+
// RUN: -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" %s 2>&1 \
29+
// RUN: | FileCheck %if system-windows %{ -check-prefix=DEFAULT_AOT %} %else %{ -check-prefix=AUTO_AOT %} %s -DDEVICE=pvc
30+
2331
// RUN: %clang -### -fsycl --offload-new-driver \
2432
// RUN: -fsycl-targets=spir64_gen -Xs "-device 0x0BD5" %s 2>&1 \
2533
// RUN: | FileCheck %if system-windows %{ -check-prefix=DEFAULT_AOT %} %else %{ -check-prefix=AUTO_AOT %} %s -DDEVICE=pvc

clang/test/Driver/sycl-offload-new-driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
// RUN: %clangxx -fsycl -### -fsycl-targets=spir64_gen --offload-new-driver \
188188
// RUN: -Xsycl-target-backend=spir64_gen "-device pvc,bdw" %s 2>&1 \
189189
// RUN: | FileCheck -check-prefix COMMA_FILE %s
190-
// COMMA_FILE: clang-offload-packager{{.*}} "--image=file={{.*}}pvc@bdw{{.*}},triple=spir64_gen-unknown-unknown,arch=pvc,bdw,kind=sycl"
190+
// COMMA_FILE: clang-offload-packager{{.*}} "--image=file={{.*}}pvc@bdw{{.*}},triple=spir64_gen-unknown-unknown,arch=pvc,bdw,kind=sycl,compile-opts=-device_options pvc -ze-intel-enable-auto-large-GRF-mode"
191191

192192
/// Verify that --cuda-path is passed to clang-linker-wrapper for SYCL offload
193193
// RUN: %clangxx -fsycl -### -fsycl-targets=nvptx64-nvidia-cuda \

libdevice/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ set(CMAKE_MODULE_PATH
88
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
99
)
1010

11+
if(EXISTS ${FETCHCONTENT_BASE_DIR}/unified-runtime-src)
12+
set(UR_SANITIZER_INCLUDE_DIR
13+
${FETCHCONTENT_BASE_DIR}/unified-runtime-src/source/loader/layers/sanitizer)
14+
elseif(EXISTS ${SYCL_UR_SOURCE_DIR})
15+
set(UR_SANITIZER_INCLUDE_DIR
16+
${SYCL_UR_SOURCE_DIR}/source/loader/layers/sanitizer)
17+
else()
18+
message(WARNING "Unified Runtime source directory is not provided, \
19+
will not build libdevice sanitizer")
20+
endif()
21+
1122
# Build libdevice for SYCL.
1223
include(SYCLLibdevice)
1324

libdevice/cmake/modules/SYCLLibdevice.cmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ set(cmath_obj_deps device_math.h device.h sycl-compiler)
200200
set(imf_obj_deps device_imf.hpp imf_half.hpp imf_bf16.hpp imf_rounding_op.hpp imf_impl_utils.hpp device.h sycl-compiler)
201201
set(itt_obj_deps device_itt.h spirv_vars.h device.h sycl-compiler)
202202
set(bfloat16_obj_deps sycl-headers sycl-compiler)
203-
if (NOT MSVC)
203+
if (NOT MSVC AND UR_SANITIZER_INCLUDE_DIR)
204204
set(sanitizer_obj_deps
205205
device.h atomic.hpp spirv_vars.h
206-
include/asan_libdevice.hpp
206+
${UR_SANITIZER_INCLUDE_DIR}/asan_libdevice.hpp
207207
include/sanitizer_utils.hpp
208208
include/spir_global_var.hpp
209209
sycl-compiler)
@@ -268,10 +268,12 @@ if(MSVC)
268268
SRC msvc_math.cpp
269269
DEPENDENCIES ${cmath_obj_deps})
270270
else()
271-
add_devicelibs(libsycl-sanitizer
272-
SRC sanitizer_utils.cpp
273-
DEPENDENCIES ${sanitizer_obj_deps}
274-
EXTRA_OPTS -fno-sycl-instrument-device-code)
271+
if(UR_SANITIZER_INCLUDE_DIR)
272+
add_devicelibs(libsycl-sanitizer
273+
SRC sanitizer_utils.cpp
274+
DEPENDENCIES ${sanitizer_obj_deps}
275+
EXTRA_OPTS -fno-sycl-instrument-device-code -I${UR_SANITIZER_INCLUDE_DIR})
276+
endif()
275277
endif()
276278

277279
add_devicelibs(libsycl-fallback-cassert

libdevice/include/asan_libdevice.hpp

Lines changed: 0 additions & 157 deletions
This file was deleted.

libdevice/sanitizer_utils.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "asan_libdevice.hpp"
910
#include "atomic.hpp"
1011
#include "device.h"
1112
#include "spirv_vars.h"
1213

13-
#include "include/asan_libdevice.hpp"
1414
#include "include/sanitizer_utils.hpp"
1515

1616
using uptr = uintptr_t;
@@ -381,8 +381,11 @@ void __asan_internal_report_save(DeviceSanitizerErrorType error_type) {
381381
auto &SanitizerReport = ((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)
382382
->SanitizerReport[WG_LID % ASAN_MAX_NUM_REPORTS];
383383

384-
if (atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
385-
Expected) {
384+
if (atomicCompareAndSet(
385+
&(((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)->ReportFlag), 1,
386+
0) == 0 &&
387+
atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
388+
Expected) {
386389
SanitizerReport.ErrorType = error_type;
387390
SanitizerReport.IsRecover = false;
388391

@@ -415,8 +418,12 @@ void __asan_internal_report_save(
415418
auto &SanitizerReport = ((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)
416419
->SanitizerReport[WG_LID % ASAN_MAX_NUM_REPORTS];
417420

418-
if (atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
419-
Expected) {
421+
if ((is_recover ||
422+
atomicCompareAndSet(
423+
&(((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)->ReportFlag), 1,
424+
0) == 0) &&
425+
atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
426+
Expected) {
420427

421428
int FileLength = 0;
422429
int FuncLength = 0;

llvm-spirv/lib/SPIRV/SPIRVReader.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4664,22 +4664,9 @@ bool SPIRVToLLVM::transVectorComputeMetadata(SPIRVFunction *BF) {
46644664
std::to_string(Kind));
46654665
F->addParamAttr(ArgNo, Attr);
46664666
}
4667-
if (BA->hasDecorate(internal::DecorationFuncParamKindINTEL, 0, &Kind)) {
4668-
Attribute Attr = Attribute::get(*Context, kVCMetadata::VCArgumentKind,
4669-
std::to_string(Kind));
4670-
F->addParamAttr(ArgNo, Attr);
4671-
}
46724667
SEVAttr = translateSEVMetadata(BA, F->getContext());
46734668
if (SEVAttr)
46744669
F->addParamAttr(ArgNo, SEVAttr.value());
4675-
if (BA->hasDecorate(internal::DecorationFuncParamDescINTEL)) {
4676-
auto Desc =
4677-
BA->getDecorationStringLiteral(internal::DecorationFuncParamDescINTEL)
4678-
.front();
4679-
Attribute Attr =
4680-
Attribute::get(*Context, kVCMetadata::VCArgumentDesc, Desc);
4681-
F->addParamAttr(ArgNo, Attr);
4682-
}
46834670
if (BA->hasDecorate(DecorationMediaBlockIOINTEL)) {
46844671
assert(BA->getType()->isTypeImage() &&
46854672
"MediaBlockIOINTEL decoration is valid only on image parameters");

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,19 +1070,6 @@ void LLVMToSPIRVBase::transVectorComputeMetadata(Function *F) {
10701070
if (Attrs.hasParamAttr(ArgNo, kVCMetadata::VCSingleElementVector))
10711071
translateSEVDecoration(
10721072
Attrs.getParamAttr(ArgNo, kVCMetadata::VCSingleElementVector), BA);
1073-
if (Attrs.hasParamAttr(ArgNo, kVCMetadata::VCArgumentKind)) {
1074-
SPIRVWord Kind;
1075-
Attrs.getParamAttr(ArgNo, kVCMetadata::VCArgumentKind)
1076-
.getValueAsString()
1077-
.getAsInteger(0, Kind);
1078-
BA->addDecorate(internal::DecorationFuncParamKindINTEL, Kind);
1079-
}
1080-
if (Attrs.hasParamAttr(ArgNo, kVCMetadata::VCArgumentDesc)) {
1081-
StringRef Desc =
1082-
Attrs.getParamAttr(ArgNo, kVCMetadata::VCArgumentDesc)
1083-
.getValueAsString();
1084-
BA->addDecorate(new SPIRVDecorateFuncParamDescAttr(BA, Desc.str()));
1085-
}
10861073
if (Attrs.hasParamAttr(ArgNo, kVCMetadata::VCMediaBlockIO)) {
10871074
assert(BA->getType()->isTypeImage() &&
10881075
"VCMediaBlockIO attribute valid only on image parameters");

0 commit comments

Comments
 (0)