Skip to content

Commit f6e2549

Browse files
committed
Merge branch 'sycl' into llvmspirv_pulldown
2 parents 69da5c5 + 814290d commit f6e2549

File tree

347 files changed

+4338
-3444
lines changed

Some content is hidden

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

347 files changed

+4338
-3444
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 3 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

.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/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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,23 @@ static std::vector<OptSpecifier> getUnsupportedOpts(void) {
16181618
return UnsupportedOpts;
16191619
}
16201620

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+
16211638
SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
16221639
const ToolChain &HostTC, const ArgList &Args)
16231640
: ToolChain(D, Triple, Args), HostTC(HostTC),
@@ -1629,6 +1646,9 @@ SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
16291646
// Diagnose unsupported options only once.
16301647
for (OptSpecifier Opt : getUnsupportedOpts()) {
16311648
if (const Arg *A = Args.getLastArg(Opt)) {
1649+
// Native CPU can support options unsupported by other targets.
1650+
if (SupportedByNativeCPU(*this, Opt))
1651+
continue;
16321652
// All sanitizer options are not currently supported, except
16331653
// AddressSanitizer
16341654
if (A->getOption().getID() == options::OPT_fsanitize_EQ &&
@@ -1669,6 +1689,9 @@ SYCLToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
16691689
bool Unsupported = false;
16701690
for (OptSpecifier UnsupportedOpt : getUnsupportedOpts()) {
16711691
if (Opt.matches(UnsupportedOpt)) {
1692+
// NativeCPU should allow most normal cpu options.
1693+
if (SupportedByNativeCPU(*this, Opt.getID()))
1694+
continue;
16721695
if (Opt.getID() == options::OPT_fsanitize_EQ &&
16731696
A->getValues().size() == 1) {
16741697
std::string SanitizeVal = A->getValue();

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3625,8 +3625,11 @@ class SyclKernelBodyCreator : public SyclKernelFieldHandler {
36253625
BodyStmts.insert(BodyStmts.end(), FinalizeStmts.begin(),
36263626
FinalizeStmts.end());
36273627

3628+
SourceLocation LL = NewBody ? NewBody->getBeginLoc() : SourceLocation();
3629+
SourceLocation LR = NewBody ? NewBody->getEndLoc() : SourceLocation();
3630+
36283631
return CompoundStmt::Create(SemaSYCLRef.getASTContext(), BodyStmts,
3629-
FPOptionsOverride(), {}, {});
3632+
FPOptionsOverride(), LL, LR);
36303633
}
36313634

36323635
void annotateHierarchicalParallelismAPICalls() {
@@ -6969,6 +6972,7 @@ bool SYCLIntegrationFooter::emit(raw_ostream &OS) {
69696972
Policy.adjustForCPlusPlusFwdDecl();
69706973
Policy.SuppressTypedefs = true;
69716974
Policy.SuppressUnwrittenScope = true;
6975+
Policy.PrintCanonicalTypes = true;
69726976

69736977
llvm::SmallSet<const VarDecl *, 8> Visited;
69746978
bool EmittedFirstSpecConstant = false;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -triple spir64-unknown-unknown -fsycl-int-footer=%t.footer.h -emit-llvm %s -o -
2+
// RUN: FileCheck -input-file=%t.footer.h %s --check-prefix=CHECK-FOOTER
3+
4+
// This test checks that integration footer is emitted correctly when a
5+
// device_global has an explicit template specialization in template arguments.
6+
7+
#include "sycl.hpp"
8+
9+
namespace sycl {
10+
template <typename T> struct X {};
11+
template <> struct X<int> {};
12+
namespace detail {
13+
struct Y {};
14+
} // namespace detail
15+
template <> struct X<detail::Y> {};
16+
} // namespace sycl
17+
18+
using namespace sycl;
19+
template <typename T, typename = X<detail::Y>> struct Arg1 { T val; };
20+
21+
using namespace sycl::ext::oneapi;
22+
template <typename properties_t>
23+
device_global<properties_t> dev_global;
24+
25+
SYCL_EXTERNAL auto foo() {
26+
(void)dev_global<Arg1<int>>;
27+
}
28+
29+
// CHECK-FOOTER: __sycl_device_global_registration::__sycl_device_global_registration() noexcept {
30+
// CHECK-FOOTER-NEXT: device_global_map::add((void *)&::dev_global<Arg1<int, sycl::X<sycl::detail::Y>>>, "_Z10dev_globalI4Arg1IiN4sycl1XINS1_6detail1YEEEEE");
31+
// CHECK-FOOTER-NEXT: }
32+
// CHECK-FOOTER-NEXT: } // namespace (unnamed)

0 commit comments

Comments
 (0)