Skip to content

Commit 3216f51

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents a34309b + abed4e3 commit 3216f51

File tree

252 files changed

+1152
-924
lines changed

Some content is hidden

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

252 files changed

+1152
-924
lines changed

clang/include/clang/AST/Type.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,12 @@ class Qualifiers {
488488
/// Returns true if the address space in these qualifiers is equal to or
489489
/// a superset of the address space in the argument qualifiers.
490490
bool isAddressSpaceSupersetOf(Qualifiers other) const {
491-
492-
return
493-
isAddressSpaceSupersetOf(getAddressSpace(), other.getAddressSpace()) ||
494-
(!hasAddressSpace() &&
495-
(other.getAddressSpace() == LangAS::sycl_private ||
496-
other.getAddressSpace() == LangAS::sycl_local ||
497-
other.getAddressSpace() == LangAS::sycl_global ||
498-
other.getAddressSpace() == LangAS::sycl_constant ||
499-
other.getAddressSpace() == LangAS::sycl_generic));
491+
return isAddressSpaceSupersetOf(getAddressSpace(),
492+
other.getAddressSpace()) ||
493+
(!hasAddressSpace() &&
494+
(other.getAddressSpace() == LangAS::opencl_private ||
495+
other.getAddressSpace() == LangAS::opencl_local ||
496+
other.getAddressSpace() == LangAS::opencl_global));
500497
}
501498

502499
/// Determines if these qualifiers compatibly include another set.

clang/include/clang/Basic/AddressSpaces.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ enum class LangAS : unsigned {
4242
cuda_constant,
4343
cuda_shared,
4444

45-
sycl_global,
46-
sycl_local,
47-
sycl_constant,
48-
sycl_private,
49-
// Likely never used, but useful in the future to reserve the spot in the
50-
// enum.
51-
sycl_generic,
52-
5345
// Pointer size and extension address spaces.
5446
ptr32_sptr,
5547
ptr32_uptr,

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10735,8 +10735,6 @@ def err_builtin_launder_invalid_arg : Error<
1073510735
"'__builtin_launder' is not allowed">;
1073610736

1073710737
// SYCL-specific diagnostics
10738-
def err_sycl_attribute_address_space_invalid : Error<
10739-
"address space is outside the valid range of values">;
1074010738
def err_sycl_kernel_incorrectly_named : Error<
1074110739
"kernel %select{name is missing"
1074210740
"|needs to have a globally-visible name}0">;

clang/include/clang/Sema/ParsedAttr.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -617,24 +617,6 @@ class ParsedAttr final
617617
}
618618
}
619619

620-
/// If this is an OpenCL addr space attribute returns its SYCL representation
621-
/// in LangAS, otherwise returns default addr space.
622-
LangAS asSYCLLangAS() const {
623-
switch (getKind()) {
624-
case ParsedAttr::AT_OpenCLConstantAddressSpace:
625-
return LangAS::sycl_constant;
626-
case ParsedAttr::AT_OpenCLGlobalAddressSpace:
627-
return LangAS::sycl_global;
628-
case ParsedAttr::AT_OpenCLLocalAddressSpace:
629-
return LangAS::sycl_local;
630-
case ParsedAttr::AT_OpenCLPrivateAddressSpace:
631-
return LangAS::sycl_private;
632-
case ParsedAttr::AT_OpenCLGenericAddressSpace:
633-
default:
634-
return LangAS::Default;
635-
}
636-
}
637-
638620
AttributeCommonInfo::Kind getKind() const {
639621
return AttributeCommonInfo::Kind(Info.AttrKind);
640622
}

clang/lib/AST/ASTContext.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -928,11 +928,6 @@ static const LangASMap *getAddressSpaceMap(const TargetInfo &T,
928928
5, // cuda_device
929929
6, // cuda_constant
930930
7, // cuda_shared
931-
1, // sycl_global
932-
3, // sycl_local
933-
2, // sycl_constant
934-
0, // sycl_private
935-
4, // sycl_generic
936931
8, // ptr32_sptr
937932
9, // ptr32_uptr
938933
10 // ptr64

clang/lib/AST/TypePrinter.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,19 +1837,14 @@ std::string Qualifiers::getAddrSpaceAsString(LangAS AS) {
18371837
case LangAS::Default:
18381838
return "";
18391839
case LangAS::opencl_global:
1840-
case LangAS::sycl_global:
18411840
return "__global";
18421841
case LangAS::opencl_local:
1843-
case LangAS::sycl_local:
18441842
return "__local";
18451843
case LangAS::opencl_private:
1846-
case LangAS::sycl_private:
18471844
return "__private";
18481845
case LangAS::opencl_constant:
1849-
case LangAS::sycl_constant:
18501846
return "__constant";
18511847
case LangAS::opencl_generic:
1852-
case LangAS::sycl_generic:
18531848
return "__generic";
18541849
case LangAS::cuda_device:
18551850
return "__device__";

clang/lib/Basic/Targets/AMDGPU.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ const LangASMap AMDGPUTargetInfo::AMDGPUDefIsGenMap = {
4848
Global, // cuda_device
4949
Constant, // cuda_constant
5050
Local, // cuda_shared
51-
Global, // sycl_global
52-
Local, // sycl_local
53-
Constant, // sycl_constant
54-
Private, // sycl_private
55-
Generic, // sycl_generic
5651
Generic, // ptr32_sptr
5752
Generic, // ptr32_uptr
5853
Generic // ptr64
@@ -68,11 +63,6 @@ const LangASMap AMDGPUTargetInfo::AMDGPUDefIsPrivMap = {
6863
Global, // cuda_device
6964
Constant, // cuda_constant
7065
Local, // cuda_shared
71-
Global, // sycl_global
72-
Local, // sycl_local
73-
Constant, // sycl_constant
74-
Private, // sycl_private
75-
Generic, // sycl_generic
7666
Generic, // ptr32_sptr
7767
Generic, // ptr32_uptr
7868
Generic // ptr64

clang/lib/Basic/Targets/NVPTX.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ static const unsigned NVPTXAddrSpaceMap[] = {
3333
1, // cuda_device
3434
4, // cuda_constant
3535
3, // cuda_shared
36-
1, // sycl_global
37-
3, // sycl_local
38-
4, // sycl_constant
39-
0, // sycl_private
40-
// FIXME: generic has to be added to the target
41-
0, // sycl_generic
4236
0, // ptr32_sptr
4337
0, // ptr32_uptr
4438
0 // ptr64

clang/lib/Basic/Targets/SPIR.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ static const unsigned SPIRAddrSpaceMap[] = {
3333
0, // cuda_device
3434
0, // cuda_constant
3535
0, // cuda_shared
36-
1, // sycl_global
37-
3, // sycl_local
38-
2, // sycl_constant
39-
0, // sycl_private
40-
4, // sycl_generic
4136
0, // ptr32_sptr
4237
0, // ptr32_uptr
4338
0 // ptr64
@@ -53,11 +48,6 @@ static const unsigned SYCLAddrSpaceMap[] = {
5348
0, // cuda_device
5449
0, // cuda_constant
5550
0, // cuda_shared
56-
1, // sycl_global
57-
3, // sycl_local
58-
2, // sycl_constant
59-
0, // sycl_private
60-
4, // sycl_generic
6151
0, // ptr32_sptr
6252
0, // ptr32_uptr
6353
0 // ptr64
@@ -70,11 +60,9 @@ class LLVM_LIBRARY_VISIBILITY SPIRTargetInfo : public TargetInfo {
7060
TLSSupported = false;
7161
VLASupported = false;
7262
LongWidth = LongAlign = 64;
73-
if (Triple.getEnvironment() == llvm::Triple::SYCLDevice) {
74-
AddrSpaceMap = &SYCLAddrSpaceMap;
75-
} else {
76-
AddrSpaceMap = &SPIRAddrSpaceMap;
77-
}
63+
AddrSpaceMap = (Triple.getEnvironment() == llvm::Triple::SYCLDevice)
64+
? &SYCLAddrSpaceMap
65+
: &SPIRAddrSpaceMap;
7866
UseAddrSpaceMapMangling = true;
7967
HasLegalHalfType = true;
8068
HasFloat16 = true;

clang/lib/Basic/Targets/TCE.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ static const unsigned TCEOpenCLAddrSpaceMap[] = {
4040
0, // cuda_device
4141
0, // cuda_constant
4242
0, // cuda_shared
43-
3, // sycl_global
44-
4, // sycl_local
45-
5, // sycl_constant
46-
0, // sycl_private
47-
// FIXME: generic has to be added to the target
48-
0, // sycl_generic
4943
0, // ptr32_sptr
5044
0, // ptr32_uptr
5145
0, // ptr64

clang/lib/Basic/Targets/X86.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ static const unsigned X86AddrSpaceMap[] = {
3232
0, // cuda_device
3333
0, // cuda_constant
3434
0, // cuda_shared
35-
0, // sycl_global
36-
0, // sycl_local
37-
0, // sycl_constant
38-
0, // sycl_private
39-
0, // sycl_generic
4035
270, // ptr32_sptr
4136
271, // ptr32_uptr
4237
272 // ptr64

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3988,7 +3988,7 @@ class OffloadingActionBuilder final {
39883988
A->claim();
39893989
auto ParsedArg = Opts.ParseOneArg(Args, Index);
39903990
// TODO: Support --no-cuda-gpu-arch, --{,no-}cuda-gpu-arch=all.
3991-
if (ParsedArg->getOption().matches(options::OPT_cuda_gpu_arch_EQ)) {
3991+
if (ParsedArg->getOption().matches(options::OPT_offload_arch_EQ)) {
39923992
ParsedArg->claim();
39933993
GpuArchList.push_back(StringToCudaArch(ParsedArg->getValue(0)));
39943994
}

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "clang/Driver/Driver.h"
1414
#include "clang/Driver/DriverDiagnostic.h"
1515
#include "clang/Driver/Options.h"
16+
#include "llvm/Support/CommandLine.h"
1617
#include "llvm/Support/FileSystem.h"
1718
#include "llvm/Support/Path.h"
1819

@@ -421,6 +422,17 @@ SYCLToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
421422
return DAL;
422423
}
423424

425+
static void parseTargetOpts(StringRef ArgString, const llvm::opt::ArgList &Args,
426+
llvm::opt::ArgStringList &CmdArgs) {
427+
// Tokenize the string.
428+
SmallVector<const char *, 8> TargetArgs;
429+
llvm::BumpPtrAllocator A;
430+
llvm::StringSaver S(A);
431+
llvm::cl::TokenizeGNUCommandLine(ArgString, S, TargetArgs);
432+
for (StringRef TA : TargetArgs)
433+
CmdArgs.push_back(Args.MakeArgString(TA));
434+
}
435+
424436
// Expects a specific type of option (e.g. -Xsycl-target-backend) and will
425437
// extract the arguments.
426438
void SYCLToolChain::TranslateTargetOpt(const llvm::opt::ArgList &Args,
@@ -455,13 +467,7 @@ void SYCLToolChain::TranslateTargetOpt(const llvm::opt::ArgList &Args,
455467
// Triple found, add the next argument in line.
456468
ArgString = A->getValue(1);
457469

458-
// Do a simple parse of the args to pass back
459-
SmallVector<StringRef, 16> TargetArgs;
460-
// TODO: Improve parsing, as this only handles arguments separated by
461-
// spaces.
462-
ArgString.split(TargetArgs, ' ', -1, false);
463-
for (const auto &TA : TargetArgs)
464-
CmdArgs.push_back(Args.MakeArgString(TA));
470+
parseTargetOpts(ArgString, Args, CmdArgs);
465471
A->claim();
466472
}
467473
}
@@ -485,13 +491,7 @@ void SYCLToolChain::TranslateBackendTargetArgs(const llvm::opt::ArgList &Args,
485491
}
486492
if (A->getOption().matches(options::OPT_Xs_separate)) {
487493
StringRef ArgString(A->getValue());
488-
// Do a simple parse of the args to pass back
489-
SmallVector<StringRef, 16> TargetArgs;
490-
// TODO: Improve parsing, as this only handles arguments separated by
491-
// spaces.
492-
ArgString.split(TargetArgs, ' ', -1, false);
493-
for (const auto &TA : TargetArgs)
494-
CmdArgs.push_back(Args.MakeArgString(TA));
494+
parseTargetOpts(ArgString, Args, CmdArgs);
495495
A->claim();
496496
continue;
497497
}

clang/lib/Lex/PPDirectives.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,9 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport(
20962096
// Issue a diagnostic if the name of the file on disk has a different case
20972097
// than the one we're about to open.
20982098
const bool CheckIncludePathPortability =
2099-
!IsMapped && !File->getFileEntry().tryGetRealPathName().empty();
2099+
// !IsMapped && !File->getFileEntry().tryGetRealPathName().empty();
2100+
// Disable file portability check to unblock pulldown
2101+
false;
21002102

21012103
if (CheckIncludePathPortability) {
21022104
StringRef Name = LookupFilename;

clang/lib/Sema/SPIRVBuiltins.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class AddressSpace<string _AS> {
3535
// the one it will be lowered to.
3636
// This file assumes it will get lowered to generic or private.
3737
def DefaultAS : AddressSpace<"clang::LangAS::Default">;
38-
def PrivateAS : AddressSpace<"clang::LangAS::sycl_private">;
39-
def GlobalAS : AddressSpace<"clang::LangAS::sycl_global">;
40-
def ConstantAS : AddressSpace<"clang::LangAS::sycl_constant">;
41-
def LocalAS : AddressSpace<"clang::LangAS::sycl_local">;
42-
def GenericAS : AddressSpace<"clang::LangAS::sycl_generic">;
38+
def PrivateAS : AddressSpace<"clang::LangAS::opencl_private">;
39+
def GlobalAS : AddressSpace<"clang::LangAS::opencl_global">;
40+
def ConstantAS : AddressSpace<"clang::LangAS::opencl_constant">;
41+
def LocalAS : AddressSpace<"clang::LangAS::opencl_local">;
42+
def GenericAS : AddressSpace<"clang::LangAS::opencl_generic">;
4343

4444
// TODO: Manage capabilities. Unused for now.
4545
class AbstractExtension<string _Ext> {

clang/lib/Sema/SemaType.cpp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6189,35 +6189,14 @@ static bool BuildAddressSpaceIndex(Sema &S, LangAS &ASIdx,
61896189
llvm::APSInt max(addrSpace.getBitWidth());
61906190
max =
61916191
Qualifiers::MaxAddressSpace - (unsigned)LangAS::FirstTargetAddressSpace;
6192-
61936192
if (addrSpace > max) {
61946193
S.Diag(AttrLoc, diag::err_attribute_address_space_too_high)
61956194
<< (unsigned)max.getZExtValue() << AddrSpace->getSourceRange();
61966195
return false;
61976196
}
61986197

6199-
if (S.LangOpts.SYCLIsDevice && (addrSpace >= 4)) {
6200-
S.Diag(AttrLoc, diag::err_sycl_attribute_address_space_invalid)
6201-
<< AddrSpace->getSourceRange();
6202-
return false;
6203-
}
6204-
6205-
ASIdx = getLangASFromTargetAS(
6206-
static_cast<unsigned>(addrSpace.getZExtValue()));
6207-
6208-
if (S.LangOpts.SYCLIsDevice) {
6209-
ASIdx =
6210-
[](unsigned AS) {
6211-
switch (AS) {
6212-
case 0: return LangAS::sycl_private;
6213-
case 1: return LangAS::sycl_global;
6214-
case 2: return LangAS::sycl_constant;
6215-
case 3: return LangAS::sycl_local;
6216-
case 4: default: llvm_unreachable("Invalid SYCL AS");
6217-
}
6218-
}(static_cast<unsigned>(ASIdx) -
6219-
static_cast<unsigned>(LangAS::FirstTargetAddressSpace));
6220-
}
6198+
ASIdx =
6199+
getLangASFromTargetAS(static_cast<unsigned>(addrSpace.getZExtValue()));
62216200
return true;
62226201
}
62236202

@@ -6343,8 +6322,7 @@ static void HandleAddressSpaceTypeAttribute(QualType &Type,
63436322
Attr.setInvalid();
63446323
} else {
63456324
// The keyword-based type attributes imply which address space to use.
6346-
ASIdx = S.getLangOpts().SYCLIsDevice ?
6347-
Attr.asSYCLLangAS() : Attr.asOpenCLLangAS();
6325+
ASIdx = Attr.asOpenCLLangAS();
63486326
if (ASIdx == LangAS::Default)
63496327
llvm_unreachable("Invalid address space");
63506328

0 commit comments

Comments
 (0)