Skip to content

Support for new namespace #4460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
c70e525
Start namespace renaming
romanovvlad Aug 24, 2021
813b217
clang formatting
romanovvlad Aug 24, 2021
535e32e
minor Fixes
romanovvlad Aug 24, 2021
ffbead5
tiny fixes
romanovvlad Aug 24, 2021
462f4b1
Add comments and test
romanovvlad Aug 24, 2021
358994c
Apply comments and fix tests
romanovvlad Aug 30, 2021
37b945e
Merge remote-tracking branch 'public/sycl' into private2/vromanov/Alias
romanovvlad Aug 30, 2021
1fb1ec8
clang formatting
romanovvlad Aug 30, 2021
c2d6b58
more clang formatting
romanovvlad Aug 30, 2021
911d4d1
resolve comments
romanovvlad Aug 30, 2021
b24a5c0
resolve comments
romanovvlad Aug 30, 2021
24ee4ec
address comments
romanovvlad Aug 31, 2021
53d3767
Merge remote-tracking branch 'public/sycl' into private2/vromanov/Alias
romanovvlad Aug 31, 2021
2d8f7c1
Draft
romanovvlad Aug 31, 2021
094a583
Add linux aliases
romanovvlad Aug 31, 2021
c1119eb
42 out of 277 fail
romanovvlad Aug 31, 2021
8848ef2
works?
romanovvlad Sep 1, 2021
c93af08
remove windows krishkas
romanovvlad Sep 1, 2021
6821a6d
Merge remote-tracking branch 'public/sycl' into private2/vromanov/Alias2
romanovvlad Sep 1, 2021
32c3a74
Fixes after merge
romanovvlad Sep 1, 2021
c670077
Fixes after merge ^ 2
romanovvlad Sep 1, 2021
a1c70b5
Update clang tests
romanovvlad Sep 2, 2021
43e514c
Merge remote-tracking branch 'public/sycl' into private2/vromanov/Alias2
romanovvlad Sep 2, 2021
d2badd2
guard symbol aliases
romanovvlad Sep 2, 2021
cb05817
Update SYCL special types detection
romanovvlad Sep 6, 2021
ff53269
Merge remote-tracking branch 'public/sycl' into private2/vromanov/Alias2
romanovvlad Sep 6, 2021
d839487
always use internal namespace
romanovvlad Sep 6, 2021
66fc32b
converted some exceptions
romanovvlad Sep 7, 2021
5f6a90d
Update more exceptions
romanovvlad Sep 7, 2021
d9947a5
Update more exceptions
romanovvlad Sep 8, 2021
e178c42
Merge remote-tracking branch 'public/sycl' into private2/vromanov/Alias2
romanovvlad Sep 8, 2021
e97ebdc
Make it buildable
romanovvlad Sep 8, 2021
ded5abf
Make it buildable on windows
denis-kabanov Sep 17, 2021
db739ca
Merge remote-tracking branch 'upstream/sycl' into private2/vromanov/A…
denis-kabanov Sep 17, 2021
42daea4
Fix compilation after merge
denis-kabanov Sep 20, 2021
3328aa6
Merge branch 'sycl' into private2/vromanov/Alias2
denis-kabanov Sep 20, 2021
3d38f85
Fix function_pointer
denis-kabanov Sep 20, 2021
5e1f917
Make tests supported
denis-kabanov Sep 22, 2021
10cd937
Merge remote-tracking branch 'upstream/sycl' into private2/vromanov/A…
denis-kabanov Sep 22, 2021
0ff16d1
Fix tests on linux
denis-kabanov Sep 24, 2021
3c74787
Merge remote-tracking branch 'upstream/sycl' into private2/vromanov/A…
denis-kabanov Sep 24, 2021
de8ccca
Fix test, functional pointer, clang-format
denis-kabanov Sep 24, 2021
d1e7c82
Return __function_pointer
denis-kabanov Sep 24, 2021
7837d9b
Fix windows symbols
denis-kabanov Sep 28, 2021
96f2de7
Merge remote-tracking branch 'upstream/sycl' into private2/vromanov/A…
denis-kabanov Sep 28, 2021
69e2a56
Fix for llvm-test-suite
denis-kabanov Oct 1, 2021
d4f2b03
Merge remote-tracking branch 'upstream/sycl' into private2/vromanov/A…
denis-kabanov Oct 1, 2021
28ee8ae
Merge fix
denis-kabanov Oct 1, 2021
1d7100b
Fix windows and cuda
denis-kabanov Oct 4, 2021
8ad2e76
Merge branch 'sycl' into private2/vromanov/Alias2
denis-kabanov Oct 4, 2021
8b42f7d
Dump windows symbols
denis-kabanov Oct 4, 2021
dc5915b
Merge branch 'sycl' into private2/vromanov/Alias2
denis-kabanov Oct 4, 2021
41f7e60
Merge fix
denis-kabanov Oct 4, 2021
2c80fe8
Delete symbol
denis-kabanov Oct 4, 2021
743b77f
Fix for HierPar
denis-kabanov Oct 8, 2021
a70a70c
Merge branch 'private2/vromanov/Alias2' of https://github.com/romanov…
denis-kabanov Oct 8, 2021
70e6072
Merge branch 'sycl' of https://github.com/intel/llvm into private2/vr…
denis-kabanov Oct 8, 2021
7f3ab54
Fix linux symbols
denis-kabanov Oct 10, 2021
a0e6306
Merge branch 'sycl' into private2/vromanov/Alias2
denis-kabanov Oct 10, 2021
c5b804d
Fix kernel_name_inside_sycl_namespace
denis-kabanov Oct 21, 2021
a9726d1
Merge branch 'sycl' of https://github.com/intel/llvm into private2/vr…
denis-kabanov Oct 21, 2021
819df54
Fix linux symbols
denis-kabanov Oct 22, 2021
fbec2e5
Fix cuda build
denis-kabanov Oct 22, 2021
2a02cbf
Fix namespace in tests
denis-kabanov Oct 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 7 additions & 1 deletion clang/lib/CodeGen/CGSYCLRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ static bool isPFWI(const FunctionDecl &FD) {
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "cl"},
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "sycl"},
Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization, "group"}};
if (!Util::matchQualifiedTypeName(MD->getParent(), Scopes))

static std::array<Util::DeclContextDesc, 3> ScopesInternal = {
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "__sycl_internal"},
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "__v1"},
Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization, "group"}};
if ((!Util::matchQualifiedTypeName(MD->getParent(), Scopes)) &&
(!Util::matchQualifiedTypeName(MD->getParent(), ScopesInternal)))
return false;
return FD.getName() == "parallel_for_work_item";
}
Expand Down
118 changes: 100 additions & 18 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4589,7 +4589,8 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {

O << "// Specialization constants IDs:\n";
for (const auto &P : llvm::make_range(SpecConsts.begin(), End)) {
O << "template <> struct sycl::detail::SpecConstantInfo<";
O << "template <> struct "
"__SYCL_INT_HEADER_NS()::detail::SpecConstantInfo<";
SYCLKernelNameTypePrinter Printer(O, Policy);
Printer.Visit(P.first);
O << "> {\n";
Expand All @@ -4606,8 +4607,7 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
FwdDeclEmitter.Visit(K.NameType);
O << "\n";

O << "__SYCL_INLINE_NAMESPACE(cl) {\n";
O << "namespace sycl {\n";
O << "__SYCL_INT_HEADER_OPEN_NS() {\n";
O << "namespace detail {\n";

O << "\n";
Expand Down Expand Up @@ -4695,8 +4695,8 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
}
O << "\n";
O << "} // namespace detail\n";
O << "} // namespace sycl\n";
O << "} // __SYCL_INLINE_NAMESPACE(cl)\n";
O << "} // __SYCL_INT_HEADER_OPEN_NS()\n";
O << "__SYCL_INT_HEADER_CLOSE_NS()\n";
O << "\n";
}

Expand Down Expand Up @@ -4978,8 +4978,7 @@ bool SYCLIntegrationFooter::emit(raw_ostream &OS) {

VisitedSpecConstants.insert(VD);
std::string TopShim = EmitSpecIdShims(OS, ShimCounter, Policy, VD);
OS << "__SYCL_INLINE_NAMESPACE(cl) {\n";
OS << "namespace sycl {\n";
OS << "__SYCL_INT_HEADER_OPEN_NS() {\n";
OS << "namespace detail {\n";
OS << "template<>\n";
OS << "inline const char *get_spec_constant_symbolic_ID_impl<";
Expand All @@ -4997,8 +4996,8 @@ bool SYCLIntegrationFooter::emit(raw_ostream &OS) {
OS << "\";\n";
OS << "}\n";
OS << "} // namespace detail\n";
OS << "} // namespace sycl\n";
OS << "} // __SYCL_INLINE_NAMESPACE(cl)\n";
OS << "} // __SYCL_INT_HEADER_OPEN_NS()\n";
OS << "__SYCL_INT_HEADER_CLOSE_NS()\n";
}

if (EmittedFirstSpecConstant)
Expand All @@ -5024,7 +5023,15 @@ bool Util::isSyclHalfType(QualType Ty) {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "detail"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "half_impl"),
Util::MakeDeclContextDesc(Decl::Kind::CXXRecord, "half")};
return matchQualifiedTypeName(Ty, Scopes);

std::array<DeclContextDesc, 5> ScopesInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "detail"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "half_impl"),
Util::MakeDeclContextDesc(Decl::Kind::CXXRecord, "half")};
return matchQualifiedTypeName(Ty, Scopes) ||
matchQualifiedTypeName(Ty, ScopesInternal);
}

bool Util::isSyclSpecConstantType(QualType Ty) {
Expand All @@ -5036,7 +5043,16 @@ bool Util::isSyclSpecConstantType(QualType Ty) {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "experimental"),
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
"spec_constant")};
return matchQualifiedTypeName(Ty, Scopes);
std::array<DeclContextDesc, 6> ScopesInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "ext"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "oneapi"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "experimental"),
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
"spec_constant")};
return matchQualifiedTypeName(Ty, Scopes) ||
matchQualifiedTypeName(Ty, ScopesInternal);
}

bool Util::isSyclSpecIdType(QualType Ty) {
Expand All @@ -5045,15 +5061,30 @@ bool Util::isSyclSpecIdType(QualType Ty) {
Util::MakeDeclContextDesc(clang::Decl::Kind::Namespace, "sycl"),
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
"specialization_id")};
return matchQualifiedTypeName(Ty, Scopes);

std::array<DeclContextDesc, 3> ScopesInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1"),
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
"specialization_id")};

return matchQualifiedTypeName(Ty, Scopes) ||
matchQualifiedTypeName(Ty, ScopesInternal);
}

bool Util::isSyclKernelHandlerType(QualType Ty) {
std::array<DeclContextDesc, 3> Scopes = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "cl"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "sycl"),
Util::MakeDeclContextDesc(Decl::Kind::CXXRecord, "kernel_handler")};
return matchQualifiedTypeName(Ty, Scopes);

std::array<DeclContextDesc, 3> ScopesInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1"),
Util::MakeDeclContextDesc(Decl::Kind::CXXRecord, "kernel_handler")};

return matchQualifiedTypeName(Ty, Scopes) ||
matchQualifiedTypeName(Ty, ScopesInternal);
}

bool Util::isSyclAccessorNoAliasPropertyType(QualType Ty) {
Expand All @@ -5066,7 +5097,18 @@ bool Util::isSyclAccessorNoAliasPropertyType(QualType Ty) {
Util::DeclContextDesc{Decl::Kind::CXXRecord, "no_alias"},
Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization,
"instance"}};
return matchQualifiedTypeName(Ty, Scopes);
std::array<DeclContextDesc, 7> ScopesInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1"),
Util::DeclContextDesc{Decl::Kind::Namespace, "ext"},
Util::DeclContextDesc{Decl::Kind::Namespace, "oneapi"},
Util::DeclContextDesc{Decl::Kind::Namespace, "property"},
Util::DeclContextDesc{Decl::Kind::CXXRecord, "no_alias"},
Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization,
"instance"}};

return matchQualifiedTypeName(Ty, Scopes) ||
matchQualifiedTypeName(Ty, ScopesInternal);
}

bool Util::isSyclBufferLocationType(QualType Ty) {
Expand All @@ -5079,7 +5121,19 @@ bool Util::isSyclBufferLocationType(QualType Ty) {
Util::MakeDeclContextDesc(Decl::Kind::CXXRecord, "buffer_location"),
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
"instance")};
return matchQualifiedTypeName(Ty, Scopes);

std::array<DeclContextDesc, 7> ScopesInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "ext"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "intel"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "property"),
Util::MakeDeclContextDesc(Decl::Kind::CXXRecord, "buffer_location"),
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
"instance")};

return matchQualifiedTypeName(Ty, Scopes) ||
matchQualifiedTypeName(Ty, ScopesInternal);
}

bool Util::isSyclType(QualType Ty, StringRef Name, bool Tmpl) {
Expand All @@ -5089,7 +5143,14 @@ bool Util::isSyclType(QualType Ty, StringRef Name, bool Tmpl) {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "cl"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "sycl"),
Util::MakeDeclContextDesc(ClassDeclKind, Name)};
return matchQualifiedTypeName(Ty, Scopes);

std::array<DeclContextDesc, 3> ScopesInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1"),
Util::MakeDeclContextDesc(ClassDeclKind, Name)};

return matchQualifiedTypeName(Ty, Scopes) ||
matchQualifiedTypeName(Ty, ScopesInternal);
}

bool Util::isSyclFunction(const FunctionDecl *FD, StringRef Name) {
Expand All @@ -5111,7 +5172,19 @@ bool Util::isSyclFunction(const FunctionDecl *FD, StringRef Name) {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "oneapi"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "experimental")};

return matchContext(DC, ScopesSycl) || matchContext(DC, ScopesOneapiExp);
std::array<DeclContextDesc, 2> ScopesSyclInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1")};
std::array<DeclContextDesc, 5> ScopesOneapiExpInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "ext"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "oneapi"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "experimental")};

return matchContext(DC, ScopesSycl) || matchContext(DC, ScopesOneapiExp) ||
matchContext(DC, ScopesSyclInternal) ||
matchContext(DC, ScopesOneapiExpInternal);
}

bool Util::isAccessorPropertyListType(QualType Ty) {
Expand All @@ -5122,7 +5195,16 @@ bool Util::isAccessorPropertyListType(QualType Ty) {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "oneapi"),
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
"accessor_property_list")};
return matchQualifiedTypeName(Ty, Scopes);
std::array<DeclContextDesc, 5> ScopesInternal = {
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__sycl_internal"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "__v1"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "ext"),
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "oneapi"),
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
"accessor_property_list")};

return matchQualifiedTypeName(Ty, Scopes) ||
matchQualifiedTypeName(Ty, ScopesInternal);
}

bool Util::matchContext(const DeclContext *Ctx,
Expand Down
Loading