Skip to content

Commit 88bb38b

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into duncan/builtin-fix
2 parents 9799770 + 9b9e5de commit 88bb38b

File tree

544 files changed

+5113
-6466
lines changed

Some content is hidden

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

544 files changed

+5113
-6466
lines changed

.github/CODEOWNERS

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ sycl/include/sycl/detail/ur.hpp @intel/unified-runtime-reviewers
4141
sycl/source/detail/posix_ur.cpp @intel/unified-runtime-reviewers
4242
sycl/source/detail/ur.cpp @intel/unified-runtime-reviewers
4343
sycl/source/detail/windows_ur.cpp @intel/unified-runtime-reviewers
44-
sycl/test-e2e/Plugin/ @intel/unified-runtime-reviewers
44+
sycl/test-e2e/Adapters/ @intel/unified-runtime-reviewers
4545

4646
# Win Proxy Loader
47-
sycl/pi_win_proxy_loader @intel/llvm-reviewers-runtime
48-
sycl/test-e2e/Plugin/dll-detach-order.cpp @intel/llvm-reviewers-runtime
47+
sycl/ur_win_proxy_loader @intel/llvm-reviewers-runtime
48+
sycl/test-e2e/Adapters/dll-detach-order.cpp @intel/llvm-reviewers-runtime
4949

5050
# CUDA specific runtime implementations
5151
sycl/include/sycl/ext/oneapi/experimental/cuda/ @intel/llvm-reviewers-cuda
@@ -169,12 +169,12 @@ sycl/test-e2e/LLVMIntrinsicLowering/ @intel/dpcpp-spirv-reviewers
169169

170170
# Sanitizer
171171
clang/lib/Driver/SanitizerArgs.cpp @intel/dpcpp-sanitizers-review
172-
libdevice/sanitizer_utils.cpp @intel/dpcpp-sanitizers-review
173-
libdevice/include/asan_libdevice.hpp @intel/dpcpp-sanitizers-review
174-
libdevice/include/sanitizer_utils.hpp @intel/dpcpp-sanitizers-review
172+
libdevice/include/asan_rtl.hpp @intel/dpcpp-sanitizers-review
173+
libdevice/include/sanitizer_defs.hpp @intel/dpcpp-sanitizers-review
174+
libdevice/sanitizer/ @intel/dpcpp-sanitizers-review
175+
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h @intel/dpcpp-sanitizers-review
176+
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h @intel/dpcpp-sanitizers-review
177+
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h @intel/dpcpp-sanitizers-review
175178
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @intel/dpcpp-sanitizers-review
176-
sycl/test-e2e/AddressSanitizer/ @intel/dpcpp-sanitizers-review
177179
llvm/test/Instrumentation/AddressSanitizer/ @intel/dpcpp-sanitizers-review
178-
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h @intel/dpcpp-sanitizers-review
179-
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h @intel/dpcpp-sanitizers-review
180-
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h @intel/dpcpp-sanitizers-review
180+
sycl/test-e2e/AddressSanitizer/ @intel/dpcpp-sanitizers-review

.github/workflows/sycl-linux-precommit.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ jobs:
8080
image: ghcr.io/intel/llvm/ubuntu2204_build:latest
8181
image_options: -u 1001 --gpus all --cap-add SYS_ADMIN
8282
target_devices: ext_oneapi_cuda:gpu
83+
- name: AMD/HIP
84+
runner: '["Linux", "amdgpu"]'
85+
image: ghcr.io/intel/llvm/ubuntu2204_build:latest
86+
image_options: -u 1001 --device=/dev/dri --device=/dev/kfd
87+
target_devices: ext_oneapi_hip:gpu
88+
reset_intel_gpu: false
8389
- name: Intel
8490
runner: '["Linux", "gen12"]'
8591
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ To contribute:
5858
- [The seven rules of a great Git commit message](https://cbea.ms/git-commit)
5959
are recommended read and follow.
6060
- To a reasonable extent, title tags can be used to signify the component
61-
changed, e.g.: `[PI]`, `[CUDA]`, `[Doc]`.
61+
changed, e.g.: `[UR]`, `[CUDA]`, `[Doc]`.
6262
- Create a pull request (PR) for your changes following
6363
[Creating a pull request instructions](https://help.github.com/articles/creating-a-pull-request/).
6464
- Make sure PR has a good description explaining all of the changes made,

buildbot/configure.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def do_configure(args):
6969
if sys.platform != "darwin":
7070
sycl_enabled_backends.append("level_zero")
7171

72-
# lld is needed on Windows or for the HIP plugin on AMD
72+
# lld is needed on Windows or for the HIP adapter on AMD
7373
if platform.system() == "Windows" or (args.hip and args.hip_platform == "AMD"):
7474
llvm_enable_projects += ";lld"
7575

@@ -152,8 +152,8 @@ def do_configure(args):
152152
libclc_targets_to_build += libclc_nvidia_target_names
153153
libclc_gen_remangled_variants = "ON"
154154

155-
if args.enable_plugin:
156-
sycl_enabled_backends += args.enable_plugin
155+
if args.enable_backends:
156+
sycl_enabled_backends += args.enable_backends
157157

158158
if args.disable_preview_lib:
159159
sycl_preview_lib = "OFF"
@@ -374,7 +374,9 @@ def main():
374374
parser.add_argument(
375375
"--ci-defaults", action="store_true", help="Enable default CI parameters"
376376
)
377-
parser.add_argument("--enable-plugin", action="append", help="Enable SYCL plugin")
377+
parser.add_argument(
378+
"--enable-backends", action="append", help="Enable SYCL backend"
379+
)
378380
parser.add_argument(
379381
"--disable-preview-lib",
380382
action="store_true",

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,6 +1789,9 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
17891789
if (SyclOptReport.HasOptReportInfo(FD)) {
17901790
llvm::OptimizationRemarkEmitter ORE(Fn);
17911791
for (auto ORI : llvm::enumerate(SyclOptReport.GetInfo(FD))) {
1792+
// Temporarily apply arg location to ensure SourceLocToDebugLoc
1793+
// picks up the expected file.
1794+
ApplyDebugLocation TempApplyLoc(*this, ORI.value().KernelArgLoc);
17921795
llvm::DiagnosticLocation DL =
17931796
SourceLocToDebugLoc(ORI.value().KernelArgLoc);
17941797
StringRef NameInDesc = ORI.value().KernelArgDescName;

clang/lib/CodeGen/CodeGenTypes.cpp

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -350,34 +350,6 @@ llvm::Type *CodeGenTypes::ConvertFunctionTypeInternal(QualType QFT) {
350350
return ResultType;
351351
}
352352

353-
template <bool NeedTypeInterpret = false>
354-
llvm::Type *getJointMatrixINTELExtType(llvm::Type *CompTy,
355-
ArrayRef<TemplateArgument> TemplateArgs,
356-
const unsigned Val = 0) {
357-
// TODO: we should actually have exactly 5 template parameters: 1 for
358-
// type and 4 for type parameters. But in previous version of the SPIR-V
359-
// spec we have Layout matrix type parameter, that was later removed.
360-
// Once we update to the newest version of the spec - this should be updated.
361-
assert((TemplateArgs.size() == 5 || TemplateArgs.size() == 6) &&
362-
"Wrong JointMatrixINTEL template parameters number");
363-
// This is required to represent optional 'Component Type Interpretation'
364-
// parameter
365-
std::vector<unsigned> Params;
366-
for (size_t I = 1; I != TemplateArgs.size(); ++I) {
367-
assert(TemplateArgs[I].getKind() == TemplateArgument::Integral &&
368-
"Wrong JointMatrixINTEL template parameter");
369-
Params.push_back(TemplateArgs[I].getAsIntegral().getExtValue());
370-
}
371-
// Don't add type interpretation for legacy matrices.
372-
// Legacy matrices has 5 template parameters, while new representation
373-
// has 6.
374-
if (NeedTypeInterpret && TemplateArgs.size() != 5)
375-
Params.push_back(Val);
376-
377-
return llvm::TargetExtType::get(CompTy->getContext(),
378-
"spirv.JointMatrixINTEL", {CompTy}, Params);
379-
}
380-
381353
llvm::Type *
382354
getCooperativeMatrixKHRExtType(llvm::Type *CompTy,
383355
ArrayRef<TemplateArgument> TemplateArgs) {
@@ -394,49 +366,6 @@ getCooperativeMatrixKHRExtType(llvm::Type *CompTy,
394366
CompTy->getContext(), "spirv.CooperativeMatrixKHR", {CompTy}, Params);
395367
}
396368

397-
/// ConvertSYCLJointMatrixINTELType - Convert SYCL joint_matrix type
398-
/// which is represented as a pointer to a structure to LLVM extension type
399-
/// with the parameters that follow SPIR-V JointMatrixINTEL type.
400-
/// The expected representation is:
401-
/// target("spirv.JointMatrixINTEL", %element_type, %rows%, %cols%, %scope%,
402-
/// %use%, (optional) %element_type_interpretation%)
403-
llvm::Type *CodeGenTypes::ConvertSYCLJointMatrixINTELType(RecordDecl *RD) {
404-
auto *TemplateDecl = cast<ClassTemplateSpecializationDecl>(RD);
405-
ArrayRef<TemplateArgument> TemplateArgs =
406-
TemplateDecl->getTemplateArgs().asArray();
407-
assert(TemplateArgs[0].getKind() == TemplateArgument::Type &&
408-
"1st JointMatrixINTEL template parameter must be type");
409-
llvm::Type *CompTy = ConvertType(TemplateArgs[0].getAsType());
410-
411-
// Per JointMatrixINTEL spec the type can have an optional
412-
// 'Component Type Interpretation' parameter. We should emit it in case
413-
// if on SYCL level joint matrix accepts 'bfloat16' or 'tf32' objects as
414-
// matrix's components. Yet 'bfloat16' should be represented as 'int16' and
415-
// 'tf32' as 'float' types.
416-
if (CompTy->isStructTy()) {
417-
StringRef LlvmTyName = CompTy->getStructName();
418-
// Emit half/int16/float for sycl[::*]::{half,bfloat16,tf32}
419-
if (LlvmTyName.starts_with("class.sycl::") ||
420-
LlvmTyName.starts_with("class.__sycl_internal::"))
421-
LlvmTyName = LlvmTyName.rsplit("::").second;
422-
if (LlvmTyName == "half") {
423-
CompTy = llvm::Type::getHalfTy(getLLVMContext());
424-
return getJointMatrixINTELExtType(CompTy, TemplateArgs);
425-
} else if (LlvmTyName == "tf32") {
426-
CompTy = llvm::Type::getFloatTy(getLLVMContext());
427-
// 'tf32' interpretation is mapped to '0'
428-
return getJointMatrixINTELExtType<true>(CompTy, TemplateArgs, 0);
429-
} else if (LlvmTyName == "bfloat16") {
430-
CompTy = llvm::Type::getInt16Ty(getLLVMContext());
431-
// 'bfloat16' interpretation is mapped to '1'
432-
return getJointMatrixINTELExtType<true>(CompTy, TemplateArgs, 1);
433-
} else {
434-
llvm_unreachable("Wrong matrix base type!");
435-
}
436-
}
437-
return getJointMatrixINTELExtType(CompTy, TemplateArgs);
438-
}
439-
440369
/// ConvertSPVCooperativeMatrixType - Convert SYCL joint_matrix type
441370
/// which is represented as a pointer to a structure to LLVM extension type
442371
/// with the parameters that follow SPIR-V CooperativeMatrixKHR type.
@@ -733,11 +662,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
733662
if (ClangETy && ClangETy->isStructureOrClassType()) {
734663
RecordDecl *RD = ClangETy->getAsCXXRecordDecl();
735664
if (RD && RD->getQualifiedNameAsString() ==
736-
"__spv::__spirv_JointMatrixINTEL") {
737-
ResultType = ConvertSYCLJointMatrixINTELType(RD);
738-
break;
739-
} else if (RD && RD->getQualifiedNameAsString() ==
740-
"__spv::__spirv_CooperativeMatrixKHR") {
665+
"__spv::__spirv_CooperativeMatrixKHR") {
741666
ResultType = ConvertSPVCooperativeMatrixType(RD);
742667
break;
743668
} else if (RD && RD->getQualifiedNameAsString() ==

clang/lib/CodeGen/CodeGenTypes.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,6 @@ class CodeGenTypes {
145145
/// load/store type are the same.
146146
llvm::Type *convertTypeForLoadStore(QualType T, llvm::Type *LLVMTy = nullptr);
147147

148-
/// ConvertSYCLJointMatrixINTELType - Convert SYCL joint_matrix type
149-
/// which is represented as a pointer to a structure to LLVM extension type
150-
/// with the parameters that follow SPIR-V JointMatrixINTEL type.
151-
/// The expected representation is:
152-
/// target("spirv.JointMatrixINTEL", %element_type, %rows%, %cols%, %scope%,
153-
/// %use%, (optional) %element_type_interpretation%)
154-
llvm::Type *ConvertSYCLJointMatrixINTELType(RecordDecl *RD);
155-
156148
/// ConvertSPVCooperativeMatrixType - Convert SYCL joint_matrix type
157149
/// which is represented as a pointer to a structure to LLVM extension type
158150
/// with the parameters that follow SPIR-V CooperativeMatrixKHR type.

clang/lib/Driver/OffloadBundler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,12 +687,12 @@ class ObjectFileHandler final : public FileHandler {
687687
if (Error Err = Symbol.printName(NameOS))
688688
return std::move(Err);
689689

690-
// If we are dealing with a bitcode file do not add special globals
691-
// llvm.used and llvm.compiler.used and __AsanDeviceGlobalMetadata to
690+
// If we are dealing with a bitcode file do not add special globals to
692691
// the list of defined symbols.
693692
if (SF->isIR() &&
694693
(Name == "llvm.used" || Name == "llvm.compiler.used" ||
695-
Name == "__AsanDeviceGlobalMetadata"))
694+
Name == "__AsanDeviceGlobalMetadata" ||
695+
Name == "__AsanKernelMetadata"))
696696
continue;
697697

698698
// Add symbol name with the target prefix to the buffer.

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,9 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
11971197

11981198
CmdArgs.push_back("-mllvm");
11991199
CmdArgs.push_back("-asan-mapping-scale=4");
1200+
1201+
addSpecialCaseListOpt(Args, CmdArgs,
1202+
"-fsanitize-ignorelist=", UserIgnorelistFiles);
12001203
}
12011204
return;
12021205
}

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -658,43 +658,44 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
658658
addLibraries(SYCLDeviceAnnotationLibs);
659659

660660
#if !defined(_WIN32)
661+
std::string SanitizeVal;
661662
size_t sanitizer_lib_idx = getSingleBuildTarget();
662663
if (Arg *A = Args.getLastArg(options::OPT_fsanitize_EQ,
663664
options::OPT_fno_sanitize_EQ)) {
664665
if (A->getOption().matches(options::OPT_fsanitize_EQ) &&
665-
A->getValues().size() == 1) {
666-
std::string SanitizeVal = A->getValue();
667-
if (SanitizeVal == "address")
668-
addSingleLibrary(SYCLDeviceAsanLibs[sanitizer_lib_idx]);
669-
}
666+
A->getValues().size() == 1)
667+
SanitizeVal = A->getValue();
670668
} else {
671669
// User can pass -fsanitize=address to device compiler via
672670
// -Xsycl-target-frontend, sanitize device library must be
673671
// linked with user's device image if so.
674-
bool IsDeviceAsanEnabled = false;
675-
auto SyclFEArg = Args.getAllArgValues(options::OPT_Xsycl_frontend);
676-
IsDeviceAsanEnabled = (std::count(SyclFEArg.begin(), SyclFEArg.end(),
677-
"-fsanitize=address") > 0);
678-
if (!IsDeviceAsanEnabled) {
679-
auto SyclFEArgEq = Args.getAllArgValues(options::OPT_Xsycl_frontend_EQ);
680-
IsDeviceAsanEnabled = (std::count(SyclFEArgEq.begin(), SyclFEArgEq.end(),
681-
"-fsanitize=address") > 0);
682-
}
683-
684-
// User can also enable asan for SYCL device via -Xarch_device option.
685-
if (!IsDeviceAsanEnabled) {
686-
auto DeviceArchVals = Args.getAllArgValues(options::OPT_Xarch_device);
687-
for (auto DArchVal : DeviceArchVals) {
688-
if (DArchVal.find("-fsanitize=address") != std::string::npos) {
689-
IsDeviceAsanEnabled = true;
690-
break;
691-
}
672+
std::vector<std::string> EnabledDeviceSanitizers;
673+
674+
// NOTE: "-fsanitize=" applies to all device targets
675+
auto SyclFEArgVals = Args.getAllArgValues(options::OPT_Xsycl_frontend);
676+
auto SyclFEEQArgVals = Args.getAllArgValues(options::OPT_Xsycl_frontend_EQ);
677+
auto ArchDeviceVals = Args.getAllArgValues(options::OPT_Xarch_device);
678+
679+
std::vector<std::string> ArgVals(
680+
SyclFEArgVals.size() + SyclFEEQArgVals.size() + ArchDeviceVals.size());
681+
ArgVals.insert(ArgVals.end(), SyclFEArgVals.begin(), SyclFEArgVals.end());
682+
ArgVals.insert(ArgVals.end(), SyclFEEQArgVals.begin(),
683+
SyclFEEQArgVals.end());
684+
ArgVals.insert(ArgVals.end(), ArchDeviceVals.begin(), ArchDeviceVals.end());
685+
686+
// Driver will report error if address sanitizer and memory sanitizer are
687+
// both enabled, so we only need to check first one here.
688+
for (const std::string &Arg : ArgVals) {
689+
if (Arg.find("-fsanitize=address") != std::string::npos) {
690+
SanitizeVal = "address";
691+
break;
692692
}
693693
}
694-
695-
if (IsDeviceAsanEnabled)
696-
addSingleLibrary(SYCLDeviceAsanLibs[sanitizer_lib_idx]);
697694
}
695+
696+
if (SanitizeVal == "address")
697+
addSingleLibrary(SYCLDeviceAsanLibs[sanitizer_lib_idx]);
698+
698699
#endif
699700

700701
if (isNativeCPU)
@@ -1617,6 +1618,23 @@ static std::vector<OptSpecifier> getUnsupportedOpts(void) {
16171618
return UnsupportedOpts;
16181619
}
16191620

1621+
// Currently supported options by SYCL NativeCPU device compilation
1622+
static inline bool SupportedByNativeCPU(const SYCLToolChain &TC,
1623+
const OptSpecifier &Opt) {
1624+
if (!TC.IsSYCLNativeCPU)
1625+
return false;
1626+
1627+
switch (Opt.getID()) {
1628+
case options::OPT_fcoverage_mapping:
1629+
case options::OPT_fno_coverage_mapping:
1630+
case options::OPT_fprofile_instr_generate:
1631+
case options::OPT_fprofile_instr_generate_EQ:
1632+
case options::OPT_fno_profile_instr_generate:
1633+
return true;
1634+
}
1635+
return false;
1636+
}
1637+
16201638
SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
16211639
const ToolChain &HostTC, const ArgList &Args)
16221640
: ToolChain(D, Triple, Args), HostTC(HostTC),
@@ -1628,6 +1646,9 @@ SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
16281646
// Diagnose unsupported options only once.
16291647
for (OptSpecifier Opt : getUnsupportedOpts()) {
16301648
if (const Arg *A = Args.getLastArg(Opt)) {
1649+
// Native CPU can support options unsupported by other targets.
1650+
if (SupportedByNativeCPU(*this, Opt))
1651+
continue;
16311652
// All sanitizer options are not currently supported, except
16321653
// AddressSanitizer
16331654
if (A->getOption().getID() == options::OPT_fsanitize_EQ &&
@@ -1668,6 +1689,9 @@ SYCLToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
16681689
bool Unsupported = false;
16691690
for (OptSpecifier UnsupportedOpt : getUnsupportedOpts()) {
16701691
if (Opt.matches(UnsupportedOpt)) {
1692+
// NativeCPU should allow most normal cpu options.
1693+
if (SupportedByNativeCPU(*this, Opt.getID()))
1694+
continue;
16711695
if (Opt.getID() == options::OPT_fsanitize_EQ &&
16721696
A->getValues().size() == 1) {
16731697
std::string SanitizeVal = A->getValue();

0 commit comments

Comments
 (0)