diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp index 495de35db6914..ff858281d2da7 100644 --- a/clang/lib/Sema/SemaSYCL.cpp +++ b/clang/lib/Sema/SemaSYCL.cpp @@ -4788,8 +4788,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_OPEN_NS() {\n"; O << "namespace detail {\n"; O << "\n"; @@ -4868,8 +4867,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_OPEN_NS()\n"; + O << "__SYCL_CLOSE_NS()\n"; O << "\n"; } @@ -5151,8 +5150,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_OPEN_NS() {\n"; OS << "namespace detail {\n"; OS << "template<>\n"; OS << "inline const char *get_spec_constant_symbolic_ID_impl<"; @@ -5170,8 +5168,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_OPEN_NS()\n"; + OS << "__SYCL_CLOSE_NS()\n"; } if (EmittedFirstSpecConstant) diff --git a/clang/test/CodeGenSYCL/anonymous_integration_footer.cpp b/clang/test/CodeGenSYCL/anonymous_integration_footer.cpp index ec9f726bd7b50..430dfb14a4754 100644 --- a/clang/test/CodeGenSYCL/anonymous_integration_footer.cpp +++ b/clang/test/CodeGenSYCL/anonymous_integration_footer.cpp @@ -17,50 +17,46 @@ using namespace cl; // variable. struct S1 { static constexpr sycl::specialization_id a{1}; - // CHECK: __SYCL_INLINE_NAMESPACE(cl) { - // CHECK-NEXT: namespace sycl { + // CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::S1::a>() { // CHECK-NEXT: return "_ZN2S11aE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail - // CHECK-NEXT: } // namespace sycl - // CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) + // CHECK-NEXT: } // __SYCL_OPEN_NS() + // CHECK-NEXT: __SYCL_CLOSE_NS() }; constexpr sycl::specialization_id b{2}; -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::b>() { // CHECK-NEXT: return "____ZL1b"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() inline constexpr sycl::specialization_id c{3}; -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::c>() { // CHECK-NEXT: return "_Z1c"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() static constexpr sycl::specialization_id d{4}; -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::d>() { // CHECK-NEXT: return "____ZL1d"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace { struct S2 { @@ -72,16 +68,15 @@ struct S2 { // CHECK-NEXT: } // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace - // CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { - // CHECK-NEXT: namespace sycl { + // CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN12_GLOBAL__N_12S21aE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail - // CHECK-NEXT: } // namespace sycl - // CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) + // CHECK-NEXT: } // __SYCL_OPEN_NS() + // CHECK-NEXT: __SYCL_CLOSE_NS() }; } // namespace @@ -90,52 +85,48 @@ struct S3 { static constexpr sycl::specialization_id a{Val}; }; template class S3<1>; -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::S3<1>::a>() { // CHECK-NEXT: return "_ZN2S3ILi1EE1aE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() template class S3<2>; -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::S3<2>::a>() { // CHECK-NEXT: return "_ZN2S3ILi2EE1aE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace inner { constexpr sycl::specialization_id same_name{5}; -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::inner::same_name>() { // CHECK-NEXT: return "____ZN5innerL9same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } constexpr sycl::specialization_id same_name{6}; -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::same_name>() { // CHECK-NEXT: return "____ZL9same_name"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace { constexpr sycl::specialization_id same_name{7}; // CHECK-NEXT: namespace { @@ -145,16 +136,15 @@ constexpr sycl::specialization_id same_name{7}; // CHECK-NEXT: } // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN12_GLOBAL__N_19same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } namespace { namespace inner { @@ -166,16 +156,15 @@ constexpr sycl::specialization_id same_name{8}; // CHECK-NEXT: } // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN12_GLOBAL__N_15inner9same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } } // namespace namespace inner { @@ -190,31 +179,29 @@ constexpr sycl::specialization_id same_name{9}; // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace // CHECK-NEXT: } // namespace inner -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::inner::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN5inner12_GLOBAL__N_19same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } } // namespace inner namespace outer { constexpr sycl::specialization_id same_name{10}; -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::outer::same_name>() { // CHECK-NEXT: return "____ZN5outerL9same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace { constexpr sycl::specialization_id same_name{11}; // CHECK-NEXT: namespace outer { @@ -226,16 +213,15 @@ constexpr sycl::specialization_id same_name{11}; // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace // CHECK-NEXT: } // namespace outer -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::outer::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN5outer12_GLOBAL__N_19same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace inner { constexpr sycl::specialization_id same_name{12}; @@ -248,16 +234,15 @@ constexpr sycl::specialization_id same_name{12}; // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace // CHECK-NEXT: } // namespace outer -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::outer::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN5outer12_GLOBAL__N_15inner9same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace { // This has multiple anonymous namespaces in its declaration context, we need to @@ -286,16 +271,15 @@ constexpr sycl::specialization_id same_name{13}; // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace // CHECK-NEXT: } // namespace outer -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::outer::__sycl_detail::__spec_id_shim_[[SHIM_ID_2]]()>() { // CHECK-NEXT: return "____ZN5outer12_GLOBAL__N_15inner12_GLOBAL__N_19same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } } // namespace inner } // namespace @@ -311,16 +295,15 @@ constexpr sycl::specialization_id same_name{14}; // CHECK-NEXT: } // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN12_GLOBAL__N_15outer9same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace { constexpr sycl::specialization_id same_name{15}; // CHECK-NEXT: namespace { @@ -341,16 +324,15 @@ constexpr sycl::specialization_id same_name{15}; // CHECK-NEXT: } // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::__sycl_detail::__spec_id_shim_[[SHIM_ID2]]()>() { // CHECK-NEXT: return "____ZN12_GLOBAL__N_15outer12_GLOBAL__N_19same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace inner { constexpr sycl::specialization_id same_name{16}; // CHECK-NEXT: namespace { @@ -371,16 +353,15 @@ constexpr sycl::specialization_id same_name{16}; // CHECK-NEXT: } // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::__sycl_detail::__spec_id_shim_[[SHIM_ID2]]()>() { // CHECK-NEXT: return "____ZN12_GLOBAL__N_15outer12_GLOBAL__N_15inner9same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } } // namespace } // namespace outer @@ -389,16 +370,15 @@ constexpr sycl::specialization_id same_name{16}; namespace outer { namespace inner { constexpr sycl::specialization_id same_name{17}; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::outer::inner::same_name>() { // CHECK-NEXT: return "____ZN5outer5innerL9same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } } // namespace outer diff --git a/clang/test/CodeGenSYCL/anonymous_integration_footer2.cpp b/clang/test/CodeGenSYCL/anonymous_integration_footer2.cpp index d90f593c4043b..6311b4b7ee9fe 100644 --- a/clang/test/CodeGenSYCL/anonymous_integration_footer2.cpp +++ b/clang/test/CodeGenSYCL/anonymous_integration_footer2.cpp @@ -16,75 +16,69 @@ using namespace cl; struct S1 { static constexpr sycl::specialization_id a{1}; }; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::S1::a>() { // CHECK-NEXT: return "_ZN2S11aE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() constexpr sycl::specialization_id b{202}; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::b>() { // CHECK-NEXT: return "____ZL1b"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() inline constexpr sycl::specialization_id c{3}; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::c>() { // CHECK-NEXT: return "_Z1c"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() static constexpr sycl::specialization_id d{205}; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::d>() { // CHECK-NEXT: return "____ZL1d"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace inner { constexpr sycl::specialization_id same_name{5}; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::inner::same_name>() { // CHECK-NEXT: return "____ZN5innerL9same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } constexpr sycl::specialization_id same_name{6}; -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::same_name>() { // CHECK-NEXT: return "____ZL9same_name"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace { constexpr sycl::specialization_id same_name{207}; // CHECK: namespace { @@ -94,16 +88,15 @@ constexpr sycl::specialization_id same_name{207}; // CHECK-NEXT: } // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN12_GLOBAL__N_19same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } namespace { namespace inner { @@ -115,16 +108,15 @@ constexpr sycl::specialization_id same_name{208}; // CHECK-NEXT: } // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN12_GLOBAL__N_15inner9same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } } // namespace @@ -142,16 +134,15 @@ constexpr sycl::specialization_id same_name{209}; // CHECK-NEXT: } // namespace // CHECK-NEXT: } // inline namespace inner // CHECK-NEXT: } // namespace outer -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::outer::inner::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() { // CHECK-NEXT: return "____ZN5outer5inner12_GLOBAL__N_19same_nameE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } } diff --git a/clang/test/CodeGenSYCL/integration_footer.cpp b/clang/test/CodeGenSYCL/integration_footer.cpp index 3a2ddbf559e5e..e2700b6ea1e9e 100644 --- a/clang/test/CodeGenSYCL/integration_footer.cpp +++ b/clang/test/CodeGenSYCL/integration_footer.cpp @@ -12,25 +12,27 @@ int main() { using namespace cl::sycl; cl::sycl::specialization_id GlobalSpecID; -// CHECK: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::GlobalSpecID>() { // CHECK-NEXT: return "_Z12GlobalSpecID"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() struct Wrapper { static specialization_id WrapperSpecID; - // CHECK: namespace sycl { + // CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::Wrapper::WrapperSpecID>() { // CHECK-NEXT: return "_ZN7Wrapper13WrapperSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail - // CHECK-NEXT: } // namespace sycl + // CHECK-NEXT: } // __SYCL_OPEN_NS() + // CHECK-NEXT: __SYCL_CLOSE_NS() }; template @@ -38,64 +40,70 @@ struct WrapperTemplate { static specialization_id WrapperSpecID; }; template class WrapperTemplate; -// CHECK: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::WrapperTemplate::WrapperSpecID>() { // CHECK-NEXT: return "_ZN15WrapperTemplateIiE13WrapperSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() template class WrapperTemplate; -// CHECK: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::WrapperTemplate::WrapperSpecID>() { // CHECK-NEXT: return "_ZN15WrapperTemplateIdE13WrapperSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() namespace Foo { specialization_id NSSpecID; -// CHECK: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::Foo::NSSpecID>() { // CHECK-NEXT: return "_ZN3Foo8NSSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() inline namespace Bar { specialization_id InlineNSSpecID; -// CHECK: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::Foo::InlineNSSpecID>() { // CHECK-NEXT: return "_ZN3Foo3Bar14InlineNSSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() specialization_id NSSpecID; -// CHECK: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::Foo::Bar::NSSpecID>() { // CHECK-NEXT: return "_ZN3Foo3Bar8NSSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() struct Wrapper { static specialization_id WrapperSpecID; - // CHECK: namespace sycl { + // CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::Foo::Wrapper::WrapperSpecID>() { // CHECK-NEXT: return "_ZN3Foo3Bar7Wrapper13WrapperSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail - // CHECK-NEXT: } // namespace sycl + // CHECK-NEXT: } // __SYCL_OPEN_NS() + // CHECK-NEXT: __SYCL_CLOSE_NS() }; template @@ -103,23 +111,25 @@ struct WrapperTemplate { static specialization_id WrapperSpecID; }; template class WrapperTemplate; -// CHECK: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::Foo::WrapperTemplate::WrapperSpecID>() { // CHECK-NEXT: return "_ZN3Foo3Bar15WrapperTemplateIiE13WrapperSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() template class WrapperTemplate; -// CHECK: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::Foo::WrapperTemplate::WrapperSpecID>() { // CHECK-NEXT: return "_ZN3Foo3Bar15WrapperTemplateIdE13WrapperSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } // namespace Bar namespace { specialization_id AnonNSSpecID; @@ -134,14 +144,15 @@ specialization_id AnonNSSpecID; // CHECK-NEXT: } // namespace // CHECK-NEXT: } // namespace Foo -// CHECK: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::Foo::__sycl_detail::__spec_id_shim_[[SHIM0]]()>() { // CHECK-NEXT: return "____ZN3Foo12_GLOBAL__N_112AnonNSSpecIDE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() } // namespace } // namespace Foo @@ -179,16 +190,15 @@ auto x = HasVarTemplate::VarTempl.getDefaultValue(); // CHECK-NEXT: } // CHECK-NEXT: } // namespace __sycl_detail // CHECK-NEXT: } // namespace -// CHECK-NEXT: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK-NEXT: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK-NEXT: template<> // CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID_impl<::__sycl_detail::__spec_id_shim_[[SHIM1]]()>() { // CHECK-NEXT: return "____ZN12_GLOBAL__N_114HasVarTemplate8VarTemplIiLi2EEE"; // CHECK-NEXT: } // CHECK-NEXT: } // namespace detail -// CHECK-NEXT: } // namespace sycl -// CHECK-NEXT: } // __SYCL_INLINE_NAMESPACE(cl) +// CHECK-NEXT: } // __SYCL_OPEN_NS() +// CHECK-NEXT: __SYCL_CLOSE_NS() template struct GlobalWrapper { template static constexpr specialization_id sc{Value}; diff --git a/clang/test/CodeGenSYCL/kernel-param-acc-array-ih.cpp b/clang/test/CodeGenSYCL/kernel-param-acc-array-ih.cpp index 5d935155b6944..b2f75a10f43b7 100644 --- a/clang/test/CodeGenSYCL/kernel-param-acc-array-ih.cpp +++ b/clang/test/CodeGenSYCL/kernel-param-acc-array-ih.cpp @@ -8,8 +8,7 @@ // CHECK: class kernel_A; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK: static constexpr diff --git a/clang/test/CodeGenSYCL/kernel-param-member-acc-array-ih.cpp b/clang/test/CodeGenSYCL/kernel-param-member-acc-array-ih.cpp index b19f2a51c9426..27be50d75855e 100644 --- a/clang/test/CodeGenSYCL/kernel-param-member-acc-array-ih.cpp +++ b/clang/test/CodeGenSYCL/kernel-param-member-acc-array-ih.cpp @@ -8,8 +8,7 @@ // CHECK: class kernel_C; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK: static constexpr diff --git a/clang/test/CodeGenSYCL/kernel-param-pod-array-ih.cpp b/clang/test/CodeGenSYCL/kernel-param-pod-array-ih.cpp index d2fc58d0c2b3a..a25130974c438 100644 --- a/clang/test/CodeGenSYCL/kernel-param-pod-array-ih.cpp +++ b/clang/test/CodeGenSYCL/kernel-param-pod-array-ih.cpp @@ -7,8 +7,7 @@ // CHECK: class kernel_B; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK: static constexpr diff --git a/clang/test/CodeGenSYCL/parallel_for_this_item.cpp b/clang/test/CodeGenSYCL/parallel_for_this_item.cpp index cc6507b20bb34..16ed2b7d66327 100755 --- a/clang/test/CodeGenSYCL/parallel_for_this_item.cpp +++ b/clang/test/CodeGenSYCL/parallel_for_this_item.cpp @@ -4,8 +4,7 @@ // This test checks that compiler generates correct kernel description // for parallel_for kernels that use the this_item API. -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK: static constexpr diff --git a/clang/test/CodeGenSYCL/union-kernel-param-ih.cpp b/clang/test/CodeGenSYCL/union-kernel-param-ih.cpp index 9a6dee3611101..124f30de5b7c2 100644 --- a/clang/test/CodeGenSYCL/union-kernel-param-ih.cpp +++ b/clang/test/CodeGenSYCL/union-kernel-param-ih.cpp @@ -8,8 +8,7 @@ // CHECK: class kernel_A; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK: static constexpr diff --git a/clang/test/CodeGenSYCL/wrapped-accessor.cpp b/clang/test/CodeGenSYCL/wrapped-accessor.cpp index 7668753ba126c..d5469c8a652b6 100644 --- a/clang/test/CodeGenSYCL/wrapped-accessor.cpp +++ b/clang/test/CodeGenSYCL/wrapped-accessor.cpp @@ -5,8 +5,7 @@ // CHECK: class wrapped_access; -// CHECK: __SYCL_INLINE_NAMESPACE(cl) { -// CHECK-NEXT: namespace sycl { +// CHECK: __SYCL_OPEN_NS() { // CHECK-NEXT: namespace detail { // CHECK: static constexpr diff --git a/sycl/.clang-format b/sycl/.clang-format index d9e54adc5d653..f3ae8eec4743c 100644 --- a/sycl/.clang-format +++ b/sycl/.clang-format @@ -1,2 +1,2 @@ BasedOnStyle: LLVM -NamespaceMacros: ['__SYCL_INLINE_NAMESPACE'] +NamespaceMacros: ['__SYCL_OPEN_NS','__SYCL_INLINE_NAMESPACE'] diff --git a/sycl/doc/doxygen.cfg.in b/sycl/doc/doxygen.cfg.in index c159688563606..3503264e1eb88 100644 --- a/sycl/doc/doxygen.cfg.in +++ b/sycl/doc/doxygen.cfg.in @@ -2104,7 +2104,8 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = "__SYCL_INLINE_NAMESPACE(X)=namespace X" \ +PREDEFINED = "__SYCL_OPEN_NS()= namespace cl { namespace sycl {} } namespace __sycl_ns_alias = cl::sycl; namespace cl { namespace sycl" \ + "__SYCL_CLOSE_NS()=}" \ "__SYCL_EXPORT" \ "__SYCL_EXPORT_DEPRECATED(x)=" diff --git a/sycl/include/CL/__spirv/spirv_ops.hpp b/sycl/include/CL/__spirv/spirv_ops.hpp index 18ef03cc70607..80450fddf999f 100644 --- a/sycl/include/CL/__spirv/spirv_ops.hpp +++ b/sycl/include/CL/__spirv/spirv_ops.hpp @@ -178,7 +178,7 @@ extern SYCL_EXTERNAL TempRetT __spirv_ImageSampleExplicitLod(SampledType, // of atomic min/max based on the type #define __SPIRV_ATOMIC_MINMAX(AS, Op) \ template \ - typename cl::sycl::detail::enable_if_t< \ + typename __sycl_ns::detail::enable_if_t< \ std::is_integral::value && std::is_signed::value, T> \ __spirv_Atomic##Op(AS T *Ptr, __spv::Scope::Flag Memory, \ __spv::MemorySemanticsMask::Flag Semantics, \ @@ -186,7 +186,7 @@ extern SYCL_EXTERNAL TempRetT __spirv_ImageSampleExplicitLod(SampledType, return __spirv_AtomicS##Op(Ptr, Memory, Semantics, Value); \ } \ template \ - typename cl::sycl::detail::enable_if_t< \ + typename __sycl_ns::detail::enable_if_t< \ std::is_integral::value && !std::is_signed::value, T> \ __spirv_Atomic##Op(AS T *Ptr, __spv::Scope::Flag Memory, \ __spv::MemorySemanticsMask::Flag Semantics, \ @@ -194,7 +194,7 @@ extern SYCL_EXTERNAL TempRetT __spirv_ImageSampleExplicitLod(SampledType, return __spirv_AtomicU##Op(Ptr, Memory, Semantics, Value); \ } \ template \ - typename cl::sycl::detail::enable_if_t::value, T> \ + typename __sycl_ns::detail::enable_if_t::value, T> \ __spirv_Atomic##Op(AS T *Ptr, __spv::Scope::Flag Memory, \ __spv::MemorySemanticsMask::Flag Semantics, \ T Value) { \ diff --git a/sycl/include/CL/sycl/access/access.hpp b/sycl/include/CL/sycl/access/access.hpp index 8f4b9a92804e8..00f6381294c14 100644 --- a/sycl/include/CL/sycl/access/access.hpp +++ b/sycl/include/CL/sycl/access/access.hpp @@ -10,8 +10,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace access { enum class target { @@ -255,5 +254,5 @@ template struct deduce_AS<__OPENCL_CONSTANT_AS__ T> { #undef __OPENCL_PRIVATE_AS__ } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/accessor.hpp b/sycl/include/CL/sycl/accessor.hpp old mode 100755 new mode 100644 index 5bad3b36e1ede..58312a31b34be --- a/sycl/include/CL/sycl/accessor.hpp +++ b/sycl/include/CL/sycl/accessor.hpp @@ -201,8 +201,7 @@ /// accessor_common contains several helpers common for both accessor(1) and /// accessor(3) -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { class stream; namespace ext { namespace intel { @@ -1622,7 +1621,7 @@ class accessor : private: void checkDeviceAccessorBufferSize(const size_t elemInBuffer) { if (!IsHostBuf && elemInBuffer == 0) - throw cl::sycl::invalid_object_error( + throw __sycl_ns::invalid_object_error( "SYCL buffer size is zero. To create a device accessor, SYCL " "buffer size must be greater than zero.", PI_INVALID_VALUE); @@ -1991,7 +1990,7 @@ class accessor { public: template - accessor(cl::sycl::image &Image, + accessor(__sycl_ns::image &Image, handler &CommandGroupHandler) : detail::image_accessor( @@ -2004,7 +2003,7 @@ class accessor - accessor(cl::sycl::image &Image, + accessor(__sycl_ns::image &Image, handler &CommandGroupHandler, const property_list &propList) : detail::image_accessor( @@ -2050,13 +2049,13 @@ class accessor { public: template - accessor(cl::sycl::image &Image) + accessor(__sycl_ns::image &Image) : detail::image_accessor( Image, (detail::getSyclObjImpl(Image))->getElementSize()) {} template - accessor(cl::sycl::image &Image, + accessor(__sycl_ns::image &Image, const property_list &propList) : detail::image_accessor( @@ -2098,7 +2097,7 @@ class accessor - accessor(cl::sycl::image &Image, + accessor(__sycl_ns::image &Image, handler &CommandGroupHandler) : detail::image_accessor( @@ -2111,7 +2110,7 @@ class accessor - accessor(cl::sycl::image &Image, + accessor(__sycl_ns::image &Image, handler &CommandGroupHandler, const property_list &propList) : detail::image_accessor( @@ -2345,17 +2344,17 @@ host_accessor(buffer, Type1, Type2, Type3, Type4, #endif -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template -struct hash> { - using AccType = cl::sycl::accessor; +template +struct hash<__sycl_ns::accessor> { + using AccType = __sycl_ns::accessor; size_t operator()(const AccType &A) const { #ifdef __SYCL_DEVICE_ONLY__ @@ -2365,7 +2364,7 @@ struct hash()(AccImplPtr); #endif } diff --git a/sycl/include/CL/sycl/aliases.hpp b/sycl/include/CL/sycl/aliases.hpp index 3671f20e3c88e..a91c77a1bc75b 100644 --- a/sycl/include/CL/sycl/aliases.hpp +++ b/sycl/include/CL/sycl/aliases.hpp @@ -13,25 +13,24 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template class vec; namespace detail { namespace half_impl { class half; } // namespace half_impl } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() // FIXME: line below exports 'half' into global namespace, which seems incorrect // However, SYCL 1.2.1 spec considers 'half' to be a fundamental C++ data type -// which doesn't exist within the 'cl::sycl' namespace. +// which doesn't exist within the 'sycl' namespace. // Related spec issue: KhronosGroup/SYCL-Docs#40 -using half = cl::sycl::detail::half_impl::half; +using half = __sycl_ns::detail::half_impl::half; #define __SYCL_MAKE_VECTOR_ALIAS(ALIAS, TYPE, N) \ - using ALIAS##N = cl::sycl::vec; + using ALIAS##N = __sycl_ns::vec; #define __SYCL_MAKE_VECTOR_ALIASES_FOR_ARITHMETIC_TYPES(N) \ __SYCL_MAKE_VECTOR_ALIAS(char, char, N) \ @@ -43,17 +42,17 @@ using half = cl::sycl::detail::half_impl::half; __SYCL_MAKE_VECTOR_ALIAS(half, half, N) #define __SYCL_MAKE_VECTOR_ALIASES_FOR_OPENCL_TYPES(N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_char, cl::sycl::cl_char, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_uchar, cl::sycl::cl_uchar, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_short, cl::sycl::cl_short, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_ushort, cl::sycl::cl_ushort, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_int, cl::sycl::cl_int, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_uint, cl::sycl::cl_uint, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_long, cl::sycl::cl_long, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_ulong, cl::sycl::cl_ulong, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_float, cl::sycl::cl_float, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_double, cl::sycl::cl_double, N) \ - __SYCL_MAKE_VECTOR_ALIAS(cl_half, cl::sycl::cl_half, N) + __SYCL_MAKE_VECTOR_ALIAS(cl_char, __sycl_ns::cl_char, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_uchar, __sycl_ns::cl_uchar, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_short, __sycl_ns::cl_short, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_ushort, __sycl_ns::cl_ushort, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_int, __sycl_ns::cl_int, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_uint, __sycl_ns::cl_uint, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_long, __sycl_ns::cl_long, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_ulong, __sycl_ns::cl_ulong, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_float, __sycl_ns::cl_float, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_double, __sycl_ns::cl_double, N) \ + __SYCL_MAKE_VECTOR_ALIAS(cl_half, __sycl_ns::cl_half, N) #define __SYCL_MAKE_VECTOR_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES(N) \ __SYCL_MAKE_VECTOR_ALIAS(schar, signed char, N) \ @@ -69,8 +68,7 @@ using half = cl::sycl::detail::half_impl::half; __SYCL_MAKE_VECTOR_ALIASES_FOR_OPENCL_TYPES(N) \ __SYCL_MAKE_VECTOR_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES(N) -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { using byte __SYCL2020_DEPRECATED("use std::byte instead") = std::uint8_t; using schar = signed char; using uchar = unsigned char; @@ -79,7 +77,7 @@ using uint = unsigned int; using ulong = unsigned long; using longlong = long long; using ulonglong = unsigned long long; -using half = cl::sycl::detail::half_impl::half; +using half = __sycl_ns::detail::half_impl::half; using cl_bool = bool; using cl_char = std::int8_t; using cl_uchar = std::uint8_t; @@ -98,8 +96,8 @@ __SYCL_MAKE_VECTOR_ALIASES_FOR_VECTOR_LENGTH(3) __SYCL_MAKE_VECTOR_ALIASES_FOR_VECTOR_LENGTH(4) __SYCL_MAKE_VECTOR_ALIASES_FOR_VECTOR_LENGTH(8) __SYCL_MAKE_VECTOR_ALIASES_FOR_VECTOR_LENGTH(16) -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #undef __SYCL_MAKE_VECTOR_ALIAS #undef __SYCL_MAKE_VECTOR_ALIASES_FOR_ARITHMETIC_TYPES diff --git a/sycl/include/CL/sycl/aspects.hpp b/sycl/include/CL/sycl/aspects.hpp index 80be943383fc1..1cb750d8d4fe9 100644 --- a/sycl/include/CL/sycl/aspects.hpp +++ b/sycl/include/CL/sycl/aspects.hpp @@ -9,8 +9,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { enum class aspect { host = 0, @@ -48,5 +47,5 @@ enum class aspect { ext_oneapi_srgb = 30, }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/atomic.hpp b/sycl/include/CL/sycl/atomic.hpp index 8c6a3ed10101f..2f22d9511a7e5 100644 --- a/sycl/include/CL/sycl/atomic.hpp +++ b/sycl/include/CL/sycl/atomic.hpp @@ -24,8 +24,7 @@ static_assert(!std::is_same::value, \ "SYCL atomic function not available for float type") -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration template @@ -33,7 +32,7 @@ class multi_ptr; namespace detail { -using memory_order = cl::sycl::memory_order; +using memory_order = __sycl_ns::memory_order; template struct IsValidAtomicType { static constexpr bool value = @@ -44,15 +43,16 @@ template struct IsValidAtomicType { std::is_same::value); }; -template struct IsValidAtomicAddressSpace { +template <__sycl_ns::access::address_space AS> +struct IsValidAtomicAddressSpace { static constexpr bool value = (AS == access::address_space::global_space || AS == access::address_space::local_space || AS == access::address_space::global_device_space); }; -// Type trait to translate a cl::sycl::access::address_space to -// a SPIR-V memory scope +// Type trait to translate a sycl::access::address_space to a SPIR-V memory +// scope template struct GetSpirvMemoryScope {}; template <> struct GetSpirvMemoryScope { static constexpr auto scope = __spv::Scope::Device; @@ -66,79 +66,78 @@ template <> struct GetSpirvMemoryScope { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #ifndef __SYCL_DEVICE_ONLY__ // host implementation of SYCL atomics -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { -// Translate cl::sycl::memory_order or __spv::MemorySemanticsMask::Flag -// into std::memory_order +// Translate sycl::memory_order or __spv::MemorySemanticsMask::Flag into +// std::memory_order // Only relaxed memory semantics are supported currently static inline std::memory_order getStdMemoryOrder(__spv::MemorySemanticsMask::Flag) { return std::memory_order_relaxed; } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() // std::atomic version of atomic SPIR-V builtins template void __spirv_AtomicStore(std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS, T V) { - Ptr->store(V, ::cl::sycl::detail::getStdMemoryOrder(MS)); + Ptr->store(V, __sycl_ns::detail::getStdMemoryOrder(MS)); } template T __spirv_AtomicLoad(const std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS) { - return Ptr->load(::cl::sycl::detail::getStdMemoryOrder(MS)); + return Ptr->load(__sycl_ns::detail::getStdMemoryOrder(MS)); } template T __spirv_AtomicExchange(std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS, T V) { - return Ptr->exchange(V, ::cl::sycl::detail::getStdMemoryOrder(MS)); + return Ptr->exchange(V, __sycl_ns::detail::getStdMemoryOrder(MS)); } template extern T __spirv_AtomicIAdd(std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS, T V) { - return Ptr->fetch_add(V, ::cl::sycl::detail::getStdMemoryOrder(MS)); + return Ptr->fetch_add(V, __sycl_ns::detail::getStdMemoryOrder(MS)); } template extern T __spirv_AtomicISub(std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS, T V) { - return Ptr->fetch_sub(V, ::cl::sycl::detail::getStdMemoryOrder(MS)); + return Ptr->fetch_sub(V, __sycl_ns::detail::getStdMemoryOrder(MS)); } template extern T __spirv_AtomicAnd(std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS, T V) { - return Ptr->fetch_and(V, ::cl::sycl::detail::getStdMemoryOrder(MS)); + return Ptr->fetch_and(V, __sycl_ns::detail::getStdMemoryOrder(MS)); } template extern T __spirv_AtomicOr(std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS, T V) { - return Ptr->fetch_or(V, ::cl::sycl::detail::getStdMemoryOrder(MS)); + return Ptr->fetch_or(V, __sycl_ns::detail::getStdMemoryOrder(MS)); } template extern T __spirv_AtomicXor(std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS, T V) { - return Ptr->fetch_xor(V, ::cl::sycl::detail::getStdMemoryOrder(MS)); + return Ptr->fetch_xor(V, __sycl_ns::detail::getStdMemoryOrder(MS)); } template extern T __spirv_AtomicMin(std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS, T V) { - std::memory_order MemoryOrder = ::cl::sycl::detail::getStdMemoryOrder(MS); + std::memory_order MemoryOrder = __sycl_ns::detail::getStdMemoryOrder(MS); T Val = Ptr->load(MemoryOrder); while (V < Val) { if (Ptr->compare_exchange_strong(Val, V, MemoryOrder, MemoryOrder)) @@ -151,7 +150,7 @@ extern T __spirv_AtomicMin(std::atomic *Ptr, __spv::Scope::Flag, template extern T __spirv_AtomicMax(std::atomic *Ptr, __spv::Scope::Flag, __spv::MemorySemanticsMask::Flag MS, T V) { - std::memory_order MemoryOrder = ::cl::sycl::detail::getStdMemoryOrder(MS); + std::memory_order MemoryOrder = __sycl_ns::detail::getStdMemoryOrder(MS); T Val = Ptr->load(MemoryOrder); while (V > Val) { if (Ptr->compare_exchange_strong(Val, V, MemoryOrder, MemoryOrder)) @@ -163,8 +162,7 @@ extern T __spirv_AtomicMax(std::atomic *Ptr, __spv::Scope::Flag, #endif // !defined(__SYCL_DEVICE_ONLY__) -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template @@ -389,7 +387,7 @@ T atomic_fetch_max(atomic Object, T Operand, return Object.fetch_max(Operand, MemoryOrder); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #undef __SYCL_STATIC_ASSERT_NOT_FLOAT diff --git a/sycl/include/CL/sycl/atomic_fence.hpp b/sycl/include/CL/sycl/atomic_fence.hpp index 056e876f39a07..5a63a51baaf88 100644 --- a/sycl/include/CL/sycl/atomic_fence.hpp +++ b/sycl/include/CL/sycl/atomic_fence.hpp @@ -16,8 +16,7 @@ #include #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { static inline void atomic_fence(memory_order order, memory_scope scope) { #ifdef __SYCL_DEVICE_ONLY__ @@ -31,5 +30,5 @@ static inline void atomic_fence(memory_order order, memory_scope scope) { #endif } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/backend.hpp b/sycl/include/CL/sycl/backend.hpp index a8388db439e77..0c2f31193a157 100644 --- a/sycl/include/CL/sycl/backend.hpp +++ b/sycl/include/CL/sycl/backend.hpp @@ -26,8 +26,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template struct BackendInput { @@ -220,5 +219,5 @@ make_kernel_bundle(const typename backend_traits::template input_type< State, Backend); return detail::createSyclObjFromImpl>(KBImpl); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/backend/cuda.hpp b/sycl/include/CL/sycl/backend/cuda.hpp index 9a45c2fc8bf0e..63520546c1379 100644 --- a/sycl/include/CL/sycl/backend/cuda.hpp +++ b/sycl/include/CL/sycl/backend/cuda.hpp @@ -30,8 +30,7 @@ typedef unsigned long long CUdeviceptr; typedef unsigned int CUdeviceptr; #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template <> struct interop { using type = CUdevice; }; @@ -62,5 +61,5 @@ struct interop> { using type = CUdeviceptr; }; -} // namespace sycl -} // namespace cl +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/backend/level_zero.hpp b/sycl/include/CL/sycl/backend/level_zero.hpp index 08e8d48afee63..045f6e352242b 100644 --- a/sycl/include/CL/sycl/backend/level_zero.hpp +++ b/sycl/include/CL/sycl/backend/level_zero.hpp @@ -12,8 +12,7 @@ // This header should be included by users. //#include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template <> struct interop { using type = ze_driver_handle_t; @@ -164,5 +163,5 @@ T make(const context &Context, } } // namespace level_zero -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/backend/opencl.hpp b/sycl/include/CL/sycl/backend/opencl.hpp index 0c0fc33d3712c..29ce806d01c87 100644 --- a/sycl/include/CL/sycl/backend/opencl.hpp +++ b/sycl/include/CL/sycl/backend/opencl.hpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template <> struct interop { using type = cl_platform_id; @@ -151,5 +150,5 @@ T make(const context &Context, } } // namespace opencl -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/backend_types.hpp b/sycl/include/CL/sycl/backend_types.hpp index 0652adb14c2eb..9057ccaf646f8 100644 --- a/sycl/include/CL/sycl/backend_types.hpp +++ b/sycl/include/CL/sycl/backend_types.hpp @@ -15,8 +15,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { enum class backend : char { host = 0, @@ -65,5 +64,5 @@ inline std::ostream &operator<<(std::ostream &Out, backend be) { return Out; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/bit_cast.hpp b/sycl/include/CL/sycl/bit_cast.hpp index 2a042c92811bd..18bc1fc1cda53 100644 --- a/sycl/include/CL/sycl/bit_cast.hpp +++ b/sycl/include/CL/sycl/bit_cast.hpp @@ -14,8 +14,7 @@ #include #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // forward decl namespace detail { @@ -63,5 +62,5 @@ constexpr } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/buffer.hpp b/sycl/include/CL/sycl/buffer.hpp old mode 100755 new mode 100644 index 240c332c910b4..9a5ff6fc9221d --- a/sycl/include/CL/sycl/buffer.hpp +++ b/sycl/include/CL/sycl/buffer.hpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { class handler; class queue; @@ -32,7 +31,7 @@ template class range; /// /// \ingroup sycl_api template 0) && (dimensions <= 3)>> class buffer { @@ -212,14 +211,14 @@ class buffer { OffsetInBytes(getOffsetInBytes(baseIndex, b.Range)), IsSubBuffer(true) { if (b.is_sub_buffer()) - throw cl::sycl::invalid_object_error( + throw __sycl_ns::invalid_object_error( "Cannot create sub buffer from sub buffer.", PI_INVALID_VALUE); if (isOutOfBounds(baseIndex, subRange, b.Range)) - throw cl::sycl::invalid_object_error( + throw __sycl_ns::invalid_object_error( "Requested sub-buffer size exceeds the size of the parent buffer", PI_INVALID_VALUE); if (!isContiguousRegion(baseIndex, subRange, b.Range)) - throw cl::sycl::invalid_object_error( + throw __sycl_ns::invalid_object_error( "Requested sub-buffer region is not contiguous", PI_INVALID_VALUE); } @@ -347,7 +346,7 @@ class buffer { buffer reinterpret(range reinterpretRange) const { if (sizeof(ReinterpretT) * reinterpretRange.size() != byte_size()) - throw cl::sycl::invalid_object_error( + throw __sycl_ns::invalid_object_error( "Total size in bytes represented by the type and range of the " "reinterpreted SYCL buffer does not equal the total size in bytes " "represented by the type and range of this SYCL buffer", @@ -374,7 +373,7 @@ class buffer { reinterpret() const { long sz = byte_size(); if (sz % sizeof(ReinterpretT) != 0) - throw cl::sycl::invalid_object_error( + throw __sycl_ns::invalid_object_error( "Total byte size of buffer is not evenly divisible by the size of " "the reinterpreted type", PI_INVALID_VALUE); @@ -486,16 +485,16 @@ buffer(const T *, const range &, const property_list & = {}) -> buffer; #endif // __cpp_deduction_guides -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { template -struct hash> { +struct hash<__sycl_ns::buffer> { size_t - operator()(const cl::sycl::buffer &b) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(b)); + operator()(const __sycl_ns::buffer &b) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(b)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/builtins.hpp b/sycl/include/CL/sycl/builtins.hpp index c82433c61c091..9c0430cdff42e 100644 --- a/sycl/include/CL/sycl/builtins.hpp +++ b/sycl/include/CL/sycl/builtins.hpp @@ -17,8 +17,7 @@ // TODO Decide whether to mark functions with this attribute. #define __NOEXC /*noexcept*/ -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { #ifdef __SYCL_DEVICE_ONLY__ #define __sycl_std #else @@ -1546,8 +1545,8 @@ detail::enable_if_t::value, T> tan(T x) __NOEXC { } } // namespace half_precision -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #ifdef __SYCL_DEVICE_ONLY__ extern "C" { diff --git a/sycl/include/CL/sycl/builtins_esimd.hpp b/sycl/include/CL/sycl/builtins_esimd.hpp index 5b64428c685b3..0c0ac8487e88c 100644 --- a/sycl/include/CL/sycl/builtins_esimd.hpp +++ b/sycl/include/CL/sycl/builtins_esimd.hpp @@ -18,8 +18,7 @@ // TODO Decide whether to mark functions with this attribute. #define __NOEXC /*noexcept*/ -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // cos template @@ -65,7 +64,7 @@ log(__ESIMD_NS::simd x) __NOEXC { #endif // __SYCL_DEVICE_ONLY__ } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #undef __NOEXC diff --git a/sycl/include/CL/sycl/context.hpp b/sycl/include/CL/sycl/context.hpp index 93013e49d6bf8..3aa829e989bf2 100644 --- a/sycl/include/CL/sycl/context.hpp +++ b/sycl/include/CL/sycl/context.hpp @@ -19,8 +19,7 @@ // 4.6.2 Context class -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations class device; class platform; @@ -240,14 +239,14 @@ class __SYCL_EXPORT context { friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj); }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::context &Context) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(Context)); +template <> struct hash<__sycl_ns::context> { + size_t operator()(const __sycl_ns::context &Context) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(Context)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/detail/accessor_impl.hpp b/sycl/include/CL/sycl/detail/accessor_impl.hpp index 745854f0aa9ed..48fbac1e2f2ad 100644 --- a/sycl/include/CL/sycl/detail/accessor_impl.hpp +++ b/sycl/include/CL/sycl/detail/accessor_impl.hpp @@ -15,8 +15,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { @@ -261,5 +260,5 @@ constexpr access::target deduceAccessTarget(access::target defaultTarget) { #endif } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/aligned_allocator.hpp b/sycl/include/CL/sycl/detail/aligned_allocator.hpp index 4536a716d847a..8b1288a6aff5f 100644 --- a/sycl/include/CL/sycl/detail/aligned_allocator.hpp +++ b/sycl/include/CL/sycl/detail/aligned_allocator.hpp @@ -17,8 +17,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template class aligned_allocator { public: @@ -77,5 +76,5 @@ template class aligned_allocator { size_t MAlignment = 128; }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/array.hpp b/sycl/include/CL/sycl/detail/array.hpp index 5418f41a1faf1..1b3a4fa837c12 100644 --- a/sycl/include/CL/sycl/detail/array.hpp +++ b/sycl/include/CL/sycl/detail/array.hpp @@ -12,8 +12,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template class id; template class range; namespace detail { @@ -48,16 +47,16 @@ template class array { array() : array(0, 0, 0) {} // Conversion operators to derived classes - operator cl::sycl::id() const { - cl::sycl::id result; + operator __sycl_ns::id() const { + __sycl_ns::id result; for (int i = 0; i < dimensions; ++i) { result[i] = common_array[i]; } return result; } - operator cl::sycl::range() const { - cl::sycl::range result; + operator __sycl_ns::range() const { + __sycl_ns::range result; for (int i = 0; i < dimensions; ++i) { result[i] = common_array[i]; } @@ -111,8 +110,8 @@ template class array { __SYCL_ALWAYS_INLINE void check_dimension(int dimension) const { #ifndef __SYCL_DEVICE_ONLY__ if (dimension >= dimensions || dimension < 0) { - throw cl::sycl::invalid_parameter_error("Index out of range", - PI_INVALID_VALUE); + throw __sycl_ns::invalid_parameter_error("Index out of range", + PI_INVALID_VALUE); } #endif (void)dimension; @@ -120,5 +119,5 @@ template class array { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/backend_traits.hpp b/sycl/include/CL/sycl/detail/backend_traits.hpp index 0ddb9b7153366..a644d43f505c1 100644 --- a/sycl/include/CL/sycl/detail/backend_traits.hpp +++ b/sycl/include/CL/sycl/detail/backend_traits.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template struct InteropFeatureSupportMap { static constexpr bool MakePlatform = false; @@ -24,5 +23,5 @@ template struct InteropFeatureSupportMap { static constexpr bool MakeKernel = false; }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/boolean.hpp b/sycl/include/CL/sycl/detail/boolean.hpp index 5f2c8776eca6d..23b7c52feb694 100644 --- a/sycl/include/CL/sycl/detail/boolean.hpp +++ b/sycl/include/CL/sycl/detail/boolean.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template struct Assigner { @@ -126,5 +125,5 @@ template <> struct Boolean<1> { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/buffer_impl.hpp b/sycl/include/CL/sycl/detail/buffer_impl.hpp index 3d5021427254d..5c6d90667bf18 100644 --- a/sycl/include/CL/sycl/detail/buffer_impl.hpp +++ b/sycl/include/CL/sycl/detail/buffer_impl.hpp @@ -23,8 +23,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations template \ inline __SYCL_ALWAYS_INLINE R __invoke_##call(T1 t1) __NOEXC { \ - using Ret = cl::sycl::detail::ConvertToOpenCLType_t; \ - using Arg1 = cl::sycl::detail::ConvertToOpenCLType_t; \ + using Ret = __sycl_ns::detail::ConvertToOpenCLType_t; \ + using Arg1 = __sycl_ns::detail::ConvertToOpenCLType_t; \ __SYCL_EXTERN_IT1(Ret, prefix, call, Arg1); \ - Arg1 arg1 = cl::sycl::detail::convertDataToType(t1); \ + Arg1 arg1 = __sycl_ns::detail::convertDataToType(t1); \ Ret ret = __SYCL_PPCAT(prefix, call)(arg1); \ - return cl::sycl::detail::convertDataToType(ret); \ + return __sycl_ns::detail::convertDataToType(ret); \ } #define __SYCL_MAKE_CALL_ARG2(call, prefix) \ template \ inline __SYCL_ALWAYS_INLINE R __invoke_##call(T1 t1, T2 t2) __NOEXC { \ - using Ret = cl::sycl::detail::ConvertToOpenCLType_t; \ - using Arg1 = cl::sycl::detail::ConvertToOpenCLType_t; \ - using Arg2 = cl::sycl::detail::ConvertToOpenCLType_t; \ + using Ret = __sycl_ns::detail::ConvertToOpenCLType_t; \ + using Arg1 = __sycl_ns::detail::ConvertToOpenCLType_t; \ + using Arg2 = __sycl_ns::detail::ConvertToOpenCLType_t; \ __SYCL_EXTERN_IT2(Ret, prefix, call, Arg1, Arg2); \ - Arg1 arg1 = cl::sycl::detail::convertDataToType(t1); \ - Arg2 arg2 = cl::sycl::detail::convertDataToType(t2); \ + Arg1 arg1 = __sycl_ns::detail::convertDataToType(t1); \ + Arg2 arg2 = __sycl_ns::detail::convertDataToType(t2); \ Ret ret = __SYCL_PPCAT(prefix, call)(arg1, arg2); \ - return cl::sycl::detail::convertDataToType(ret); \ + return __sycl_ns::detail::convertDataToType(ret); \ } #define __SYCL_MAKE_CALL_ARG2_SAME(call, prefix) \ template \ inline __SYCL_ALWAYS_INLINE R __invoke_##call(T t1, T t2) __NOEXC { \ - using Ret = cl::sycl::detail::ConvertToOpenCLType_t; \ - using Arg = cl::sycl::detail::ConvertToOpenCLType_t; \ + using Ret = __sycl_ns::detail::ConvertToOpenCLType_t; \ + using Arg = __sycl_ns::detail::ConvertToOpenCLType_t; \ __SYCL_EXTERN_IT2_SAME(Ret, prefix, call, Arg); \ - Arg arg1 = cl::sycl::detail::convertDataToType(t1); \ - Arg arg2 = cl::sycl::detail::convertDataToType(t2); \ + Arg arg1 = __sycl_ns::detail::convertDataToType(t1); \ + Arg arg2 = __sycl_ns::detail::convertDataToType(t2); \ Ret ret = __SYCL_PPCAT(prefix, call)(arg1, arg2); \ - return cl::sycl::detail::convertDataToType(ret); \ + return __sycl_ns::detail::convertDataToType(ret); \ } #define __SYCL_MAKE_CALL_ARG2_SAME_RESULT(call, prefix) \ template \ inline __SYCL_ALWAYS_INLINE T __invoke_##call(T v1, T v2) __NOEXC { \ - using Type = cl::sycl::detail::ConvertToOpenCLType_t; \ + using Type = __sycl_ns::detail::ConvertToOpenCLType_t; \ __SYCL_EXTERN_IT2_SAME(Type, prefix, call, Type); \ - Type arg1 = cl::sycl::detail::convertDataToType(v1); \ - Type arg2 = cl::sycl::detail::convertDataToType(v2); \ + Type arg1 = __sycl_ns::detail::convertDataToType(v1); \ + Type arg2 = __sycl_ns::detail::convertDataToType(v2); \ Type ret = __SYCL_PPCAT(prefix, call)(arg1, arg2); \ - return cl::sycl::detail::convertDataToType(ret); \ + return __sycl_ns::detail::convertDataToType(ret); \ } #define __SYCL_MAKE_CALL_ARG3(call, prefix) \ template \ inline __SYCL_ALWAYS_INLINE R __invoke_##call(T1 t1, T2 t2, T3 t3) __NOEXC { \ - using Ret = cl::sycl::detail::ConvertToOpenCLType_t; \ - using Arg1 = cl::sycl::detail::ConvertToOpenCLType_t; \ - using Arg2 = cl::sycl::detail::ConvertToOpenCLType_t; \ - using Arg3 = cl::sycl::detail::ConvertToOpenCLType_t; \ + using Ret = __sycl_ns::detail::ConvertToOpenCLType_t; \ + using Arg1 = __sycl_ns::detail::ConvertToOpenCLType_t; \ + using Arg2 = __sycl_ns::detail::ConvertToOpenCLType_t; \ + using Arg3 = __sycl_ns::detail::ConvertToOpenCLType_t; \ __SYCL_EXTERN_IT3(Ret, prefix, call, Arg1, Arg2, Arg3); \ - Arg1 arg1 = cl::sycl::detail::convertDataToType(t1); \ - Arg2 arg2 = cl::sycl::detail::convertDataToType(t2); \ - Arg3 arg3 = cl::sycl::detail::convertDataToType(t3); \ + Arg1 arg1 = __sycl_ns::detail::convertDataToType(t1); \ + Arg2 arg2 = __sycl_ns::detail::convertDataToType(t2); \ + Arg3 arg3 = __sycl_ns::detail::convertDataToType(t3); \ Ret ret = __SYCL_PPCAT(prefix, call)(arg1, arg2, arg3); \ - return cl::sycl::detail::convertDataToType(ret); \ + return __sycl_ns::detail::convertDataToType(ret); \ } #ifndef __SYCL_DEVICE_ONLY__ diff --git a/sycl/include/CL/sycl/detail/cg.hpp b/sycl/include/CL/sycl/detail/cg.hpp index 7bbfe48059c22..d261507ec4a78 100644 --- a/sycl/include/CL/sycl/detail/cg.hpp +++ b/sycl/include/CL/sycl/detail/cg.hpp @@ -31,8 +31,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations class queue; @@ -508,5 +507,5 @@ class CGBarrier : public CG { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/cg_types.hpp b/sycl/include/CL/sycl/detail/cg_types.hpp index ae10b5a3cbe4c..d999b734c0483 100644 --- a/sycl/include/CL/sycl/detail/cg_types.hpp +++ b/sycl/include/CL/sycl/detail/cg_types.hpp @@ -19,18 +19,17 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // The structure represents kernel argument. class ArgDesc { public: - ArgDesc(cl::sycl::detail::kernel_param_kind_t Type, void *Ptr, int Size, + ArgDesc(__sycl_ns::detail::kernel_param_kind_t Type, void *Ptr, int Size, int Index) : MType(Type), MPtr(Ptr), MSize(Size), MIndex(Index) {} - cl::sycl::detail::kernel_param_kind_t MType; + __sycl_ns::detail::kernel_param_kind_t MType; void *MPtr; int MSize; int MIndex; @@ -216,12 +215,12 @@ class HostKernelBase { }; class InteropTask { - std::function MFunc; + std::function MFunc; public: - InteropTask(std::function Func) + InteropTask(std::function Func) : MFunc(Func) {} - void call(cl::sycl::interop_handler &h) { MFunc(h); } + void call(__sycl_ns::interop_handler &h) { MFunc(h); } }; class HostTask { @@ -424,7 +423,7 @@ class HostKernel : public HostKernelBase { } template - enable_if_t>::value> + enable_if_t>::value> runOnHost(const NDRDescT &NDRDesc) { sycl::range NGroups(InitializedVal::template get<0>()); @@ -454,5 +453,5 @@ class HostKernel : public HostKernelBase { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/common.hpp b/sycl/include/CL/sycl/detail/common.hpp index 98323c3ce4419..b239e27a7cea4 100644 --- a/sycl/include/CL/sycl/detail/common.hpp +++ b/sycl/include/CL/sycl/detail/common.hpp @@ -21,8 +21,7 @@ // public methods as a default argument. If the end-user wants to disable the // code location information, they must compile the code with // -DDISABLE_SYCL_INSTRUMENTATION_METADATA flag -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // Data structure that captures the user code location information using the // builtin capabilities of the compiler @@ -67,13 +66,6 @@ struct code_location { unsigned long MLineNo; unsigned long MColumnNo; }; -} // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) - -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { -namespace detail { __SYCL_EXPORT const char *stringifyErrorCode(cl_int error); @@ -83,8 +75,8 @@ static inline std::string codeToString(cl_int code) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #ifdef __SYCL_DEVICE_ONLY__ // TODO remove this when 'assert' is supported in device code @@ -107,7 +99,7 @@ static inline std::string codeToString(cl_int code) { auto code = expr; \ if (code != CL_SUCCESS) { \ std::cerr << __SYCL_OCL_ERROR_REPORT \ - << cl::sycl::detail::codeToString(code) << std::endl; \ + << __sycl_ns::detail::codeToString(code) << std::endl; \ } \ } #endif @@ -120,14 +112,14 @@ static inline std::string codeToString(cl_int code) { auto code = expr; \ if (code != CL_SUCCESS) { \ throw exc(__SYCL_OCL_ERROR_REPORT + \ - cl::sycl::detail::codeToString(code), \ + __sycl_ns::detail::codeToString(code), \ code); \ } \ } #define __SYCL_REPORT_OCL_ERR_TO_EXC_THROW(code, exc) \ __SYCL_REPORT_OCL_ERR_TO_EXC(code, exc) #define __SYCL_REPORT_OCL_ERR_TO_EXC_BASE(code) \ - __SYCL_REPORT_OCL_ERR_TO_EXC(code, cl::sycl::runtime_error) + __SYCL_REPORT_OCL_ERR_TO_EXC(code, __sycl_ns::runtime_error) #else #define __SYCL_REPORT_OCL_ERR_TO_EXC_BASE(code) \ __SYCL_REPORT_OCL_ERR_TO_STREAM(code) @@ -144,8 +136,7 @@ static inline std::string codeToString(cl_int code) { #define __SYCL_CHECK_OCL_CODE_NO_EXC(X) __SYCL_REPORT_OCL_ERR_TO_STREAM(X) #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // Helper function for extracting implementation from SYCL's interface objects. @@ -314,5 +305,5 @@ template struct InlineVariableHelper { template constexpr T InlineVariableHelper::value; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/common_info.hpp b/sycl/include/CL/sycl/detail/common_info.hpp index b8a82f8cb2861..362ff40dbc790 100644 --- a/sycl/include/CL/sycl/detail/common_info.hpp +++ b/sycl/include/CL/sycl/detail/common_info.hpp @@ -10,13 +10,12 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { std::vector __SYCL_EXPORT split_string(const std::string &str, char delimeter); } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/defines_elementary.hpp b/sycl/include/CL/sycl/detail/defines_elementary.hpp index ac967fec2edea..5040eea76e086 100644 --- a/sycl/include/CL/sycl/detail/defines_elementary.hpp +++ b/sycl/include/CL/sycl/detail/defines_elementary.hpp @@ -14,6 +14,55 @@ #define __SYCL_INLINE_NAMESPACE(X) namespace X #endif // __SYCL_DISABLE_NAMESPACE_INLINE__ +// TODO: Disable macro should be removed once transition to sycl:: is done. +#ifndef __SYCL_DISABLE_SYCL121_NAMESPACE +#define __SYCL_ENABLE_SYCL121_NAMESPACE +#endif + +#ifdef __SYCL_ENABLE_SYCL121_NAMESPACE +// Old SYCL1.2.1 namespace scheme +#define __SYCL_NS_OPEN_1 __SYCL_INLINE_NAMESPACE(cl) +#define __SYCL_NS_OPEN_2 namespace sycl +#define __SYCL_NS cl::sycl +#else +// New SYCL2020 friendly namespace scheme, defaulted to __v1 +#define __SYCL_NS_OPEN_1 namespace __sycl_internal +#define __SYCL_NS_OPEN_2 namespace __v1 +#define __SYCL_NS __sycl_internal::__v1 +#endif + +#ifdef __SYCL_ENABLE_SYCL121_NAMESPACE + +#define __SYCL_OPEN_NS() \ + __SYCL_NS_OPEN_1 { \ + __SYCL_NS_OPEN_2 {} \ + } \ + namespace __sycl_ns = __SYCL_NS; \ + __SYCL_NS_OPEN_1 { \ + __SYCL_NS_OPEN_2 + +#else + +// The macro: +// 1. Forward declares an empty "target" namespace for the alias +// 2. An alias which will be used to refer to "target" namepsace outside of +// namespace itself +// 3. Opens "target" namespace +#define __SYCL_OPEN_NS() \ + __SYCL_NS_OPEN_1 { \ + __SYCL_NS_OPEN_2 {} \ + } \ + namespace sycl { \ + using namespace __SYCL_NS; \ + } \ + namespace __sycl_ns = __SYCL_NS; \ + __SYCL_NS_OPEN_1 { \ + __SYCL_NS_OPEN_2 + +#endif + +#define __SYCL_CLOSE_NS() } + #ifndef __has_attribute #define __has_attribute(x) 0 #endif diff --git a/sycl/include/CL/sycl/detail/device_binary_image.hpp b/sycl/include/CL/sycl/detail/device_binary_image.hpp index a74523801175d..a8f258bb47101 100644 --- a/sycl/include/CL/sycl/detail/device_binary_image.hpp +++ b/sycl/include/CL/sycl/detail/device_binary_image.hpp @@ -12,8 +12,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // SYCL RT wrapper over PI binary image. @@ -60,5 +59,5 @@ class DynRTDeviceBinaryImage : public RTDeviceBinaryImage { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/device_filter.hpp b/sycl/include/CL/sycl/detail/device_filter.hpp index 746f7714e21a0..6157fc3bced15 100644 --- a/sycl/include/CL/sycl/detail/device_filter.hpp +++ b/sycl/include/CL/sycl/detail/device_filter.hpp @@ -15,8 +15,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { struct device_filter { @@ -83,5 +82,5 @@ inline std::ostream &operator<<(std::ostream &Out, } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/generic_type_lists.hpp b/sycl/include/CL/sycl/detail/generic_type_lists.hpp index 9965ea66eee9a..4bfe2edf2f053 100644 --- a/sycl/include/CL/sycl/detail/generic_type_lists.hpp +++ b/sycl/include/CL/sycl/detail/generic_type_lists.hpp @@ -15,21 +15,16 @@ // Generic type name description, which serves as a description for all valid // types of parameters to kernel functions -// Forward declarations -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template class vec; + namespace detail { namespace half_impl { class half; } } // namespace detail using half = detail::half_impl::half; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { namespace detail { namespace gtl { // floating point types @@ -382,5 +377,5 @@ using nonlocal_address_space_list = access::address_space::global_host_space>; } // namespace gvl } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/generic_type_traits.hpp b/sycl/include/CL/sycl/detail/generic_type_traits.hpp index 6316c23d8d6ab..93688f7446426 100644 --- a/sycl/include/CL/sycl/detail/generic_type_traits.hpp +++ b/sycl/include/CL/sycl/detail/generic_type_traits.hpp @@ -17,8 +17,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template using is_floatn = is_contained; @@ -396,7 +395,7 @@ using select_cl_scalar_t = conditional_t< // half is a special case: it is implemented differently on host and // device and therefore, might lower to different types conditional_t::value, - cl::sycl::detail::half_impl::BIsRepresentationT, T>>>; + __sycl_ns::detail::half_impl::BIsRepresentationT, T>>>; // select_cl_vector_or_scalar does cl_* type selection for element type of // a vector type T and does scalar type substitution. If T is not @@ -627,5 +626,5 @@ template inline void check_vector_size() { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/handler_proxy.hpp b/sycl/include/CL/sycl/detail/handler_proxy.hpp index 8ed01eb7a7b4d..27a0198c39b68 100644 --- a/sycl/include/CL/sycl/detail/handler_proxy.hpp +++ b/sycl/include/CL/sycl/detail/handler_proxy.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { class handler; @@ -23,5 +22,5 @@ class AccessorBaseHost; __SYCL_EXPORT void associateWithHandler(handler &, AccessorBaseHost *, access::target); } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/helpers.hpp b/sycl/include/CL/sycl/detail/helpers.hpp index 118271a35bab5..59e80256a19ff 100644 --- a/sycl/include/CL/sycl/detail/helpers.hpp +++ b/sycl/include/CL/sycl/detail/helpers.hpp @@ -21,8 +21,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { class context; class event; template class item; @@ -47,10 +46,10 @@ class context_impl; // The function returns list of events that can be passed to OpenCL API as // dependency list and waits for others. __SYCL_EXPORT std::vector -getOrWaitEvents(std::vector DepEvents, - std::shared_ptr Context); +getOrWaitEvents(std::vector<__sycl_ns::event> DepEvents, + std::shared_ptr<__sycl_ns::detail::context_impl> Context); -__SYCL_EXPORT void waitEvents(std::vector DepEvents); +__SYCL_EXPORT void waitEvents(std::vector<__sycl_ns::event> DepEvents); template T *declptr() { return static_cast(nullptr); } @@ -116,7 +115,7 @@ class Builder { } template - static void updateItemIndex(cl::sycl::item &Item, + static void updateItemIndex(__sycl_ns::item &Item, const id &NextIndex) { Item.MImpl.MIndex = NextIndex; } @@ -242,5 +241,5 @@ getSPIRVMemorySemanticsMask(const access::fence_space AccessSpace, } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/host_profiling_info.hpp b/sycl/include/CL/sycl/detail/host_profiling_info.hpp index 4aa33f7728b53..7792b52a9a81f 100644 --- a/sycl/include/CL/sycl/detail/host_profiling_info.hpp +++ b/sycl/include/CL/sycl/detail/host_profiling_info.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { /// Profiling info for the host execution. @@ -36,5 +35,5 @@ class __SYCL_EXPORT HostProfilingInfo { void end(); }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/image_accessor_util.hpp b/sycl/include/CL/sycl/detail/image_accessor_util.hpp index 1c81c0671525f..43ac17194cd07 100644 --- a/sycl/include/CL/sycl/detail/image_accessor_util.hpp +++ b/sycl/include/CL/sycl/detail/image_accessor_util.hpp @@ -22,8 +22,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template @@ -295,7 +294,7 @@ void convertReadData(const vec PixelData, // OpenCL Spec section 6.12.14.2 does not allow reading uint4 data from an // image with channel datatype other than unsigned_int8,unsigned_int16 and // unsigned_int32. - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype of read data - cl_uint4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); @@ -317,7 +316,7 @@ void convertReadData(const vec PixelData, // OpenCL Spec section 6.12.14.2 does not allow reading int4 data from an // image with channel datatype other than signed_int8,signed_int16 and // signed_int32. - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype of read data - cl_int4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); @@ -333,12 +332,12 @@ void convertReadData(const vec PixelData, case image_channel_type::snorm_int8: // max(-1.0f, (float)c / 127.0f) RetData = (PixelData.template convert()) / 127.0f; - RetData = cl::sycl::fmax(RetData, -1); + RetData = __sycl_ns::fmax(RetData, -1); break; case image_channel_type::snorm_int16: // max(-1.0f, (float)c / 32767.0f) RetData = (PixelData.template convert()) / 32767.0f; - RetData = cl::sycl::fmax(RetData, -1); + RetData = __sycl_ns::fmax(RetData, -1); break; case image_channel_type::unorm_int8: // (float)c / 255.0f @@ -399,7 +398,7 @@ void convertReadData(const vec PixelData, // OpenCL Spec section 6.12.14.2 does not allow reading float4 data from an // image with channel datatype - signed/unsigned_int8,signed/unsigned_int16 // and signed/unsigned_int32. - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype of read data - cl_float4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); @@ -423,12 +422,12 @@ void convertReadData(const vec PixelData, case image_channel_type::snorm_int8: // max(-1.0f, (half)c / 127.0f) RetDataFloat = (PixelData.template convert()) / 127.0f; - RetDataFloat = cl::sycl::fmax(RetDataFloat, -1); + RetDataFloat = __sycl_ns::fmax(RetDataFloat, -1); break; case image_channel_type::snorm_int16: // max(-1.0f, (half)c / 32767.0f) RetDataFloat = (PixelData.template convert()) / 32767.0f; - RetDataFloat = cl::sycl::fmax(RetDataFloat, -1); + RetDataFloat = __sycl_ns::fmax(RetDataFloat, -1); break; case image_channel_type::unorm_int8: // (half)c / 255.0f @@ -442,7 +441,7 @@ void convertReadData(const vec PixelData, case image_channel_type::unorm_short_555: case image_channel_type::unorm_int_101010: // TODO: Missing information in OpenCL spec. - throw cl::sycl::feature_not_supported( + throw __sycl_ns::feature_not_supported( "Currently unsupported datatype conversion from image_channel_type " "to cl_half4.", PI_INVALID_OPERATION); @@ -455,7 +454,7 @@ void convertReadData(const vec PixelData, // OpenCL Spec section 6.12.14.2 does not allow reading float4 data to an // image with channel datatype - signed/unsigned_int8,signed/unsigned_int16 // and signed/unsigned_int32. - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype to read- cl_half4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); @@ -463,7 +462,7 @@ void convertReadData(const vec PixelData, RetData = PixelData.template convert(); return; case image_channel_type::fp32: - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype to read - cl_half4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); @@ -486,14 +485,14 @@ convertWriteData(const vec WriteData, // convert_uchar_sat(Data) cl_uint MinVal = min_v(); cl_uint MaxVal = max_v(); - vec PixelData = cl::sycl::clamp(WriteData, MinVal, MaxVal); + vec PixelData = __sycl_ns::clamp(WriteData, MinVal, MaxVal); return PixelData.convert(); } case image_channel_type::unsigned_int16: { // convert_ushort_sat(Data) cl_uint MinVal = min_v(); cl_uint MaxVal = max_v(); - vec PixelData = cl::sycl::clamp(WriteData, MinVal, MaxVal); + vec PixelData = __sycl_ns::clamp(WriteData, MinVal, MaxVal); return PixelData.convert(); } case image_channel_type::unsigned_int32: @@ -503,7 +502,7 @@ convertWriteData(const vec WriteData, // OpenCL Spec section 6.12.14.4 does not allow writing uint4 data to an // image with channel datatype other than unsigned_int8,unsigned_int16 and // unsigned_int32. - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype of data to write - cl_uint4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); @@ -520,14 +519,14 @@ convertWriteData(const vec WriteData, // convert_char_sat(Data) cl_int MinVal = min_v(); cl_int MaxVal = max_v(); - vec PixelData = cl::sycl::clamp(WriteData, MinVal, MaxVal); + vec PixelData = __sycl_ns::clamp(WriteData, MinVal, MaxVal); return PixelData.convert(); } case image_channel_type::signed_int16: { // convert_short_sat(Data) cl_int MinVal = min_v(); cl_int MaxVal = max_v(); - vec PixelData = cl::sycl::clamp(WriteData, MinVal, MaxVal); + vec PixelData = __sycl_ns::clamp(WriteData, MinVal, MaxVal); return PixelData.convert(); } case image_channel_type::signed_int32: @@ -536,7 +535,7 @@ convertWriteData(const vec WriteData, // OpenCL Spec section 6.12.14.4 does not allow writing int4 data to an // image with channel datatype other than signed_int8,signed_int16 and // signed_int32. - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype of data to write - cl_int4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); @@ -549,7 +548,7 @@ vec processFloatDataToPixel(vec WriteData, vec Temp = WriteData * MulFactor; vec TempInInt = Temp.convert(); vec TempInIntSaturated = - cl::sycl::clamp(TempInInt, min_v(), max_v()); + __sycl_ns::clamp(TempInInt, min_v(), max_v()); return TempInIntSaturated.convert(); } @@ -575,7 +574,7 @@ convertWriteData(const vec WriteData, return processFloatDataToPixel(WriteData, 65535.0f); case image_channel_type::unorm_short_565: // TODO: Missing information in OpenCL spec. - throw cl::sycl::feature_not_supported( + throw __sycl_ns::feature_not_supported( "Currently unsupported datatype conversion from image_channel_type " "to cl_float4.", PI_INVALID_OPERATION); @@ -587,7 +586,7 @@ convertWriteData(const vec WriteData, { vec PixelData = processFloatDataToPixel(WriteData, 32.0f); - PixelData = cl::sycl::min(PixelData, static_cast(0x1f)); + PixelData = __sycl_ns::min(PixelData, static_cast(0x1f)); // Compressing the data into the first element of PixelData. // This is needed so that the data can be directly stored into the pixel // location from the first element. @@ -604,7 +603,7 @@ convertWriteData(const vec WriteData, { vec PixelData = processFloatDataToPixel(WriteData, 1023.0f); - PixelData = cl::sycl::min(PixelData, static_cast(0x3ff)); + PixelData = __sycl_ns::min(PixelData, static_cast(0x3ff)); PixelData.x() = (PixelData.x() << 20) | (PixelData.y() << 10) | PixelData.z(); return PixelData.convert(); @@ -618,7 +617,7 @@ convertWriteData(const vec WriteData, // OpenCL Spec section 6.12.14.4 does not allow writing float4 data to an // image with channel datatype - signed/unsigned_int8,signed/unsigned_int16 // and signed/unsigned_int32. - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype of data to write - cl_float4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); @@ -653,7 +652,7 @@ convertWriteData(const vec WriteData, case image_channel_type::unorm_short_555: case image_channel_type::unorm_int_101010: // TODO: Missing information in OpenCL spec. - throw cl::sycl::feature_not_supported( + throw __sycl_ns::feature_not_supported( "Currently unsupported datatype conversion from image_channel_type " "to cl_half4.", PI_INVALID_OPERATION); @@ -666,14 +665,14 @@ convertWriteData(const vec WriteData, // OpenCL Spec section 6.12.14.4 does not allow writing float4 data to an // image with channel datatype - signed/unsigned_int8,signed/unsigned_int16 // and signed/unsigned_int32. - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype of data to write - cl_float4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); case image_channel_type::fp16: return WriteData.convert(); case image_channel_type::fp32: - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Datatype of data to write - cl_float4 is incompatible with the " "image_channel_type of the image.", PI_INVALID_VALUE); @@ -1039,7 +1038,7 @@ DataT imageReadSamplerHostImpl(const CoordT &Coords, const sampler &Smpl, switch (SmplAddrMode) { case addressing_mode::mirrored_repeat: case addressing_mode::repeat: - throw cl::sycl::feature_not_supported( + throw __sycl_ns::feature_not_supported( "Sampler used with unsupported configuration of " "mirrored_repeat/repeat filtering mode with unnormalized " "coordinates. ", @@ -1118,6 +1117,6 @@ DataT imageReadSamplerHostImpl(const CoordT &Coords, const sampler &Smpl, } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #endif diff --git a/sycl/include/CL/sycl/detail/image_impl.hpp b/sycl/include/CL/sycl/detail/image_impl.hpp index b708e29e9f674..db1c1a8b1be58 100644 --- a/sycl/include/CL/sycl/detail/image_impl.hpp +++ b/sycl/include/CL/sycl/detail/image_impl.hpp @@ -19,8 +19,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // forward declarations enum class image_channel_order : unsigned int; @@ -75,7 +74,7 @@ class __SYCL_EXPORT image_impl final : public SYCLMemObjT { template using EnableIfPitchT = typename detail::enable_if_t>; static_assert(Dimensions >= 1 || Dimensions <= 3, - "Dimensions of cl::sycl::image can be 1, 2 or 3"); + "Dimensions of __sycl_ns::image can be 1, 2 or 3"); void setPitches() { size_t WHD[3] = {1, 1, 1}; // Width, Height, Depth. @@ -289,5 +288,5 @@ class __SYCL_EXPORT image_impl final : public SYCLMemObjT { size_t MSlicePitch = 0; }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/image_ocl_types.hpp b/sycl/include/CL/sycl/detail/image_ocl_types.hpp index b4121f387942b..12dcb28c9b557 100644 --- a/sycl/include/CL/sycl/detail/image_ocl_types.hpp +++ b/sycl/include/CL/sycl/detail/image_ocl_types.hpp @@ -33,23 +33,22 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // Type trait to get the associated sampled image type for a given image type. template struct sampled_opencl_image_type; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #define __SYCL_INVOKE_SPIRV_CALL_ARG1(call) \ template inline R __invoke_##call(T1 ParT1) { \ - using Ret = cl::sycl::detail::ConvertToOpenCLType_t; \ + using Ret = __sycl_ns::detail::ConvertToOpenCLType_t; \ T1 Arg1 = ParT1; \ Ret RetVar = __spirv_##call(Arg1); \ - return cl::sycl::detail::convertDataToType(RetVar); \ + return __sycl_ns::detail::convertDataToType(RetVar); \ } // The macro defines the function __invoke_ImageXXXX, @@ -62,12 +61,12 @@ template static void __invoke__ImageWrite(ImageT Img, CoordT Coords, ValT Val) { // Convert from sycl types to builtin types to get correct function mangling. - using TmpValT = cl::sycl::detail::ConvertToOpenCLType_t; - using TmpCoordT = cl::sycl::detail::ConvertToOpenCLType_t; + using TmpValT = __sycl_ns::detail::ConvertToOpenCLType_t; + using TmpCoordT = __sycl_ns::detail::ConvertToOpenCLType_t; TmpCoordT TmpCoord = - cl::sycl::detail::convertDataToType(Coords); - TmpValT TmpVal = cl::sycl::detail::convertDataToType(Val); + __sycl_ns::detail::convertDataToType(Coords); + TmpValT TmpVal = __sycl_ns::detail::convertDataToType(Val); __spirv_ImageWrite(Img, TmpCoord, TmpVal); } @@ -75,12 +74,12 @@ template static RetType __invoke__ImageRead(ImageT Img, CoordT Coords) { // Convert from sycl types to builtin types to get correct function mangling. - using TempRetT = cl::sycl::detail::ConvertToOpenCLType_t; - using TempArgT = cl::sycl::detail::ConvertToOpenCLType_t; + using TempRetT = __sycl_ns::detail::ConvertToOpenCLType_t; + using TempArgT = __sycl_ns::detail::ConvertToOpenCLType_t; - TempArgT Arg = cl::sycl::detail::convertDataToType(Coords); + TempArgT Arg = __sycl_ns::detail::convertDataToType(Coords); TempRetT Ret = __spirv_ImageRead(Img, Arg); - return cl::sycl::detail::convertDataToType(Ret); + return __sycl_ns::detail::convertDataToType(Ret); } template @@ -88,13 +87,13 @@ static RetType __invoke__ImageReadSampler(ImageT Img, CoordT Coords, const __ocl_sampler_t &Smpl) { // Convert from sycl types to builtin types to get correct function mangling. - using TempRetT = cl::sycl::detail::ConvertToOpenCLType_t; - using TempArgT = cl::sycl::detail::ConvertToOpenCLType_t; + using TempRetT = __sycl_ns::detail::ConvertToOpenCLType_t; + using TempArgT = __sycl_ns::detail::ConvertToOpenCLType_t; using SampledT = - typename cl::sycl::detail::sampled_opencl_image_type::type; + typename __sycl_ns::detail::sampled_opencl_image_type::type; TempArgT TmpCoords = - cl::sycl::detail::convertDataToType(Coords); + __sycl_ns::detail::convertDataToType(Coords); // According to validation rules(SPIR-V specification, section 2.16.1) result // of __spirv_SampledImage is allowed to be an operand of image lookup // and query instructions explicitly specified to take an operand whose @@ -110,11 +109,10 @@ static RetType __invoke__ImageReadSampler(ImageT Img, CoordT Coords, TempRetT Ret = __spirv_ImageSampleExplicitLod( __spirv_SampledImage(Img, Smpl), TmpCoords, ImageOperands::Lod, 0.0f); - return cl::sycl::detail::convertDataToType(Ret); + return __sycl_ns::detail::convertDataToType(Ret); } -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // Function to return the number of channels for Image Channel Order returned by @@ -256,8 +254,8 @@ __SYCL_IMAGETY_WRITE_2_DIM_IARRAY __SYCL_IMAGETY_DISCARD_WRITE_2_DIM_IARRAY } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #undef __SYCL_SAMPLED_AND_IMAGETY_DEFINE #undef __SYCL_INVOKE_SPIRV_CALL_ARG1 diff --git a/sycl/include/CL/sycl/detail/item_base.hpp b/sycl/include/CL/sycl/detail/item_base.hpp index 80ef0ab46df05..dd797e83c5a73 100644 --- a/sycl/include/CL/sycl/detail/item_base.hpp +++ b/sycl/include/CL/sycl/detail/item_base.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template class id; template class range; @@ -72,5 +71,5 @@ template struct ItemBase { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/kernel_desc.hpp b/sycl/include/CL/sycl/detail/kernel_desc.hpp index cabc1a0335cf6..d47a421e14fb6 100644 --- a/sycl/include/CL/sycl/detail/kernel_desc.hpp +++ b/sycl/include/CL/sycl/detail/kernel_desc.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #ifndef __SYCL_DEVICE_ONLY__ @@ -136,5 +135,5 @@ template struct KernelInfo { #endif //__SYCL_UNNAMED_LAMBDA__ } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/locked.hpp b/sycl/include/CL/sycl/detail/locked.hpp index e61c4d36c5059..2ede2e7b05753 100644 --- a/sycl/include/CL/sycl/detail/locked.hpp +++ b/sycl/include/CL/sycl/detail/locked.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { /// Represents a reference to value with appropriate lock acquired. /// Employed for acquire/release logic. Acquire action is construction @@ -35,5 +34,5 @@ namespace detail { } }; } -} -} +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/memory_manager.hpp b/sycl/include/CL/sycl/detail/memory_manager.hpp index ded30d827db37..5d158c7c3a294 100644 --- a/sycl/include/CL/sycl/detail/memory_manager.hpp +++ b/sycl/include/CL/sycl/detail/memory_manager.hpp @@ -18,8 +18,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class queue_impl; @@ -158,5 +157,5 @@ class __SYCL_EXPORT MemoryManager { RT::PiEvent &OutEvent); }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/os_util.hpp b/sycl/include/CL/sycl/detail/os_util.hpp index 55b41b28b640c..4ae9b5abb67f8 100644 --- a/sycl/include/CL/sycl/detail/os_util.hpp +++ b/sycl/include/CL/sycl/detail/os_util.hpp @@ -39,8 +39,7 @@ #error "Unsupported compiler or OS" #endif // _WIN32 -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { /// Uniquely identifies an operating system module (executable or a dynamic @@ -99,5 +98,5 @@ class __SYCL_EXPORT OSUtil { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/pi.hpp b/sycl/include/CL/sycl/detail/pi.hpp index 3651c67cf0e56..4a1d6b3f5e8c2 100644 --- a/sycl/include/CL/sycl/detail/pi.hpp +++ b/sycl/include/CL/sycl/detail/pi.hpp @@ -32,8 +32,7 @@ struct trace_event_data_t; } #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { class context; @@ -45,7 +44,7 @@ enum class PiApiKind { }; class plugin; -template +template <__sycl_ns::backend BE> __SYCL_EXPORT void *getPluginOpaqueData(void *opaquedata_arg); namespace pi { @@ -94,7 +93,7 @@ void handleUnknownParamName(const char *functionName, T parameter) { // GetInfo functions. It will print the name of the function that invoked it // and the value of the unknown enumerator. #define __SYCL_PI_HANDLE_UNKNOWN_PARAM_NAME(parameter) \ - { cl::sycl::detail::pi::handleUnknownParamName(__func__, parameter); } + { __sycl_ns::detail::pi::handleUnknownParamName(__func__, parameter); } using PiPlugin = ::pi_plugin; using PiResult = ::pi_result; @@ -123,7 +122,7 @@ using PiMemObjectType = ::pi_mem_type; using PiMemImageChannelOrder = ::pi_image_channel_order; using PiMemImageChannelType = ::pi_image_channel_type; -__SYCL_EXPORT void contextSetExtendedDeleter(const cl::sycl::context &constext, +__SYCL_EXPORT void contextSetExtendedDeleter(const __sycl_ns::context &constext, pi_context_extended_deleter func, void *user_data); @@ -383,7 +382,7 @@ PiDeviceBinaryType getBinaryImageFormat(const unsigned char *ImgData, } // namespace pi -namespace RT = cl::sycl::detail::pi; +namespace RT = __sycl_ns::detail::pi; // Workaround for build with GCC 5.x // An explicit specialization shall be declared in the namespace block. @@ -414,9 +413,9 @@ template <> inline pi::PiDevice cast(cl_device_id) { } // namespace detail // For shortness of using PI from the top-level sycl files. -namespace RT = cl::sycl::detail::pi; +namespace RT = __sycl_ns::detail::pi; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #undef _PI_API diff --git a/sycl/include/CL/sycl/detail/property_helper.hpp b/sycl/include/CL/sycl/detail/property_helper.hpp index d87e03c53167d..9608b9dc61895 100644 --- a/sycl/include/CL/sycl/detail/property_helper.hpp +++ b/sycl/include/CL/sycl/detail/property_helper.hpp @@ -10,8 +10,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { @@ -85,5 +84,5 @@ template class PropertyWithData : public PropertyWithDataBase { } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/property_list_base.hpp b/sycl/include/CL/sycl/detail/property_list_base.hpp index 0bdea3e85b7ae..46340cae0ddc3 100644 --- a/sycl/include/CL/sycl/detail/property_list_base.hpp +++ b/sycl/include/CL/sycl/detail/property_list_base.hpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class PropertyListBase { protected: @@ -109,5 +108,5 @@ class PropertyListBase { std::vector> MPropsWithData; }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/spec_const_integration.hpp b/sycl/include/CL/sycl/detail/spec_const_integration.hpp index 056e197eeac72..c2c516b4d036f 100644 --- a/sycl/include/CL/sycl/detail/spec_const_integration.hpp +++ b/sycl/include/CL/sycl/detail/spec_const_integration.hpp @@ -11,8 +11,7 @@ // This header file must not be included to any DPC++ headers. // This header file should only be included to integration footer. -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #if __cplusplus >= 201703L @@ -24,5 +23,5 @@ template const char *get_spec_constant_symbolic_ID() { #endif } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/spinlock.hpp b/sycl/include/CL/sycl/detail/spinlock.hpp index 1b1585bc45fdf..46ef3ff602378 100644 --- a/sycl/include/CL/sycl/detail/spinlock.hpp +++ b/sycl/include/CL/sycl/detail/spinlock.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { /// SpinLock is a synchronization primitive, that uses atomic variable and /// causes thread trying acquire lock wait in loop while repeatedly check if @@ -36,5 +35,5 @@ class SpinLock { std::atomic_flag MLock = ATOMIC_FLAG_INIT; }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/spirv.hpp b/sycl/include/CL/sycl/detail/spirv.hpp index 19963c7d3dcb3..85ba7d4671d48 100644 --- a/sycl/include/CL/sycl/detail/spirv.hpp +++ b/sycl/include/CL/sycl/detail/spirv.hpp @@ -19,8 +19,7 @@ #include #ifdef __SYCL_DEVICE_ONLY__ -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { struct sub_group; @@ -39,7 +38,7 @@ template struct group_scope> { static constexpr __spv::Scope::Flag value = __spv::Scope::Flag::Workgroup; }; -template <> struct group_scope<::cl::sycl::ext::oneapi::sub_group> { +template <> struct group_scope<__sycl_ns::ext::oneapi::sub_group> { static constexpr __spv::Scope::Flag value = __spv::Scope::Flag::Subgroup; }; @@ -129,7 +128,7 @@ using EnableIfGenericBroadcast = detail::enable_if_t< // Work-group supports any integral type // Sub-group currently supports only uint32_t template struct GroupId { using type = size_t; }; -template <> struct GroupId<::cl::sycl::ext::oneapi::sub_group> { +template <> struct GroupId<__sycl_ns::ext::oneapi::sub_group> { using type = uint32_t; }; template @@ -747,6 +746,6 @@ EnableIfGenericShuffle SubgroupShuffleUp(T x, id<1> local_id) { } // namespace spirv } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #endif // __SYCL_DEVICE_ONLY__ diff --git a/sycl/include/CL/sycl/detail/stl_type_traits.hpp b/sycl/include/CL/sycl/detail/stl_type_traits.hpp index 03403b7ba063e..fd9b50a6eef28 100644 --- a/sycl/include/CL/sycl/detail/stl_type_traits.hpp +++ b/sycl/include/CL/sycl/detail/stl_type_traits.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // Type traits identical to those in std in newer versions. Can be removed when @@ -79,5 +78,5 @@ struct is_output_iterator> { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/sycl_mem_obj_allocator.hpp b/sycl/include/CL/sycl/detail/sycl_mem_obj_allocator.hpp index 827a54ff9f6af..60ec2343ffdf2 100644 --- a/sycl/include/CL/sycl/detail/sycl_mem_obj_allocator.hpp +++ b/sycl/include/CL/sycl/detail/sycl_mem_obj_allocator.hpp @@ -8,8 +8,9 @@ #pragma once -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +#include + +__SYCL_OPEN_NS() { namespace detail { template @@ -87,5 +88,5 @@ class SYCLMemObjAllocatorHolder : public SYCLMemObjAllocator { std::size_t MValueSize; }; } // namespace detail -} // namespace sycl -} +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp b/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp index c37d4945f1e9c..990623aeb9697 100644 --- a/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp +++ b/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { @@ -77,5 +76,5 @@ class SYCLMemObjI { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp b/sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp index 5d16eb6034bd8..cf4e3820253ae 100644 --- a/sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp +++ b/sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp @@ -23,8 +23,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // Forward declarations @@ -342,5 +341,5 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/tuple.hpp b/sycl/include/CL/sycl/detail/tuple.hpp index 3beefa9074e1f..0368170a00c0f 100644 --- a/sycl/include/CL/sycl/detail/tuple.hpp +++ b/sycl/include/CL/sycl/detail/tuple.hpp @@ -15,8 +15,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template struct tuple; @@ -189,21 +188,21 @@ template <> struct tuple<> { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { template constexpr typename tuple_element>::type & -get(cl::sycl::detail::tuple &Arg) noexcept { - return cl::sycl::detail::get()(Arg); +get(__sycl_ns::detail::tuple &Arg) noexcept { + return __sycl_ns::detail::get()(Arg); } template constexpr typename tuple_element>::type const & -get(const cl::sycl::detail::tuple &Arg) noexcept { - return cl::sycl::detail::get()(Arg); +get(const __sycl_ns::detail::tuple &Arg) noexcept { + return __sycl_ns::detail::get()(Arg); } } // namespace std diff --git a/sycl/include/CL/sycl/detail/type_list.hpp b/sycl/include/CL/sycl/detail/type_list.hpp index 2caeabe384e58..e8e7f22bc38e0 100644 --- a/sycl/include/CL/sycl/detail/type_list.hpp +++ b/sycl/include/CL/sycl/detail/type_list.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template using head_t = typename T::head; @@ -134,5 +133,5 @@ template using find_twice_as_large_type_t = find_type_t; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/type_traits.hpp b/sycl/include/CL/sycl/detail/type_traits.hpp index 92955d2bfa2b2..7efb94d988f37 100644 --- a/sycl/include/CL/sycl/detail/type_traits.hpp +++ b/sycl/include/CL/sycl/detail/type_traits.hpp @@ -17,8 +17,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template class group; namespace ext { namespace oneapi { @@ -210,7 +209,7 @@ using is_gen_based_on_type_sizeof = template struct is_vec : std::false_type {}; template -struct is_vec> : std::true_type {}; +struct is_vec<__sycl_ns::vec> : std::true_type {}; // is_integral template @@ -359,5 +358,5 @@ template struct function_traits { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/usm_impl.hpp b/sycl/include/CL/sycl/detail/usm_impl.hpp index 8be99fede9059..c0ad2097f7d98 100644 --- a/sycl/include/CL/sycl/detail/usm_impl.hpp +++ b/sycl/include/CL/sycl/detail/usm_impl.hpp @@ -10,22 +10,21 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace usm { __SYCL_EXPORT void *alignedAlloc(size_t Alignment, size_t Bytes, const context &Ctxt, const device &Dev, - cl::sycl::usm::alloc Kind); + __sycl_ns::usm::alloc Kind); __SYCL_EXPORT void *alignedAllocHost(size_t Alignment, size_t Bytes, const context &Ctxt, - cl::sycl::usm::alloc Kind); + __sycl_ns::usm::alloc Kind); __SYCL_EXPORT void free(void *Ptr, const context &Ctxt); } // namespace usm } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/detail/util.hpp b/sycl/include/CL/sycl/detail/util.hpp index 9b6095fa75b9e..a9c20ce396411 100644 --- a/sycl/include/CL/sycl/detail/util.hpp +++ b/sycl/include/CL/sycl/detail/util.hpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { /// Groups and provides access to all the locks used the SYCL runtime. @@ -56,7 +55,7 @@ struct CmpCStr { using SerializedObj = std::vector; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #endif //__SYCL_DEVICE_ONLY diff --git a/sycl/include/CL/sycl/device.hpp b/sycl/include/CL/sycl/device.hpp index 1a2a71ce4552b..5896a43364f20 100644 --- a/sycl/include/CL/sycl/device.hpp +++ b/sycl/include/CL/sycl/device.hpp @@ -19,8 +19,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations class device_selector; namespace detail { @@ -214,14 +213,14 @@ class __SYCL_EXPORT device { friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj); }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::device &Device) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(Device)); +template <> struct hash<__sycl_ns::device> { + size_t operator()(const __sycl_ns::device &Device) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(Device)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/device_event.hpp b/sycl/include/CL/sycl/device_event.hpp index 7e19a9e23f133..31ea2a32ce0ff 100644 --- a/sycl/include/CL/sycl/device_event.hpp +++ b/sycl/include/CL/sycl/device_event.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { /// Encapsulates a single SYCL device event which is available only within SYCL /// kernel functions and can be used to wait for asynchronous operations within @@ -36,5 +35,5 @@ class device_event { } }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/device_selector.hpp b/sycl/include/CL/sycl/device_selector.hpp index 17b1503488a36..3d6c49e83adef 100644 --- a/sycl/include/CL/sycl/device_selector.hpp +++ b/sycl/include/CL/sycl/device_selector.hpp @@ -13,8 +13,7 @@ // 4.6.1 Device selection class -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations class device; @@ -87,5 +86,5 @@ class __SYCL_EXPORT host_selector : public device_selector { public: int operator()(const device &dev) const override; }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/event.hpp b/sycl/include/CL/sycl/event.hpp index 641d25f83ee02..6f1533a04e5f2 100644 --- a/sycl/include/CL/sycl/event.hpp +++ b/sycl/include/CL/sycl/event.hpp @@ -16,8 +16,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration class context; namespace detail { @@ -148,14 +147,14 @@ class __SYCL_EXPORT event { friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj); }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::event &e) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(e)); +template <> struct hash<__sycl_ns::event> { + size_t operator()(const __sycl_ns::event &e) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(e)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/exception.hpp b/sycl/include/CL/sycl/exception.hpp index e512862d336f9..db2e636592bae 100644 --- a/sycl/include/CL/sycl/exception.hpp +++ b/sycl/include/CL/sycl/exception.hpp @@ -18,8 +18,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration class context; @@ -202,9 +201,9 @@ class __SYCL_EXPORT SYCLCategory : public std::error_category { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct is_error_code_enum : true_type {}; +template <> struct is_error_code_enum<__sycl_ns::errc> : true_type {}; } // namespace std diff --git a/sycl/include/CL/sycl/exception_list.hpp b/sycl/include/CL/sycl/exception_list.hpp index 0528dacaa7d41..d22a7f7dfea2f 100644 --- a/sycl/include/CL/sycl/exception_list.hpp +++ b/sycl/include/CL/sycl/exception_list.hpp @@ -16,8 +16,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration namespace detail { @@ -50,7 +49,7 @@ class __SYCL_EXPORT exception_list { std::vector MList; }; -using async_handler = std::function; +using async_handler = std::function; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/feature_test.hpp b/sycl/include/CL/sycl/feature_test.hpp index 4625cfa06fed7..d107c42a4edaa 100644 --- a/sycl/include/CL/sycl/feature_test.hpp +++ b/sycl/include/CL/sycl/feature_test.hpp @@ -7,9 +7,6 @@ // ===--------------------------------------------------------------------=== // #pragma once -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { - // Feature test macro definitions // TODO: Move these feature-test macros to compiler driver. @@ -24,6 +21,3 @@ namespace sycl { #define SYCL_EXT_ONEAPI_MATRIX 2 #endif #define SYCL_EXT_INTEL_BF16_CONVERSION 1 - -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) diff --git a/sycl/include/CL/sycl/functional.hpp b/sycl/include/CL/sycl/functional.hpp index 1549945b23a56..1d187b1432e66 100644 --- a/sycl/include/CL/sycl/functional.hpp +++ b/sycl/include/CL/sycl/functional.hpp @@ -9,8 +9,7 @@ #pragma once #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template using plus = std::plus; template using multiplies = std::multiplies; @@ -53,5 +52,5 @@ template <> struct maximum { } }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) \ No newline at end of file +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() \ No newline at end of file diff --git a/sycl/include/CL/sycl/group.hpp b/sycl/include/CL/sycl/group.hpp index d138842b08399..6e2d25d49e333 100644 --- a/sycl/include/CL/sycl/group.hpp +++ b/sycl/include/CL/sycl/group.hpp @@ -24,8 +24,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class Builder; @@ -451,5 +450,5 @@ template group this_group() { } // namespace experimental } // namespace oneapi } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/group_algorithm.hpp b/sycl/include/CL/sycl/group_algorithm.hpp index 8277f2d0037be..9a3b25ef95c86 100644 --- a/sycl/include/CL/sycl/group_algorithm.hpp +++ b/sycl/include/CL/sycl/group_algorithm.hpp @@ -19,8 +19,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // ---- linear_id_to_id @@ -68,7 +67,7 @@ typename Group::linear_id_type get_local_linear_id(Group g); #define __SYCL_GROUP_GET_LOCAL_LINEAR_ID(D) \ template <> \ group::linear_id_type get_local_linear_id>(group) { \ - nd_item it = cl::sycl::detail::Builder::getNDItem(); \ + nd_item it = __sycl_ns::detail::Builder::getNDItem(); \ return it.get_local_linear_id(); \ } __SYCL_GROUP_GET_LOCAL_LINEAR_ID(1); @@ -873,5 +872,5 @@ group_barrier(Group, memory_scope FenceScope = Group::fence_scope) { #endif } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/group_local_memory.hpp b/sycl/include/CL/sycl/group_local_memory.hpp index 6478502629563..98bd5108a06a6 100644 --- a/sycl/include/CL/sycl/group_local_memory.hpp +++ b/sycl/include/CL/sycl/group_local_memory.hpp @@ -12,8 +12,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template __SYCL_DEPRECATED( "use sycl::ext::oneapi::group_local_memory_for_overwrite instead") @@ -33,5 +32,5 @@ std::enable_if_t< return sycl::ext::oneapi::group_local_memory( g, std::forward(args)...); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/h_item.hpp b/sycl/include/CL/sycl/h_item.hpp index 8d27bae1ca6af..33218829bca15 100644 --- a/sycl/include/CL/sycl/h_item.hpp +++ b/sycl/include/CL/sycl/h_item.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class Builder; @@ -134,5 +133,5 @@ template class h_item { item logicalLocalItem; }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/half_type.hpp b/sycl/include/CL/sycl/half_type.hpp index af607dc1baee6..32fa55bfd3c5f 100644 --- a/sycl/include/CL/sycl/half_type.hpp +++ b/sycl/include/CL/sycl/half_type.hpp @@ -33,8 +33,7 @@ #define __SYCL_CONSTEXPR_HALF #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { inline __SYCL_CONSTEXPR_HALF uint16_t float2Half(const float &Val) { @@ -266,7 +265,7 @@ class half; // Several aliases are defined below: // - StorageT: actual representation of half data type. It is used by scalar -// half values and by 'cl::sycl::vec' class. On device side, it points to some +// half values and by 'sycl::vec' class. On device side, it points to some // native half data type, while on host some custom data type is used to // emulate operations of 16-bit floating-point values // @@ -402,21 +401,21 @@ inline float cast_if_host_half(half_impl::half val) { } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() // Partial specialization of some functions in namespace `std` namespace std { -// Partial specialization of `std::hash` -template <> struct hash { - size_t operator()(cl::sycl::half const &Key) const noexcept { +// Partial specialization of `std::hash` +template <> struct hash<__sycl_ns::half> { + size_t operator()(__sycl_ns::half const &Key) const noexcept { return hash{}(reinterpret_cast(Key)); } }; -// Partial specialization of `std::numeric` -template <> struct numeric_limits { +// Partial specialization of `std::numeric` +template <> struct numeric_limits<__sycl_ns::half> { // All following values are either calculated based on description of each // function/value on https://en.cppreference.com/w/cpp/types/numeric_limits, // or cl_platform.h. @@ -444,56 +443,56 @@ template <> struct numeric_limits { static constexpr bool is_iec559 = true; static constexpr float_round_style round_style = round_to_nearest; - static __SYCL_CONSTEXPR_HALF const cl::sycl::half(min)() noexcept { + static __SYCL_CONSTEXPR_HALF const __sycl_ns::half(min)() noexcept { return 6.103515625e-05f; // half minimum value } - static __SYCL_CONSTEXPR_HALF const cl::sycl::half(max)() noexcept { + static __SYCL_CONSTEXPR_HALF const __sycl_ns::half(max)() noexcept { return 65504.0f; // half maximum value } - static __SYCL_CONSTEXPR_HALF const cl::sycl::half lowest() noexcept { + static __SYCL_CONSTEXPR_HALF const __sycl_ns::half lowest() noexcept { return -65504.0f; // -1*(half maximum value) } - static __SYCL_CONSTEXPR_HALF const cl::sycl::half epsilon() noexcept { + static __SYCL_CONSTEXPR_HALF const __sycl_ns::half epsilon() noexcept { return 9.765625e-04f; // half epsilon } - static __SYCL_CONSTEXPR_HALF const cl::sycl::half round_error() noexcept { + static __SYCL_CONSTEXPR_HALF const __sycl_ns::half round_error() noexcept { return 0.5f; } - static constexpr const cl::sycl::half infinity() noexcept { + static constexpr const __sycl_ns::half infinity() noexcept { #ifdef __SYCL_DEVICE_ONLY__ return __builtin_huge_valf(); #else - return cl::sycl::detail::host_half_impl::half_v2( + return __sycl_ns::detail::host_half_impl::half_v2( static_cast(0x7C00)); #endif } - static __SYCL_CONSTEXPR_HALF const cl::sycl::half quiet_NaN() noexcept { + static __SYCL_CONSTEXPR_HALF const __sycl_ns::half quiet_NaN() noexcept { return __builtin_nanf(""); } - static __SYCL_CONSTEXPR_HALF const cl::sycl::half signaling_NaN() noexcept { + static __SYCL_CONSTEXPR_HALF const __sycl_ns::half signaling_NaN() noexcept { return __builtin_nansf(""); } - static __SYCL_CONSTEXPR_HALF const cl::sycl::half denorm_min() noexcept { + static __SYCL_CONSTEXPR_HALF const __sycl_ns::half denorm_min() noexcept { return 5.96046e-08f; } }; } // namespace std -inline std::ostream &operator<<(std::ostream &O, cl::sycl::half const &rhs) { +inline std::ostream &operator<<(std::ostream &O, __sycl_ns::half const &rhs) { O << static_cast(rhs); return O; } -inline std::istream &operator>>(std::istream &I, cl::sycl::half &rhs) { +inline std::istream &operator>>(std::istream &I, __sycl_ns::half &rhs) { float ValFloat = 0.0f; I >> ValFloat; rhs = ValFloat; diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index b5881d3a2b4d4..181518de48a63 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -40,38 +40,37 @@ #define __SYCL_NONCONST_FUNCTOR__ #endif -template +template class __fill; template class __usmfill; template + __sycl_ns::access::mode AccessMode, + __sycl_ns::access::target AccessTarget, + __sycl_ns::access::placeholder IsPlaceholder> class __copyAcc2Ptr; template + __sycl_ns::access::mode AccessMode, + __sycl_ns::access::target AccessTarget, + __sycl_ns::access::placeholder IsPlaceholder> class __copyPtr2Acc; -template +template class __copyAcc2Acc; // For unit testing purposes class MockHandler; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration @@ -207,8 +206,8 @@ template class reduction_impl; -using cl::sycl::detail::enable_if_t; -using cl::sycl::detail::queue_impl; +using __sycl_ns::detail::enable_if_t; +using __sycl_ns::detail::queue_impl; template void reduCGFunc(handler &CGH, KernelType KernelFunc, const range &Range, @@ -527,7 +526,7 @@ class __SYCL_EXPORT handler { if (detail::isKernelLambdaCallableWithKernelHandler() && MIsHost) { - throw cl::sycl::feature_not_supported( + throw __sycl_ns::feature_not_supported( "kernel_handler is not yet supported by host device.", PI_INVALID_OPERATION); } @@ -2462,5 +2461,5 @@ class __SYCL_EXPORT handler { } } }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/id.hpp b/sycl/include/CL/sycl/id.hpp index 306a10d655100..f78e6175058cd 100644 --- a/sycl/include/CL/sycl/id.hpp +++ b/sycl/include/CL/sycl/id.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template class range; template class item; @@ -312,5 +311,5 @@ template id this_id() { } // namespace experimental } // namespace oneapi } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/image.hpp b/sycl/include/CL/sycl/image.hpp index d267d0635dff7..b809699d961d6 100644 --- a/sycl/include/CL/sycl/image.hpp +++ b/sycl/include/CL/sycl/image.hpp @@ -20,8 +20,7 @@ // sRGB Extension Support #define SYCL_EXT_ONEAPI_SRGB 1 -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { enum class image_channel_order : unsigned int { a = 0, @@ -72,7 +71,7 @@ using image_allocator = detail::aligned_allocator; /// \sa sampler /// /// \ingroup sycl_api -template +template class image { public: image(image_channel_order Order, image_channel_type Type, @@ -313,15 +312,15 @@ class image { friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject); }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { template -struct hash> { - size_t operator()(const cl::sycl::image &I) const { - return hash>>()( - cl::sycl::detail::getSyclObjImpl(I)); +struct hash<__sycl_ns::image> { + size_t operator()(const __sycl_ns::image &I) const { + return hash>>()( + __sycl_ns::detail::getSyclObjImpl(I)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/info/context_traits.def b/sycl/include/CL/sycl/info/context_traits.def index 61daa39233b58..a5777e977f13d 100644 --- a/sycl/include/CL/sycl/info/context_traits.def +++ b/sycl/include/CL/sycl/info/context_traits.def @@ -1,4 +1,4 @@ __SYCL_PARAM_TRAITS_SPEC(context, reference_count, cl_uint) -__SYCL_PARAM_TRAITS_SPEC(context, platform, cl::sycl::platform) -__SYCL_PARAM_TRAITS_SPEC(context, devices, std::vector) -__SYCL_PARAM_TRAITS_SPEC(context, atomic_memory_order_capabilities, std::vector) +__SYCL_PARAM_TRAITS_SPEC(context, platform, __sycl_ns::platform) +__SYCL_PARAM_TRAITS_SPEC(context, devices, std::vector<__sycl_ns::device>) +__SYCL_PARAM_TRAITS_SPEC(context, atomic_memory_order_capabilities, std::vector<__sycl_ns::memory_order>) diff --git a/sycl/include/CL/sycl/info/device_traits.def b/sycl/include/CL/sycl/info/device_traits.def index 208d06f8b31ca..27989c3daa396 100644 --- a/sycl/include/CL/sycl/info/device_traits.def +++ b/sycl/include/CL/sycl/info/device_traits.def @@ -24,7 +24,7 @@ __SYCL_PARAM_TRAITS_SPEC(device, max_mem_alloc_size, pi_uint64) __SYCL_PARAM_TRAITS_SPEC(device, image_support, bool) __SYCL_PARAM_TRAITS_SPEC(device, atomic64, bool) __SYCL_PARAM_TRAITS_SPEC(device, atomic_memory_order_capabilities, - std::vector) + std::vector<__sycl_ns::memory_order>) __SYCL_PARAM_TRAITS_SPEC(device, max_read_image_args, pi_uint32) __SYCL_PARAM_TRAITS_SPEC(device, max_write_image_args, pi_uint32) __SYCL_PARAM_TRAITS_SPEC(device, image2d_max_width, size_t) @@ -59,7 +59,7 @@ __SYCL_PARAM_TRAITS_SPEC(device, execution_capabilities, std::vector) __SYCL_PARAM_TRAITS_SPEC(device, queue_profiling, bool) __SYCL_PARAM_TRAITS_SPEC(device, built_in_kernels, std::vector) -__SYCL_PARAM_TRAITS_SPEC(device, platform, cl::sycl::platform) +__SYCL_PARAM_TRAITS_SPEC(device, platform, __sycl_ns::platform) __SYCL_PARAM_TRAITS_SPEC(device, name, std::string) __SYCL_PARAM_TRAITS_SPEC(device, vendor, std::string) __SYCL_PARAM_TRAITS_SPEC(device, driver_version, std::string) @@ -69,7 +69,7 @@ __SYCL_PARAM_TRAITS_SPEC(device, opencl_c_version, std::string) __SYCL_PARAM_TRAITS_SPEC(device, extensions, std::vector) __SYCL_PARAM_TRAITS_SPEC(device, printf_buffer_size, size_t) __SYCL_PARAM_TRAITS_SPEC(device, preferred_interop_user_sync, bool) -__SYCL_PARAM_TRAITS_SPEC(device, parent_device, cl::sycl::device) +__SYCL_PARAM_TRAITS_SPEC(device, parent_device, __sycl_ns::device) __SYCL_PARAM_TRAITS_SPEC(device, partition_max_sub_devices, pi_uint32) __SYCL_PARAM_TRAITS_SPEC(device, partition_properties, std::vector) diff --git a/sycl/include/CL/sycl/info/info_desc.hpp b/sycl/include/CL/sycl/info/info_desc.hpp index 2e7ad37c7547d..c87aa89cd34bc 100644 --- a/sycl/include/CL/sycl/info/info_desc.hpp +++ b/sycl/include/CL/sycl/info/info_desc.hpp @@ -12,8 +12,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { class program; class device; @@ -336,5 +335,5 @@ template struct compatibility_param_traits {}; #undef __SYCL_PARAM_TRAITS_SPEC_WITH_INPUT } // namespace info -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/info/kernel_device_specific_traits.def b/sycl/include/CL/sycl/info/kernel_device_specific_traits.def index 8ff826fd95ac4..34bd0cf36b890 100644 --- a/sycl/include/CL/sycl/info/kernel_device_specific_traits.def +++ b/sycl/include/CL/sycl/info/kernel_device_specific_traits.def @@ -1,12 +1,12 @@ __SYCL_PARAM_TRAITS_SPEC(kernel_device_specific, compile_work_group_size, - cl::sycl::range<3>) -__SYCL_PARAM_TRAITS_SPEC(kernel_device_specific, global_work_size, cl::sycl::range<3>) + __sycl_ns::range<3>) +__SYCL_PARAM_TRAITS_SPEC(kernel_device_specific, global_work_size, __sycl_ns::range<3>) __SYCL_PARAM_TRAITS_SPEC(kernel_device_specific, preferred_work_group_size_multiple, size_t) __SYCL_PARAM_TRAITS_SPEC(kernel_device_specific, private_mem_size, cl_ulong) __SYCL_PARAM_TRAITS_SPEC(kernel_device_specific, work_group_size, size_t) __SYCL_PARAM_TRAITS_SPEC_WITH_INPUT(kernel_device_specific, max_sub_group_size, - uint32_t, cl::sycl::range<3>) + uint32_t, __sycl_ns::range<3>) __SYCL_PARAM_TRAITS_SPEC(kernel_device_specific, max_num_sub_groups, uint32_t) __SYCL_PARAM_TRAITS_SPEC(kernel_device_specific, compile_num_sub_groups, uint32_t) __SYCL_PARAM_TRAITS_SPEC(kernel_device_specific, compile_sub_group_size, uint32_t) diff --git a/sycl/include/CL/sycl/info/kernel_sub_group_traits.def b/sycl/include/CL/sycl/info/kernel_sub_group_traits.def index a396d5ceb295f..1644b5f7f0c1f 100644 --- a/sycl/include/CL/sycl/info/kernel_sub_group_traits.def +++ b/sycl/include/CL/sycl/info/kernel_sub_group_traits.def @@ -1,5 +1,5 @@ __SYCL_PARAM_TRAITS_SPEC_WITH_INPUT(kernel_sub_group, max_sub_group_size, - uint32_t, cl::sycl::range<3>) + uint32_t, __sycl_ns::range<3>) __SYCL_PARAM_TRAITS_SPEC(kernel_sub_group, max_num_sub_groups, uint32_t) __SYCL_PARAM_TRAITS_SPEC(kernel_sub_group, compile_num_sub_groups, uint32_t) __SYCL_PARAM_TRAITS_SPEC(kernel_sub_group, compile_sub_group_size, uint32_t) diff --git a/sycl/include/CL/sycl/info/kernel_traits.def b/sycl/include/CL/sycl/info/kernel_traits.def index 789f33ce577fc..bbc7bd34c65c7 100644 --- a/sycl/include/CL/sycl/info/kernel_traits.def +++ b/sycl/include/CL/sycl/info/kernel_traits.def @@ -2,6 +2,6 @@ __SYCL_PARAM_TRAITS_SPEC(kernel, function_name, std::string) __SYCL_PARAM_TRAITS_SPEC(kernel, num_args, cl_uint) __SYCL_PARAM_TRAITS_SPEC(kernel, reference_count, cl_uint) __SYCL_PARAM_TRAITS_SPEC(kernel, attributes, std::string) -__SYCL_PARAM_TRAITS_SPEC(kernel, context, cl::sycl::context) -__SYCL_PARAM_TRAITS_SPEC(kernel, program, cl::sycl::program) +__SYCL_PARAM_TRAITS_SPEC(kernel, context, __sycl_ns::context) +__SYCL_PARAM_TRAITS_SPEC(kernel, program, __sycl_ns::program) diff --git a/sycl/include/CL/sycl/info/kernel_work_group_traits.def b/sycl/include/CL/sycl/info/kernel_work_group_traits.def index 18edc8c1bc71e..06b75447c7c27 100644 --- a/sycl/include/CL/sycl/info/kernel_work_group_traits.def +++ b/sycl/include/CL/sycl/info/kernel_work_group_traits.def @@ -1,6 +1,6 @@ __SYCL_PARAM_TRAITS_SPEC(kernel_work_group, compile_work_group_size, - cl::sycl::range<3>) -__SYCL_PARAM_TRAITS_SPEC(kernel_work_group, global_work_size, cl::sycl::range<3>) + __sycl_ns::range<3>) +__SYCL_PARAM_TRAITS_SPEC(kernel_work_group, global_work_size, __sycl_ns::range<3>) __SYCL_PARAM_TRAITS_SPEC(kernel_work_group, preferred_work_group_size_multiple, size_t) __SYCL_PARAM_TRAITS_SPEC(kernel_work_group, private_mem_size, cl_ulong) __SYCL_PARAM_TRAITS_SPEC(kernel_work_group, work_group_size, size_t) diff --git a/sycl/include/CL/sycl/info/program_traits.def b/sycl/include/CL/sycl/info/program_traits.def index 48de0346c1458..6389e48851a02 100644 --- a/sycl/include/CL/sycl/info/program_traits.def +++ b/sycl/include/CL/sycl/info/program_traits.def @@ -1,4 +1,4 @@ -__SYCL_PARAM_TRAITS_SPEC(program, context, cl::sycl::context) -__SYCL_PARAM_TRAITS_SPEC(program, devices, std::vector) +__SYCL_PARAM_TRAITS_SPEC(program, context, __sycl_ns::context) +__SYCL_PARAM_TRAITS_SPEC(program, devices, std::vector<__sycl_ns::device>) __SYCL_PARAM_TRAITS_SPEC(program, reference_count, cl_uint) diff --git a/sycl/include/CL/sycl/info/queue_traits.def b/sycl/include/CL/sycl/info/queue_traits.def index cd3b614808dab..6c548895d4b21 100644 --- a/sycl/include/CL/sycl/info/queue_traits.def +++ b/sycl/include/CL/sycl/info/queue_traits.def @@ -1,4 +1,4 @@ __SYCL_PARAM_TRAITS_SPEC(queue, reference_count, cl_uint) -__SYCL_PARAM_TRAITS_SPEC(queue, context, cl::sycl::context) -__SYCL_PARAM_TRAITS_SPEC(queue, device, cl::sycl::device) +__SYCL_PARAM_TRAITS_SPEC(queue, context, __sycl_ns::context) +__SYCL_PARAM_TRAITS_SPEC(queue, device, __sycl_ns::device) diff --git a/sycl/include/CL/sycl/interop_handle.hpp b/sycl/include/CL/sycl/interop_handle.hpp index 9d1e537a127fd..66e9bbe107341 100644 --- a/sycl/include/CL/sycl/interop_handle.hpp +++ b/sycl/include/CL/sycl/interop_handle.hpp @@ -18,8 +18,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class AccessorBaseHost; @@ -46,7 +45,7 @@ class interop_handle { /// command group, and returns the underlying OpenCL memory object that is /// used by the SYCL runtime. If the accessor passed as parameter is not part /// of the command group requirements (e.g. it is an unregistered placeholder - /// accessor), the exception `cl::sycl::invalid_object` is thrown + /// accessor), the exception `sycl::invalid_object` is thrown /// asynchronously. template @@ -191,5 +190,5 @@ class interop_handle { std::vector MMemObjs; }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/interop_handler.hpp b/sycl/include/CL/sycl/interop_handler.hpp index 35c6cf88c6760..56b8ddffbc20e 100644 --- a/sycl/include/CL/sycl/interop_handler.hpp +++ b/sycl/include/CL/sycl/interop_handler.hpp @@ -10,8 +10,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Interoperability handler // @@ -69,5 +68,5 @@ class interop_handler { __SYCL_EXPORT pi_native_handle GetNativeQueue() const; }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/item.hpp b/sycl/include/CL/sycl/item.hpp index 64be1f9b360f3..8a5b0b7b32e2e 100644 --- a/sycl/include/CL/sycl/item.hpp +++ b/sycl/include/CL/sycl/item.hpp @@ -17,8 +17,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class Builder; } @@ -155,5 +154,5 @@ template item this_item() { } // namespace experimental } // namespace oneapi } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/kernel.hpp b/sycl/include/CL/sycl/kernel.hpp index 9104b8f523989..3771a580e5cff 100644 --- a/sycl/include/CL/sycl/kernel.hpp +++ b/sycl/include/CL/sycl/kernel.hpp @@ -17,8 +17,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration class program; class context; @@ -223,14 +222,14 @@ class __SYCL_EXPORT kernel { template friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj); }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::kernel &Kernel) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(Kernel)); +template <> struct hash<__sycl_ns::kernel> { + size_t operator()(const __sycl_ns::kernel &Kernel) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(Kernel)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/kernel_bundle.hpp b/sycl/include/CL/sycl/kernel_bundle.hpp index 8f67aaf1034f4..52d1928c41a4b 100644 --- a/sycl/include/CL/sycl/kernel_bundle.hpp +++ b/sycl/include/CL/sycl/kernel_bundle.hpp @@ -21,8 +21,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration template class backend_traits; @@ -671,30 +670,30 @@ build(const kernel_bundle &InputBundle, return build(InputBundle, InputBundle.get_devices(), PropList); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::kernel_id &KernelID) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(KernelID)); +template <> struct hash<__sycl_ns::kernel_id> { + size_t operator()(const __sycl_ns::kernel_id &KernelID) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(KernelID)); } }; -template -struct hash> { - size_t operator()(const cl::sycl::device_image &DeviceImage) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(DeviceImage)); +template <__sycl_ns::bundle_state State> +struct hash<__sycl_ns::device_image> { + size_t operator()(const __sycl_ns::device_image &DeviceImage) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(DeviceImage)); } }; -template -struct hash> { - size_t operator()(const cl::sycl::kernel_bundle &KernelBundle) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(KernelBundle)); +template <__sycl_ns::bundle_state State> +struct hash<__sycl_ns::kernel_bundle> { + size_t operator()(const __sycl_ns::kernel_bundle &KernelBundle) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(KernelBundle)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/kernel_bundle_enums.hpp b/sycl/include/CL/sycl/kernel_bundle_enums.hpp index 89bb0be1ca6c7..386fe4c58a5dd 100644 --- a/sycl/include/CL/sycl/kernel_bundle_enums.hpp +++ b/sycl/include/CL/sycl/kernel_bundle_enums.hpp @@ -8,10 +8,9 @@ #pragma once -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { enum class bundle_state : char { input = 0, object = 1, executable = 2 }; } -} // __SYCL_INLINE_NAMESPACE(cl) +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/kernel_handler.hpp b/sycl/include/CL/sycl/kernel_handler.hpp index 4fcbd2bc45cfd..5da313823374e 100644 --- a/sycl/include/CL/sycl/kernel_handler.hpp +++ b/sycl/include/CL/sycl/kernel_handler.hpp @@ -14,8 +14,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { /// Reading the value of a specialization constant /// /// \ingroup sycl_api @@ -29,7 +28,7 @@ class kernel_handler { return getSpecializationConstantOnDevice(); #else // TODO: add support of host device - throw cl::sycl::feature_not_supported( + throw __sycl_ns::feature_not_supported( "kernel_handler::get_specialization_constant() is not yet supported by " "host device.", PI_INVALID_OPERATION); @@ -69,5 +68,5 @@ class kernel_handler { char *MSpecializationConstantsBuffer = nullptr; }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/known_identity.hpp b/sycl/include/CL/sycl/known_identity.hpp index 59e51252d7c3a..65a420276db1f 100644 --- a/sycl/include/CL/sycl/known_identity.hpp +++ b/sycl/include/CL/sycl/known_identity.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template @@ -115,7 +114,7 @@ struct known_identity_impl(0)); + __sycl_ns::detail::host_half_impl::half_v2(static_cast(0)); #endif }; @@ -135,7 +134,7 @@ struct known_identity_impl(0x3C00)); + __sycl_ns::detail::host_half_impl::half_v2(static_cast(0x3C00)); #endif }; @@ -192,5 +191,5 @@ template __SYCL_INLINE_CONSTEXPR AccumulatorT known_identity_v = sycl::known_identity::value; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) \ No newline at end of file +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() \ No newline at end of file diff --git a/sycl/include/CL/sycl/marray.hpp b/sycl/include/CL/sycl/marray.hpp index 5b758b80683d0..822ed645a3b43 100644 --- a/sycl/include/CL/sycl/marray.hpp +++ b/sycl/include/CL/sycl/marray.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { /// Provides a cross-patform math array class template that works on /// SYCL devices as well as in host C++ code. @@ -310,7 +309,7 @@ template class marray { }; #define __SYCL_MAKE_MARRAY_ALIAS(ALIAS, TYPE, N) \ - using ALIAS##N = cl::sycl::marray; + using ALIAS##N = __sycl_ns::marray; #define __SYCL_MAKE_MARRAY_ALIASES_FOR_ARITHMETIC_TYPES(N) \ __SYCL_MAKE_MARRAY_ALIAS(mchar, char, N) \ @@ -345,5 +344,5 @@ __SYCL_MAKE_MARRAY_ALIASES_FOR_MARRAY_LENGTH(16) #undef __SYCL_MAKE_MARRAY_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES #undef __SYCL_MAKE_MARRAY_ALIASES_FOR_MARRAY_LENGTH -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/memory_enums.hpp b/sycl/include/CL/sycl/memory_enums.hpp index e552268b4c486..feaffefd71f9e 100644 --- a/sycl/include/CL/sycl/memory_enums.hpp +++ b/sycl/include/CL/sycl/memory_enums.hpp @@ -8,8 +8,7 @@ #pragma once -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { enum class memory_order : int { relaxed = 0, @@ -81,5 +80,5 @@ static constexpr std::memory_order getStdMemoryOrder(sycl::memory_order order) { #endif // __SYCL_DEVICE_ONLY__ } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/multi_ptr.hpp b/sycl/include/CL/sycl/multi_ptr.hpp index d9b19a4db1c4d..1fdad5accaae2 100644 --- a/sycl/include/CL/sycl/multi_ptr.hpp +++ b/sycl/include/CL/sycl/multi_ptr.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration template class multi_ptr { public: using element_type = detail::conditional_t::value, - cl::sycl::detail::half_impl::BIsRepresentationT, - ElementType>; + __sycl_ns::detail::half_impl::BIsRepresentationT, + ElementType>; using difference_type = std::ptrdiff_t; // Implementation defined pointer and reference types that correspond to @@ -691,5 +690,5 @@ bool operator<=(std::nullptr_t, const multi_ptr &rhs) { return rhs.get() == nullptr; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/nd_item.hpp b/sycl/include/CL/sycl/nd_item.hpp index 6a2dec50d8a12..87f980ff32a4f 100644 --- a/sycl/include/CL/sycl/nd_item.hpp +++ b/sycl/include/CL/sycl/nd_item.hpp @@ -23,8 +23,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class Builder; } @@ -224,5 +223,5 @@ template nd_item this_nd_item() { } // namespace experimental } // namespace oneapi } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/nd_range.hpp b/sycl/include/CL/sycl/nd_range.hpp index aa746653e79e0..6b73ab4da36c6 100644 --- a/sycl/include/CL/sycl/nd_range.hpp +++ b/sycl/include/CL/sycl/nd_range.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { /// Defines the iteration domain of both the work-groups and the overall /// dispatch. @@ -64,5 +63,5 @@ template class nd_range { } }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/pipes.hpp b/sycl/include/CL/sycl/pipes.hpp index b6cc4a857972b..5f4461282eeb0 100644 --- a/sycl/include/CL/sycl/pipes.hpp +++ b/sycl/include/CL/sycl/pipes.hpp @@ -10,9 +10,10 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { + template using pipe = ext::intel::pipe; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) + +} +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/platform.hpp b/sycl/include/CL/sycl/platform.hpp index 4b8fb726fe096..1526e86f279ab 100644 --- a/sycl/include/CL/sycl/platform.hpp +++ b/sycl/include/CL/sycl/platform.hpp @@ -14,9 +14,8 @@ // 4.6.2 Platform class #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { -// TODO: make code thread-safe + +__SYCL_OPEN_NS() { // Forward declaration class device_selector; @@ -143,14 +142,14 @@ class __SYCL_EXPORT platform { friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject); }; // class platform -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::platform &p) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(p)); +template <> struct hash<__sycl_ns::platform> { + size_t operator()(const __sycl_ns::platform &p) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(p)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/pointers.hpp b/sycl/include/CL/sycl/pointers.hpp index efec74e0fd3a6..0990e8dbc87fa 100644 --- a/sycl/include/CL/sycl/pointers.hpp +++ b/sycl/include/CL/sycl/pointers.hpp @@ -9,9 +9,7 @@ #pragma once #include - -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template class multi_ptr; // Template specialization aliases for different pointer address spaces @@ -38,5 +36,5 @@ template using private_ptr = multi_ptr; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/program.hpp b/sycl/include/CL/sycl/program.hpp index 6b70b47259af4..33a5222945fa8 100644 --- a/sycl/include/CL/sycl/program.hpp +++ b/sycl/include/CL/sycl/program.hpp @@ -18,8 +18,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations class context; @@ -416,14 +415,14 @@ class __SYCL_EXPORT __SYCL2020_DEPRECATED( template friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj); }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::program &prg) const { - return hash>()( - cl::sycl::detail::getSyclObjImpl(prg)); +template <> struct hash<__sycl_ns::program> { + size_t operator()(const __sycl_ns::program &prg) const { + return hash>()( + __sycl_ns::detail::getSyclObjImpl(prg)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/properties/accessor_properties.hpp b/sycl/include/CL/sycl/properties/accessor_properties.hpp index f4f560175667e..8ffbe1d4c4f3e 100644 --- a/sycl/include/CL/sycl/properties/accessor_properties.hpp +++ b/sycl/include/CL/sycl/properties/accessor_properties.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace property { class no_init : public detail::DataLessProperty {}; @@ -128,5 +127,5 @@ template <> struct IsCompileTimePropertyInstance< ext::oneapi::property::no_offset::instance<>> : std::true_type {}; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/properties/buffer_properties.hpp b/sycl/include/CL/sycl/properties/buffer_properties.hpp index aed2b3e8f21c6..8fde1bd3e6a1b 100644 --- a/sycl/include/CL/sycl/properties/buffer_properties.hpp +++ b/sycl/include/CL/sycl/properties/buffer_properties.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace property { namespace buffer { @@ -64,5 +63,5 @@ class use_pinned_host_memory : public sycl::detail::DataLessProperty< } // namespace property } // namespace oneapi } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/properties/context_properties.hpp b/sycl/include/CL/sycl/properties/context_properties.hpp index 49ec19890c439..8beeabcdff9f3 100644 --- a/sycl/include/CL/sycl/properties/context_properties.hpp +++ b/sycl/include/CL/sycl/properties/context_properties.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace property { namespace context { namespace cuda { @@ -21,5 +20,5 @@ class use_primary_context } // namespace cuda } // namespace context } // namespace property -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/properties/image_properties.hpp b/sycl/include/CL/sycl/properties/image_properties.hpp index 2bba3cc57755d..ba7f760a44bd7 100644 --- a/sycl/include/CL/sycl/properties/image_properties.hpp +++ b/sycl/include/CL/sycl/properties/image_properties.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace property { namespace image { class use_host_ptr : public detail::DataLessProperty { @@ -40,5 +39,5 @@ class context_bound }; } // namespace image } // namespace property -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/properties/queue_properties.hpp b/sycl/include/CL/sycl/properties/queue_properties.hpp index 31cdb26e6fb2d..a39addd2f4cc4 100644 --- a/sycl/include/CL/sycl/properties/queue_properties.hpp +++ b/sycl/include/CL/sycl/properties/queue_properties.hpp @@ -10,8 +10,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace property { namespace queue { class in_order : public detail::DataLessProperty {}; @@ -23,5 +22,5 @@ class use_default_stream } // namespace cuda } // namespace queue } // namespace property -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/properties/reduction_properties.hpp b/sycl/include/CL/sycl/properties/reduction_properties.hpp index e7150dfcdba15..2f982670d3fa1 100644 --- a/sycl/include/CL/sycl/properties/reduction_properties.hpp +++ b/sycl/include/CL/sycl/properties/reduction_properties.hpp @@ -11,13 +11,12 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace property { namespace reduction { class initialize_to_identity : public detail::DataLessProperty {}; } // namespace reduction } // namespace property -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/property_list.hpp b/sycl/include/CL/sycl/property_list.hpp index 77966ff6584f3..2e22c077a6b3e 100644 --- a/sycl/include/CL/sycl/property_list.hpp +++ b/sycl/include/CL/sycl/property_list.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { template class accessor_property_list; @@ -59,5 +58,5 @@ class property_list : protected detail::PropertyListBase { friend class ext::oneapi::accessor_property_list; }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/property_list_conversion.hpp b/sycl/include/CL/sycl/property_list_conversion.hpp index 6b96c81cd5f35..12ae0f8de326f 100644 --- a/sycl/include/CL/sycl/property_list_conversion.hpp +++ b/sycl/include/CL/sycl/property_list_conversion.hpp @@ -13,12 +13,11 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template inline property_list::operator ext::oneapi::accessor_property_list() { return ext::oneapi::accessor_property_list(MDataLessProps, MPropsWithData); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/queue.hpp b/sycl/include/CL/sycl/queue.hpp index 413bc49f29186..fdd31d76ca10c 100644 --- a/sycl/include/CL/sycl/queue.hpp +++ b/sycl/include/CL/sycl/queue.hpp @@ -58,8 +58,7 @@ #define _KERNELFUNCPARAM(a) const KernelType &a #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration class context; @@ -1015,14 +1014,14 @@ class __SYCL_EXPORT queue { } }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::queue &Q) const { - return std::hash>()( - cl::sycl::detail::getSyclObjImpl(Q)); +template <> struct hash<__sycl_ns::queue> { + size_t operator()(const __sycl_ns::queue &Q) const { + return std::hash>()( + __sycl_ns::detail::getSyclObjImpl(Q)); } }; } // namespace std diff --git a/sycl/include/CL/sycl/range.hpp b/sycl/include/CL/sycl/range.hpp index 32337109f97a9..3a1f38c1da187 100644 --- a/sycl/include/CL/sycl/range.hpp +++ b/sycl/include/CL/sycl/range.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template class id; /// Defines the iteration domain of either a single work-group in a parallel @@ -157,5 +156,5 @@ range(size_t, size_t)->range<2>; range(size_t, size_t, size_t)->range<3>; #endif -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/reduction.hpp b/sycl/include/CL/sycl/reduction.hpp index d0ed5f9369018..2770f99f16276 100644 --- a/sycl/include/CL/sycl/reduction.hpp +++ b/sycl/include/CL/sycl/reduction.hpp @@ -12,8 +12,7 @@ #include "sycl/ext/oneapi/reduction.hpp" -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { /// Constructs a reduction object using the given buffer \p Var, handler \p CGH, /// reduction operation \p Combiner, and optional reduction properties. @@ -100,5 +99,5 @@ reduction(T *Var, const T &Identity, BinaryOperation Combiner, return {Var, Identity, Combiner, InitializeToIdentity}; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/sampler.hpp b/sycl/include/CL/sycl/sampler.hpp index d8128ae8dba0c..9aead10d521be 100644 --- a/sycl/include/CL/sycl/sampler.hpp +++ b/sycl/include/CL/sycl/sampler.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { enum class addressing_mode : unsigned int { mirrored_repeat = CL_ADDRESS_MIRRORED_REPEAT, repeat = CL_ADDRESS_REPEAT, @@ -117,22 +116,23 @@ class __SYCL_EXPORT sampler { template friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject); #endif - template + template friend class detail::image_accessor; }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::sampler &s) const { +template <> struct hash<__sycl_ns::sampler> { + size_t operator()(const __sycl_ns::sampler &s) const { #ifdef __SYCL_DEVICE_ONLY__ (void)s; return 0; #else - return hash>()( - cl::sycl::detail::getSyclObjImpl(s)); + return hash>()( + __sycl_ns::detail::getSyclObjImpl(s)); #endif } }; diff --git a/sycl/include/CL/sycl/specialization_id.hpp b/sycl/include/CL/sycl/specialization_id.hpp index 0023507a7702a..7dc5186527c8f 100644 --- a/sycl/include/CL/sycl/specialization_id.hpp +++ b/sycl/include/CL/sycl/specialization_id.hpp @@ -8,8 +8,7 @@ #pragma once -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { /// Declaring a specialization constant /// @@ -34,5 +33,5 @@ template class specialization_id { T MDefaultValue; }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/stl.hpp b/sycl/include/CL/sycl/stl.hpp index f70ffca13a188..4bc9ae5a1bc81 100644 --- a/sycl/include/CL/sycl/stl.hpp +++ b/sycl/include/CL/sycl/stl.hpp @@ -21,8 +21,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { #if defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__) // SYCL library is designed such a way that STL objects cross DLL boundary, @@ -78,5 +77,5 @@ std::unique_ptr make_unique_ptr(ArgsT &&... Args) { return std::unique_ptr(new T(std::forward(Args)...)); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/stream.hpp b/sycl/include/CL/sycl/stream.hpp index a8806fa69d0c6..5423cdaed7cd2 100644 --- a/sycl/include/CL/sycl/stream.hpp +++ b/sycl/include/CL/sycl/stream.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { @@ -64,23 +63,24 @@ using EnableIfFP = std::is_same::value, T>; -using GlobalBufAccessorT = accessor; +using GlobalBufAccessorT = + accessor; constexpr static access::address_space GlobalBufAS = - TargetToAS::AS; + TargetToAS<__sycl_ns::access::target::global_buffer>::AS; using GlobalBufPtrType = typename detail::DecoratedType::type *; constexpr static int GlobalBufDim = 1; using GlobalOffsetAccessorT = - accessor; + accessor; constexpr static access::address_space GlobalOffsetAS = - TargetToAS::AS; + TargetToAS<__sycl_ns::access::target::global_buffer>::AS; using GlobalOffsetPtrType = typename detail::DecoratedType::type *; constexpr static int GlobalOffsetDim = 1; @@ -645,11 +645,11 @@ template struct IsSwizzleOp : std::false_type {}; template class OperationCurrentT, int... Indexes> -struct IsSwizzleOp> : std::true_type { using T = typename VecT::element_type; - using Type = typename cl::sycl::vec; + using Type = typename __sycl_ns::vec; }; template @@ -1140,17 +1140,17 @@ inline const stream &operator<<(const stream &Out, const T &RHS) { return Out; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() namespace std { -template <> struct hash { - size_t operator()(const cl::sycl::stream &S) const { +template <> struct hash<__sycl_ns::stream> { + size_t operator()(const __sycl_ns::stream &S) const { #ifdef __SYCL_DEVICE_ONLY__ (void)S; return 0; #else - return hash>()( - cl::sycl::detail::getSyclObjImpl(S)); + return hash>()( + __sycl_ns::detail::getSyclObjImpl(S)); #endif } }; diff --git a/sycl/include/CL/sycl/sub_group.hpp b/sycl/include/CL/sycl/sub_group.hpp index bbae64f2504e6..c90dd29a1f802 100644 --- a/sycl/include/CL/sycl/sub_group.hpp +++ b/sycl/include/CL/sycl/sub_group.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { using ext::oneapi::sub_group; // TODO move the entire sub_group class implementation to this file once // breaking changes are allowed. @@ -31,5 +30,5 @@ inline sub_group this_sub_group() { } // namespace experimental } // namespace oneapi } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/sycl_span.hpp b/sycl/include/CL/sycl/sycl_span.hpp index 1c7898dd1e44a..cd4d279d8724e 100644 --- a/sycl/include/CL/sycl/sycl_span.hpp +++ b/sycl/include/CL/sycl/sycl_span.hpp @@ -135,8 +135,7 @@ template #define _SYCL_SPAN_TEMPLATE_VIS #define _SYCL_SPAN_INLINE_VISIBILITY inline -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // byte is unsigned char at sycl/image.hpp:58 using byte = unsigned char; @@ -621,8 +620,8 @@ span(_Container &)->span; template span(const _Container &)->span; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #endif // _SYCL_SPAN diff --git a/sycl/include/CL/sycl/types.hpp b/sycl/include/CL/sycl/types.hpp index a9ad31a1e7d36..101510bbcab74 100644 --- a/sycl/include/CL/sycl/types.hpp +++ b/sycl/include/CL/sycl/types.hpp @@ -64,8 +64,7 @@ // 4.10.1: Scalar data types // 4.10.2: SYCL vector types -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { enum class rounding_mode { automatic = 0, rte = 1, rtz = 2, rtp = 3, rtn = 4 }; struct elem { @@ -334,7 +333,7 @@ convertImpl(T Value) { std::is_same::value)), \ R> \ convertImpl(T Value) { \ - OpenCLT OpValue = cl::sycl::detail::convertDataToType(Value); \ + OpenCLT OpValue = __sycl_ns::detail::convertDataToType(Value); \ return __spirv_SConvert##_R##DestType(OpValue); \ } @@ -354,7 +353,7 @@ __SYCL_GENERATE_CONVERT_IMPL(long) std::is_same::value, \ R> \ convertImpl(T Value) { \ - OpenCLT OpValue = cl::sycl::detail::convertDataToType(Value); \ + OpenCLT OpValue = __sycl_ns::detail::convertDataToType(Value); \ return __spirv_UConvert##_R##DestType(OpValue); \ } @@ -386,7 +385,7 @@ convertImpl(T Value) { std::is_same::value)), \ R> \ convertImpl(T Value) { \ - OpenCLT OpValue = cl::sycl::detail::convertDataToType(Value); \ + OpenCLT OpValue = __sycl_ns::detail::convertDataToType(Value); \ return __spirv_Convert##SPIRVOp##_R##DestType(OpValue); \ } @@ -406,7 +405,7 @@ __SYCL_GENERATE_CONVERT_IMPL(SToF, double) std::is_same::value)), \ R> \ convertImpl(T Value) { \ - OpenCLT OpValue = cl::sycl::detail::convertDataToType(Value); \ + OpenCLT OpValue = __sycl_ns::detail::convertDataToType(Value); \ return __spirv_Convert##SPIRVOp##_R##DestType(OpValue); \ } @@ -429,7 +428,7 @@ __SYCL_GENERATE_CONVERT_IMPL(UToF, double) RoundingModeCondition::value, \ R> \ convertImpl(T Value) { \ - OpenCLT OpValue = cl::sycl::detail::convertDataToType(Value); \ + OpenCLT OpValue = __sycl_ns::detail::convertDataToType(Value); \ return __spirv_FConvert##_R##DestType##_##RoundingMode(OpValue); \ } @@ -459,7 +458,7 @@ __SYCL_GENERATE_CONVERT_IMPL_FOR_ROUNDING_MODE(rtn, Rtn) RoundingModeCondition::value, \ R> \ convertImpl(T Value) { \ - OpenCLT OpValue = cl::sycl::detail::convertDataToType(Value); \ + OpenCLT OpValue = __sycl_ns::detail::convertDataToType(Value); \ return __spirv_Convert##SPIRVOp##_R##DestType##_##RoundingMode(OpValue); \ } @@ -670,15 +669,15 @@ template class vec { #ifdef __SYCL_USE_EXT_VECTOR_TYPE__ template using EnableIfNotHostHalf = typename detail::enable_if_t< - !std::is_same::value || - !std::is_same::value, + !std::is_same::value || + !std::is_same<__sycl_ns::detail::half_impl::StorageT, + __sycl_ns::detail::host_half_impl::half_v2>::value, T>; template using EnableIfHostHalf = typename detail::enable_if_t< - std::is_same::value && - std::is_same::value, + std::is_same::value && + std::is_same<__sycl_ns::detail::half_impl::StorageT, + __sycl_ns::detail::host_half_impl::half_v2>::value, T>; template @@ -1912,7 +1911,7 @@ class SwizzleOp { OperationRightT m_RightOperation; // friends - template friend class cl::sycl::vec; + template friend class __sycl_ns::vec; template class T4, int... T5> @@ -2029,36 +2028,35 @@ __SYCL_RELLOGOP(&&) __SYCL_RELLOGOP(||) #undef __SYCL_RELLOGOP -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) - +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #ifdef __SYCL_USE_EXT_VECTOR_TYPE__ #define __SYCL_DECLARE_TYPE_VIA_CL_T(type) \ - using __##type##_t = cl::sycl::cl_##type; \ + using __##type##_t = __sycl_ns::cl_##type; \ using __##type##2_vec_t = \ - cl::sycl::cl_##type __attribute__((ext_vector_type(2))); \ + __sycl_ns::cl_##type __attribute__((ext_vector_type(2))); \ using __##type##3_vec_t = \ - cl::sycl::cl_##type __attribute__((ext_vector_type(3))); \ + __sycl_ns::cl_##type __attribute__((ext_vector_type(3))); \ using __##type##4_vec_t = \ - cl::sycl::cl_##type __attribute__((ext_vector_type(4))); \ + __sycl_ns::cl_##type __attribute__((ext_vector_type(4))); \ using __##type##8_vec_t = \ - cl::sycl::cl_##type __attribute__((ext_vector_type(8))); \ + __sycl_ns::cl_##type __attribute__((ext_vector_type(8))); \ using __##type##16_vec_t = \ - cl::sycl::cl_##type __attribute__((ext_vector_type(16))); + __sycl_ns::cl_##type __attribute__((ext_vector_type(16))); #define __SYCL_DECLARE_TYPE_T(type) \ - using __##type##_t = cl::sycl::type; \ + using __##type##_t = __sycl_ns::type; \ using __##type##2_vec_t = \ - cl::sycl::type __attribute__((ext_vector_type(2))); \ + __sycl_ns::type __attribute__((ext_vector_type(2))); \ using __##type##3_vec_t = \ - cl::sycl::type __attribute__((ext_vector_type(3))); \ + __sycl_ns::type __attribute__((ext_vector_type(3))); \ using __##type##4_vec_t = \ - cl::sycl::type __attribute__((ext_vector_type(4))); \ + __sycl_ns::type __attribute__((ext_vector_type(4))); \ using __##type##8_vec_t = \ - cl::sycl::type __attribute__((ext_vector_type(8))); \ + __sycl_ns::type __attribute__((ext_vector_type(8))); \ using __##type##16_vec_t = \ - cl::sycl::type __attribute__((ext_vector_type(16))); + __sycl_ns::type __attribute__((ext_vector_type(16))); __SYCL_DECLARE_TYPE_VIA_CL_T(char) __SYCL_DECLARE_TYPE_T(schar) @@ -2086,16 +2084,15 @@ __SYCL_DECLARE_TYPE_VIA_CL_T(double) #define __SYCL_GET_SCALAR_CL_TYPE(target) ::cl_##target #endif // __SYCL_USE_EXT_VECTOR_TYPE__ -using __half_t = cl::sycl::detail::half_impl::StorageT; -using __half2_vec_t = cl::sycl::detail::half_impl::Vec2StorageT; -using __half3_vec_t = cl::sycl::detail::half_impl::Vec3StorageT; -using __half4_vec_t = cl::sycl::detail::half_impl::Vec4StorageT; -using __half8_vec_t = cl::sycl::detail::half_impl::Vec8StorageT; -using __half16_vec_t = cl::sycl::detail::half_impl::Vec16StorageT; +using __half_t = __sycl_ns::detail::half_impl::StorageT; +using __half2_vec_t = __sycl_ns::detail::half_impl::Vec2StorageT; +using __half3_vec_t = __sycl_ns::detail::half_impl::Vec3StorageT; +using __half4_vec_t = __sycl_ns::detail::half_impl::Vec4StorageT; +using __half8_vec_t = __sycl_ns::detail::half_impl::Vec8StorageT; +using __half16_vec_t = __sycl_ns::detail::half_impl::Vec16StorageT; #define __SYCL_GET_CL_HALF_TYPE(target, num) __##target##num##_vec_t -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // select_apply_cl_t selects from T8/T16/T32/T64 basing on // sizeof(IN). expected to handle scalar types in IN. @@ -2391,7 +2388,7 @@ struct CheckDeviceCopyable #endif // __SYCL_DEVICE_ONLY__ } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #undef __SYCL_ALIGNAS diff --git a/sycl/include/CL/sycl/usm.hpp b/sycl/include/CL/sycl/usm.hpp index ba91029144fb5..5fae3b37c3721 100644 --- a/sycl/include/CL/sycl/usm.hpp +++ b/sycl/include/CL/sycl/usm.hpp @@ -13,8 +13,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { /// // Explicit USM /// @@ -233,5 +232,5 @@ __SYCL_EXPORT usm::alloc get_pointer_type(const void *ptr, const context &ctxt); /// \param ctxt is the sycl context the ptr was allocated in __SYCL_EXPORT device get_pointer_device(const void *ptr, const context &ctxt); -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/usm/usm_allocator.hpp b/sycl/include/CL/sycl/usm/usm_allocator.hpp index 9bcc63d521e13..a3cf849c36aa2 100644 --- a/sycl/include/CL/sycl/usm/usm_allocator.hpp +++ b/sycl/include/CL/sycl/usm/usm_allocator.hpp @@ -17,8 +17,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations. __SYCL_EXPORT void *aligned_alloc(size_t alignment, size_t size, @@ -120,5 +119,5 @@ class usm_allocator { property_list MPropList; }; -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/CL/sycl/usm/usm_enums.hpp b/sycl/include/CL/sycl/usm/usm_enums.hpp index 5476860834aa7..c7f865f5fef2c 100644 --- a/sycl/include/CL/sycl/usm/usm_enums.hpp +++ b/sycl/include/CL/sycl/usm/usm_enums.hpp @@ -7,12 +7,11 @@ // ===--------------------------------------------------------------------=== // #pragma once -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace usm { enum class alloc { host = 0, device = 1, shared = 2, unknown = 3 }; } // namespace usm -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/bfloat16.hpp b/sycl/include/sycl/ext/intel/experimental/bfloat16.hpp index 7a74c33ab7229..c56cae9cf133f 100644 --- a/sycl/include/sycl/ext/intel/experimental/bfloat16.hpp +++ b/sycl/include/sycl/ext/intel/experimental/bfloat16.hpp @@ -10,8 +10,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -144,5 +143,5 @@ class [[sycl_detail::uses_aspects(ext_intel_bf16_conversion)]] bfloat16 { namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL { using namespace ext::intel; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/common.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/common.hpp index 9ac08f711aada..898cdab066020 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/common.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/common.hpp @@ -22,8 +22,7 @@ #define SYCL_ESIMD_FUNCTION #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -248,5 +247,5 @@ using EsimdSbarrierType = split_barrier_action; } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/host_util.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/host_util.hpp old mode 100755 new mode 100644 index d1562a2405d68..216fe3c6f341c --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/host_util.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/host_util.hpp @@ -16,18 +16,12 @@ #define SIMDCF_ELEMENT_SKIP(i) -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace half_impl { class half; } // namespace half_impl } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) - -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { namespace ext { namespace intel { namespace experimental { @@ -478,7 +472,7 @@ template <> struct dwordtype { static const bool value = true; }; } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #endif // #ifndef __SYCL_DEVICE_ONLY__ diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/intrin.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/intrin.hpp index d8a493cd6b3d7..1ce9ea43386f2 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/intrin.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/intrin.hpp @@ -134,8 +134,7 @@ __esimd_wrindirect(__SEIEED::vector_type_t OldVal, __SEIEED::vector_type_t Offset, __SEIEE::mask_type_t Mask = 1); -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -215,8 +214,8 @@ readRegion(const __SEIEED::vector_type_t &Base, } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() // vload // diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/math_intrin.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/math_intrin.hpp index 619f9f598f198..bf24c29b662bc 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/math_intrin.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/math_intrin.hpp @@ -345,8 +345,7 @@ SYCL_EXTERNAL SYCL_ESIMD_FUNCTION int __esimd_lane_id(); return retv; \ } -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -361,8 +360,8 @@ ESIMD_MATH_INTRINSIC_IMPL(float, log) } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #undef __ESIMD_SIMT_BEGIN #undef __ESIMD_SIMT_END diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/memory_intrin.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/memory_intrin.hpp index 03ec0ab45b171..ecd957034ac37 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/memory_intrin.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/memory_intrin.hpp @@ -19,8 +19,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -71,8 +70,8 @@ constexpr unsigned int ElemsPerAddrDecoding(unsigned int ElemsPerAddrEncoded) { } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #define __SEIEE sycl::ext::intel::experimental::esimd #define __SEIEED sycl::ext::intel::experimental::esimd::detail @@ -173,7 +172,7 @@ __esimd_surf_read(int16_t scale, SurfIndAliasTy surf_ind, static_assert(N == 1 || N == 8 || N == 16); static_assert(TySizeLog2 <= 2); static_assert(std::is_integral::value || TySizeLog2 == 2); - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } #endif // __SYCL_DEVICE_ONLY__ @@ -216,7 +215,7 @@ __esimd_surf_write(__SEIEED::vector_type_t pred, int16_t scale, static_assert(N == 1 || N == 8 || N == 16); static_assert(TySizeLog2 <= 2); static_assert(std::is_integral::value || TySizeLog2 == 2); - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } #endif // __SYCL_DEVICE_ONLY__ @@ -711,16 +710,16 @@ __esimd_media_block_load(unsigned modififer, TACC handle, unsigned plane, for (int col = 0; col < N; col += vpp) { unsigned int xoff = (i > xbound) ? xbound : i; unsigned int yoff = (j > ybound) ? ybound : j; - auto coords = cl::sycl::cl_int2(xoff, yoff); - cl::sycl::cl_uint4 data = handle.read(coords); + auto coords = __sycl_ns::cl_int2(xoff, yoff); + __sycl_ns::cl_uint4 data = handle.read(coords); __SEIEED::vector_type_t res; for (int idx = 0; idx < 4; idx++) { res[idx] = data[idx]; } - constexpr int refN = sizeof(cl::sycl::cl_uint4) / sizeof(Ty); - unsigned int stride = sizeof(cl::sycl::cl_uint4) / bpp; + constexpr int refN = sizeof(__sycl_ns::cl_uint4) / sizeof(Ty); + unsigned int stride = sizeof(__sycl_ns::cl_uint4) / bpp; using refTy = __SEIEED::vector_type_t; auto ref = reinterpret_cast(res); @@ -755,12 +754,12 @@ inline void __esimd_media_block_store(unsigned modififer, TACC handle, for (int row = 0; row < M; row++) { for (int col = 0; col < N; col += vpp) { - constexpr int Sz = sizeof(cl::sycl::cl_uint4) / sizeof(Ty); + constexpr int Sz = sizeof(__sycl_ns::cl_uint4) / sizeof(Ty); __SEIEED::vector_type_t res = 0; unsigned int offset1 = col + row * N; unsigned int offset2 = 0; - unsigned int stride = sizeof(cl::sycl::cl_uint4) / bpp; + unsigned int stride = sizeof(__sycl_ns::cl_uint4) / bpp; for (int idx = 0; idx < vpp; idx++) { res[offset2] = vals[offset1]; offset1++; @@ -770,13 +769,13 @@ inline void __esimd_media_block_store(unsigned modififer, TACC handle, using refTy = __SEIEED::vector_type_t; auto ref = reinterpret_cast(res); - cl::sycl::cl_uint4 data; + __sycl_ns::cl_uint4 data; for (int idx = 0; idx < 4; idx++) { data[idx] = ref[idx]; } if (i < range[0] && j < range[1]) { - auto coords = cl::sycl::cl_int2(i, j); + auto coords = __sycl_ns::cl_int2(i, j); handle.write(coords, data); } i++; @@ -930,7 +929,7 @@ __esimd_flat_atomic2(__SEIEED::vector_type_t addrs, template inline __SEIEED::vector_type_t __esimd_block_read(SurfIndAliasTy surf_ind, uint32_t offset) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); return __SEIEED::vector_type_t(); } @@ -938,7 +937,7 @@ template inline void __esimd_block_write(SurfIndAliasTy surf_ind, uint32_t offset, __SEIEED::vector_type_t vals) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } /// \brief esimd_get_value @@ -949,7 +948,7 @@ inline void __esimd_block_write(SurfIndAliasTy surf_ind, uint32_t offset, /// template inline uint32_t __esimd_get_value(AccessorTy acc) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); return 0; } @@ -994,7 +993,7 @@ __esimd_raw_sends_load(uint8_t modifier, uint8_t execSize, __SEIEED::vector_type_t msgSrc0, __SEIEED::vector_type_t msgSrc1, __SEIEED::vector_type_t msgDst) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); return 0; } @@ -1032,7 +1031,7 @@ __esimd_raw_send_load(uint8_t modifier, uint8_t execSize, uint32_t exDesc, uint32_t msgDesc, __SEIEED::vector_type_t msgSrc0, __SEIEED::vector_type_t msgDst) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); return 0; } @@ -1068,7 +1067,7 @@ inline void __esimd_raw_sends_store(uint8_t modifier, uint8_t execSize, uint32_t msgDesc, __SEIEED::vector_type_t msgSrc0, __SEIEED::vector_type_t msgSrc1) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } /// \brief Raw send store. @@ -1096,7 +1095,7 @@ inline void __esimd_raw_send_store(uint8_t modifier, uint8_t execSize, uint8_t numSrc0, uint8_t sfid, uint32_t exDesc, uint32_t msgDesc, __SEIEED::vector_type_t msgSrc0) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } #endif // __SYCL_DEVICE_ONLY__ diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/region.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/region.hpp index 39092fea83616..a31910deb9d3c 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/region.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/region.hpp @@ -15,8 +15,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -124,5 +123,5 @@ template T getBaseRegion(std::pair Reg) { } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/simd_view_impl.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/simd_view_impl.hpp index cad9e6a686c1a..60033b88e5e67 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/simd_view_impl.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/simd_view_impl.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -490,5 +489,5 @@ class simd_view_impl { } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/sycl_util.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/sycl_util.hpp index 0335f7a9ef55a..6df5ac9a7ee9a 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/sycl_util.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/sycl_util.hpp @@ -13,8 +13,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -86,5 +85,5 @@ using EnableIfAccessor = sycl::detail::enable_if_t< } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/types.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/types.hpp index e14d2e9c5306e..54ce6e4d040a5 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/types.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/types.hpp @@ -18,8 +18,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -31,9 +30,9 @@ template class simd_view; namespace detail { -namespace csd = cl::sycl::detail; +namespace csd = __sycl_ns::detail; -using half = cl::sycl::detail::half_impl::StorageT; +using half = __sycl_ns::detail::half_impl::StorageT; template using remove_cvref_t = csd::remove_cv_t>; @@ -265,5 +264,5 @@ using mask_type_t = typename detail::vector_type::type; } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/util.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/util.hpp old mode 100755 new mode 100644 index c462f839e6ac5..735a9d09b1c90 --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/util.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/util.hpp @@ -15,8 +15,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -84,7 +83,7 @@ struct is_esimd_vector> : public std::true_type {}; template using is_esimd_scalar = - typename std::bool_constant::value>; + typename std::bool_constant<__sycl_ns::detail::is_arithmetic::value>; template using is_hw_int_type = @@ -147,5 +146,5 @@ template <> struct word_type { using type = ushort; }; } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/emu/detail/esimdcpu_device_interface.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/emu/detail/esimdcpu_device_interface.hpp index eb249f7c61781..38aadfdd29b2e 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/emu/detail/esimdcpu_device_interface.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/emu/detail/esimdcpu_device_interface.hpp @@ -25,8 +25,7 @@ // ESIMDDeviceInterface' definition. #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { /// This is the device interface version required (and used) by this @@ -74,7 +73,7 @@ ESIMDDeviceInterface *getESIMDDeviceInterface() { // tight loop) void *PIOpaqueData = nullptr; - PIOpaqueData = getPluginOpaqueData(nullptr); + PIOpaqueData = getPluginOpaqueData<__sycl_ns::backend::esimd_cpu>(nullptr); ESIMDEmuPluginOpaqueData *OpaqueData = reinterpret_cast(PIOpaqueData); @@ -91,7 +90,7 @@ ESIMDDeviceInterface *getESIMDDeviceInterface() { << "Returned version : " << OpaqueData->version << std::endl << "Required version : " << ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION << std::endl; - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } // Opaque data version is OK, can cast the 'data' field. ESIMDDeviceInterface *Interface = @@ -106,7 +105,7 @@ ESIMDDeviceInterface *getESIMDDeviceInterface() { << "Found version : " << Interface->version << std::endl << "Required version :" << ESIMD_DEVICE_INTERFACE_VERSION << std::endl; - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } return Interface; } @@ -115,5 +114,5 @@ ESIMDDeviceInterface *getESIMDDeviceInterface() { #undef ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp index 5f87f1b4595c7..bce3d7c2e7fea 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp @@ -19,8 +19,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -2479,5 +2478,5 @@ simd esimd_dp4(simd v1, simd v2) { } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp index 02cfd986a0410..c2d542fbf7091 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp @@ -19,8 +19,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -505,9 +504,10 @@ constexpr bool check_atomic() { static_assert(NumSrc == 1, "One source operand is expected"); return false; } - if constexpr (!is_type()) { + if constexpr (!is_type()) { static_assert( - (is_type()), + (is_type()), "Type F or HF is expected"); return false; } @@ -527,9 +527,10 @@ constexpr bool check_atomic() { return false; } if constexpr (Op == atomic_op::fcmpwr && - !is_type()) { + !is_type()) { static_assert( - (is_type()), + (is_type()), "Type F or HF is expected"); return false; } @@ -1028,5 +1029,5 @@ esimd_raw_send_store(simd msgSrc0, uint32_t exDesc, uint32_t msgDesc, } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp index 26abc25916ae0..d7987e20fca4b 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp @@ -17,8 +17,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -685,8 +684,8 @@ ESIMD_INLINE } // namespace experimental } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #ifndef __SYCL_DEVICE_ONLY__ template diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/simd_view.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/simd_view.hpp index 7b64e0fc0d8d0..ba9e0b51e47d5 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/simd_view.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/simd_view.hpp @@ -12,8 +12,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace experimental { @@ -235,5 +234,5 @@ class simd_view -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { @@ -54,5 +53,5 @@ class fpga_emulator_selector : public platform_selector { namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL { using namespace ext::intel; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/fpga_lsu.hpp b/sycl/include/sycl/ext/intel/fpga_lsu.hpp index 35f99f605154e..25db352ef207f 100644 --- a/sycl/include/sycl/ext/intel/fpga_lsu.hpp +++ b/sycl/include/sycl/ext/intel/fpga_lsu.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { constexpr uint8_t BURST_COALESCE = 0x1; @@ -127,5 +126,5 @@ template class lsu final { namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL { using namespace ext::intel; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/fpga_reg.hpp b/sycl/include/sycl/ext/intel/fpga_reg.hpp index 18b61cf9e1ca2..db617ac31d662 100644 --- a/sycl/include/sycl/ext/intel/fpga_reg.hpp +++ b/sycl/include/sycl/ext/intel/fpga_reg.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { @@ -49,8 +48,8 @@ fpga_reg(_T t) { namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL { using namespace ext::intel; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() // Keep it consistent with FPGA attributes like intelfpga::memory() // Currently clang does not support nested namespace for attributes @@ -58,6 +57,6 @@ namespace intelfpga { template [[deprecated("intelfpga::fpga_reg will be removed in a future release.")]] _T fpga_reg(const _T &t) { - return cl::sycl::ext::intel::fpga_reg(t); + return __sycl_ns::ext::intel::fpga_reg(t); } } // namespace intelfpga diff --git a/sycl/include/sycl/ext/intel/fpga_utils.hpp b/sycl/include/sycl/ext/intel/fpga_utils.hpp index b84293e0244a6..36e752fb4e54e 100644 --- a/sycl/include/sycl/ext/intel/fpga_utils.hpp +++ b/sycl/include/sycl/ext/intel/fpga_utils.hpp @@ -12,8 +12,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { @@ -36,5 +35,5 @@ struct _GetValue<_Type, _T1, _T...> { namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL { using namespace ext::intel; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/online_compiler.hpp b/sycl/include/sycl/ext/intel/online_compiler.hpp index ef104f3dd9e97..25701f1fbfbf0 100644 --- a/sycl/include/sycl/ext/intel/online_compiler.hpp +++ b/sycl/include/sycl/ext/intel/online_compiler.hpp @@ -8,15 +8,14 @@ #pragma once -#include // for __SYCL_INLINE_NAMESPACE +#include // for __SYCL_OPEN_NS #include // for __SYCL_EXPORT #include #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { @@ -361,5 +360,5 @@ namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL { } } // namespace INTEL -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/intel/pipes.hpp b/sycl/include/sycl/ext/intel/pipes.hpp index c12aacfd8d398..3dfea0b017d25 100644 --- a/sycl/include/sycl/ext/intel/pipes.hpp +++ b/sycl/include/sycl/ext/intel/pipes.hpp @@ -12,8 +12,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { @@ -205,5 +204,5 @@ class kernel_writeable_io_pipe { namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL { using namespace ext::intel; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/accessor_property_list.hpp b/sycl/include/sycl/ext/oneapi/accessor_property_list.hpp index 44c1084c94c8c..ed4f195f6f379 100644 --- a/sycl/include/sycl/ext/oneapi/accessor_property_list.hpp +++ b/sycl/include/sycl/ext/oneapi/accessor_property_list.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration template @@ -215,7 +214,7 @@ class accessor_property_list : protected sycl::detail::PropertyListBase { private: template - friend class sycl::accessor; + friend class __sycl_ns::accessor; template friend class accessor_property_list; @@ -235,5 +234,5 @@ class accessor_property_list : protected sycl::detail::PropertyListBase { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/atomic_accessor.hpp b/sycl/include/sycl/ext/oneapi/atomic_accessor.hpp index 5cbf498a50236..d541ddab638e9 100644 --- a/sycl/include/sycl/ext/oneapi/atomic_accessor.hpp +++ b/sycl/include/sycl/ext/oneapi/atomic_accessor.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { @@ -132,5 +131,5 @@ atomic_accessor(buffer, handler, namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/atomic_enums.hpp b/sycl/include/sycl/ext/oneapi/atomic_enums.hpp index 487251b0fe128..eb0df0a19cea0 100644 --- a/sycl/include/sycl/ext/oneapi/atomic_enums.hpp +++ b/sycl/include/sycl/ext/oneapi/atomic_enums.hpp @@ -19,12 +19,11 @@ #endif #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { -using memory_order = cl::sycl::memory_order; +using memory_order = __sycl_ns::memory_order; __SYCL_INLINE_CONSTEXPR memory_order memory_order_relaxed = memory_order::relaxed; __SYCL_INLINE_CONSTEXPR memory_order memory_order_acquire = @@ -36,7 +35,7 @@ __SYCL_INLINE_CONSTEXPR memory_order memory_order_acq_rel = __SYCL_INLINE_CONSTEXPR memory_order memory_order_seq_cst = memory_order::seq_cst; -using memory_scope = cl::sycl::memory_scope; +using memory_scope = __sycl_ns::memory_scope; __SYCL_INLINE_CONSTEXPR memory_scope memory_scope_work_item = memory_scope::work_item; __SYCL_INLINE_CONSTEXPR memory_scope memory_scope_sub_group = @@ -50,7 +49,7 @@ __SYCL_INLINE_CONSTEXPR memory_scope memory_scope_system = memory_scope::system; namespace detail { static inline constexpr std::memory_order -getStdMemoryOrder(::cl::sycl::ext::oneapi::memory_order order) { +getStdMemoryOrder(__sycl_ns::ext::oneapi::memory_order order) { switch (order) { case memory_order::relaxed: return std::memory_order_relaxed; @@ -76,5 +75,5 @@ getStdMemoryOrder(::cl::sycl::ext::oneapi::memory_order order) { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/atomic_fence.hpp b/sycl/include/sycl/ext/oneapi/atomic_fence.hpp index 5ec2d296536a2..9de29fbc8af19 100644 --- a/sycl/include/sycl/ext/oneapi/atomic_fence.hpp +++ b/sycl/include/sycl/ext/oneapi/atomic_fence.hpp @@ -16,12 +16,11 @@ #include #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { namespace detail { -using namespace cl::sycl::detail; +using namespace __sycl_ns::detail; } __SYCL2020_DEPRECATED("use sycl::atomic_fence instead") @@ -43,5 +42,5 @@ static inline void atomic_fence(memory_order order, memory_scope scope) { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/atomic_ref.hpp b/sycl/include/sycl/ext/oneapi/atomic_ref.hpp index d741a0f9adde6..7e9009506036a 100644 --- a/sycl/include/sycl/ext/oneapi/atomic_ref.hpp +++ b/sycl/include/sycl/ext/oneapi/atomic_ref.hpp @@ -20,8 +20,7 @@ #endif #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration template @@ -32,16 +31,16 @@ namespace oneapi { namespace detail { // Import from detail:: into ext::oneapi::detail:: to improve readability later -using namespace ::cl::sycl::detail; +using namespace __sycl_ns::detail; -using memory_order = cl::sycl::ext::oneapi::memory_order; -using memory_scope = cl::sycl::ext::oneapi::memory_scope; +using memory_order = __sycl_ns::ext::oneapi::memory_order; +using memory_scope = __sycl_ns::ext::oneapi::memory_scope; template using IsValidAtomicType = bool_constant::value || std::is_pointer::value>; -template +template <__sycl_ns::access::address_space AS> using IsValidAtomicAddressSpace = bool_constant a, vec b, int32_t c) { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/experimental/builtins.hpp b/sycl/include/sycl/ext/oneapi/experimental/builtins.hpp index 7108e189f51da..7d20a49489412 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/builtins.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/builtins.hpp @@ -16,8 +16,7 @@ #define __SYCL_CONSTANT_AS #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { namespace experimental { @@ -51,7 +50,7 @@ namespace experimental { // argument has 'long' type which is 64-bit wide by the OpenCL C spec. However, // by C++ spec long is just at least 32-bit wide, so, you need to ensure (by // performing a cast, for example) that if you use %ld specifier, you pass -// 64-bit argument to the cl::sycl::experimental::printf +// 64-bit argument to the sycl::experimental::printf // // - OpenCL spec defines several additional features, like, for example, 'v' // modifier which allows to print OpenCL vectors: note that these features are @@ -75,7 +74,7 @@ int printf(const __SYCL_CONSTANT_AS char *__format, Args... args) { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #undef __SYCL_CONSTANT_AS diff --git a/sycl/include/sycl/ext/oneapi/experimental/spec_constant.hpp b/sycl/include/sycl/ext/oneapi/experimental/spec_constant.hpp index e8056e48f49a5..83430e53052d8 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/spec_constant.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/spec_constant.hpp @@ -19,8 +19,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { class program; namespace ext { @@ -44,7 +43,7 @@ template class spec_constant { #else char padding[sizeof(T)]; #endif // __SYCL_DEVICE_ONLY__ - friend class cl::sycl::program; + friend class __sycl_ns::program; public: template @@ -83,5 +82,5 @@ template class spec_constant { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/filter_selector.hpp b/sycl/include/sycl/ext/oneapi/filter_selector.hpp index 3ad616206fc8c..86854b7918f21 100644 --- a/sycl/include/sycl/ext/oneapi/filter_selector.hpp +++ b/sycl/include/sycl/ext/oneapi/filter_selector.hpp @@ -15,8 +15,7 @@ // 4.6.1 Device selection class -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations class device; @@ -51,5 +50,5 @@ namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { device select_device() const override; }; } // namespace ONEAPI -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/function_pointer.hpp b/sycl/include/sycl/ext/oneapi/function_pointer.hpp index 9fbfb39e9e556..301fa2c9706e3 100644 --- a/sycl/include/sycl/ext/oneapi/function_pointer.hpp +++ b/sycl/include/sycl/ext/oneapi/function_pointer.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { __SYCL_EXPORT cl_ulong getDeviceFunctionPointerImpl(device &D, program &P, const char *FuncName); @@ -89,5 +88,5 @@ device_func_ptr_holder_t get_device_func_ptr(FuncType F, const char *FuncName, namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/functional.hpp b/sycl/include/sycl/ext/oneapi/functional.hpp index e7a1820a937f3..77a036a58db2e 100644 --- a/sycl/include/sycl/ext/oneapi/functional.hpp +++ b/sycl/include/sycl/ext/oneapi/functional.hpp @@ -11,8 +11,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { @@ -108,5 +107,5 @@ static T calc(typename GroupOpTag::type, T x, BinaryOperation) { } // namespace detail #endif // __SYCL_DEVICE_ONLY__ -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/group_algorithm.hpp b/sycl/include/sycl/ext/oneapi/group_algorithm.hpp index 79a31d1a4ec2c..58041067d8763 100644 --- a/sycl/include/sycl/ext/oneapi/group_algorithm.hpp +++ b/sycl/include/sycl/ext/oneapi/group_algorithm.hpp @@ -20,50 +20,50 @@ #include #ifndef __DISABLE_SYCL_ONEAPI_GROUP_ALGORITHMS__ -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { // EnableIf shorthands for algorithms that depend only on type template -using EnableIfIsScalarArithmetic = cl::sycl::detail::enable_if_t< - cl::sycl::detail::is_scalar_arithmetic::value, T>; +using EnableIfIsScalarArithmetic = __sycl_ns::detail::enable_if_t< + __sycl_ns::detail::is_scalar_arithmetic::value, T>; template -using EnableIfIsVectorArithmetic = cl::sycl::detail::enable_if_t< - cl::sycl::detail::is_vector_arithmetic::value, T>; +using EnableIfIsVectorArithmetic = __sycl_ns::detail::enable_if_t< + __sycl_ns::detail::is_vector_arithmetic::value, T>; template using EnableIfIsPointer = - cl::sycl::detail::enable_if_t::value, T>; + __sycl_ns::detail::enable_if_t<__sycl_ns::detail::is_pointer::value, + T>; template -using EnableIfIsTriviallyCopyable = cl::sycl::detail::enable_if_t< +using EnableIfIsTriviallyCopyable = __sycl_ns::detail::enable_if_t< std::is_trivially_copyable::value && - !cl::sycl::detail::is_vector_arithmetic::value, + !__sycl_ns::detail::is_vector_arithmetic::value, T>; // EnableIf shorthands for algorithms that depend on type and an operator template -using EnableIfIsScalarArithmeticNativeOp = cl::sycl::detail::enable_if_t< - cl::sycl::detail::is_scalar_arithmetic::value && - cl::sycl::detail::is_native_op::value, +using EnableIfIsScalarArithmeticNativeOp = __sycl_ns::detail::enable_if_t< + __sycl_ns::detail::is_scalar_arithmetic::value && + __sycl_ns::detail::is_native_op::value, T>; template -using EnableIfIsVectorArithmeticNativeOp = cl::sycl::detail::enable_if_t< - cl::sycl::detail::is_vector_arithmetic::value && - cl::sycl::detail::is_native_op::value, +using EnableIfIsVectorArithmeticNativeOp = __sycl_ns::detail::enable_if_t< + __sycl_ns::detail::is_vector_arithmetic::value && + __sycl_ns::detail::is_native_op::value, T>; // TODO: Lift TriviallyCopyable restriction eventually template -using EnableIfIsNonNativeOp = cl::sycl::detail::enable_if_t< - (!cl::sycl::detail::is_scalar_arithmetic::value && - !cl::sycl::detail::is_vector_arithmetic::value && +using EnableIfIsNonNativeOp = __sycl_ns::detail::enable_if_t< + (!__sycl_ns::detail::is_scalar_arithmetic::value && + !__sycl_ns::detail::is_vector_arithmetic::value && std::is_trivially_copyable::value) || - !cl::sycl::detail::is_native_op::value, + !__sycl_ns::detail::is_native_op::value, T>; template @@ -552,6 +552,6 @@ leader(Group g) { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() #endif // __DISABLE_SYCL_ONEAPI_GROUP_ALGORITHMS__ diff --git a/sycl/include/sycl/ext/oneapi/group_local_memory.hpp b/sycl/include/sycl/ext/oneapi/group_local_memory.hpp index 1f37c29c5bec1..6242717625bc4 100644 --- a/sycl/include/sycl/ext/oneapi/group_local_memory.hpp +++ b/sycl/include/sycl/ext/oneapi/group_local_memory.hpp @@ -19,8 +19,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { template @@ -66,5 +65,5 @@ std::enable_if_t::value && } } // namespace oneapi } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/matrix/matrix-aot-amx.hpp b/sycl/include/sycl/ext/oneapi/matrix/matrix-aot-amx.hpp index 4f703b7d92e54..b43cb7af62d97 100644 --- a/sycl/include/sycl/ext/oneapi/matrix/matrix-aot-amx.hpp +++ b/sycl/include/sycl/ext/oneapi/matrix/matrix-aot-amx.hpp @@ -35,8 +35,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace detail { @@ -444,5 +443,5 @@ joint_matrix_mad(Group sg, } // namespace experimental::matrix } // namespace intel } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/matrix/matrix-jit.hpp b/sycl/include/sycl/ext/oneapi/matrix/matrix-jit.hpp index 5343c3ccb301c..81be3db86360b 100644 --- a/sycl/include/sycl/ext/oneapi/matrix/matrix-jit.hpp +++ b/sycl/include/sycl/ext/oneapi/matrix/matrix-jit.hpp @@ -12,8 +12,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { namespace experimental::matrix { @@ -183,5 +182,5 @@ joint_matrix_mad(Group sg, joint_matrix &mA, } // namespace experimental::matrix } // namespace oneapi } // namespace ext -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/reduction.hpp b/sycl/include/sycl/ext/oneapi/reduction.hpp index f2d47d4781700..b0be774c23241 100644 --- a/sycl/include/sycl/ext/oneapi/reduction.hpp +++ b/sycl/include/sycl/ext/oneapi/reduction.hpp @@ -19,17 +19,16 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { namespace detail { -using cl::sycl::detail::bool_constant; -using cl::sycl::detail::enable_if_t; -using cl::sycl::detail::queue_impl; -using cl::sycl::detail::remove_AS; +using __sycl_ns::detail::bool_constant; +using __sycl_ns::detail::enable_if_t; +using __sycl_ns::detail::queue_impl; +using __sycl_ns::detail::remove_AS; // This type trait is used to detect if the atomic operation BinaryOperation // used with operands of the type T is available for using in reduction. @@ -2072,12 +2071,12 @@ __SYCL_INLINE_CONSTEXPR AccumulatorT known_identity_v = namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; namespace detail { - using cl::sycl::detail::queue_impl; + using __sycl_ns::detail::queue_impl; __SYCL_EXPORT size_t reduGetMaxWGSize(shared_ptr_class Queue, size_t LocalMemBytesPerWorkItem); __SYCL_EXPORT size_t reduComputeWGSize(size_t NWorkItems, size_t MaxWGSize, size_t &NWorkGroups); } // namespace detail } // namespace ONEAPI -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/include/sycl/ext/oneapi/sub_group.hpp b/sycl/include/sycl/ext/oneapi/sub_group.hpp index f17107dd92a5e..9f7082b994a5b 100644 --- a/sycl/include/sycl/ext/oneapi/sub_group.hpp +++ b/sycl/include/sycl/ext/oneapi/sub_group.hpp @@ -24,8 +24,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { template class multi_ptr; namespace detail { @@ -736,7 +735,7 @@ struct sub_group { } protected: - template friend class cl::sycl::nd_item; + template friend class __sycl_ns::nd_item; friend sub_group this_sub_group(); friend sub_group experimental::this_sub_group(); sub_group() = default; @@ -759,5 +758,5 @@ inline sub_group this_sub_group() { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/plugins/cuda/pi_cuda.cpp b/sycl/plugins/cuda/pi_cuda.cpp index 8fccf15f647b2..2090ee07e2635 100644 --- a/sycl/plugins/cuda/pi_cuda.cpp +++ b/sycl/plugins/cuda/pi_cuda.cpp @@ -273,8 +273,7 @@ void guessLocalWorkSize(int *threadsPerBlock, const size_t *global_work_size, } // anonymous namespace /// ------ Error handling, matching OpenCL plugin semantics. -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace pi { @@ -299,8 +298,8 @@ void assertion(bool Condition, const char *Message) { } // namespace pi } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() //-------------- // PI object implementation diff --git a/sycl/plugins/rocm/pi_rocm.cpp b/sycl/plugins/rocm/pi_rocm.cpp index aa4bbe5270efd..859669dfa26c1 100644 --- a/sycl/plugins/rocm/pi_rocm.cpp +++ b/sycl/plugins/rocm/pi_rocm.cpp @@ -332,8 +332,7 @@ void simpleGuessLocalWorkSize(int *threadsPerBlock, } // anonymous namespace /// ------ Error handling, matching OpenCL plugin semantics. -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace pi { @@ -358,8 +357,8 @@ void assertion(bool Condition, const char *Message) { } // namespace pi } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() //-------------- // PI object implementation diff --git a/sycl/source/accessor.cpp b/sycl/source/accessor.cpp index 7731615ea2b74..3bc22b2465b5b 100644 --- a/sycl/source/accessor.cpp +++ b/sycl/source/accessor.cpp @@ -9,12 +9,11 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { device getDeviceFromHandler(handler &CommandGroupHandlerRef) { return CommandGroupHandlerRef.MQueue->get_device(); } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index ef68f694ec4a9..e88229cf82c32 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -25,8 +25,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { static const plugin &getPlugin(backend Backend) { @@ -211,5 +210,5 @@ kernel make_kernel(pi_native_handle NativeHandle, const context &TargetContext, std::make_shared(PiKernel, ContextImpl)); } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/backend/level_zero.cpp b/sycl/source/backend/level_zero.cpp index 6463cc6e20bf2..16341717a014a 100644 --- a/sycl/source/backend/level_zero.cpp +++ b/sycl/source/backend/level_zero.cpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace level_zero { using namespace detail; @@ -103,5 +102,5 @@ __SYCL_EXPORT event make_event(const context &Context, } } // namespace level_zero -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/backend/opencl.cpp b/sycl/source/backend/opencl.cpp index 7e76478c8e630..279f83c8a2bf6 100644 --- a/sycl/source/backend/opencl.cpp +++ b/sycl/source/backend/opencl.cpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace opencl { using namespace detail; @@ -56,5 +55,5 @@ __SYCL_EXPORT queue make_queue(const context &Context, ContextImpl->get_async_handler(), backend::opencl); } } // namespace opencl -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/context.cpp b/sycl/source/context.cpp index dc887af21ddd1..dda8f9783c642 100644 --- a/sycl/source/context.cpp +++ b/sycl/source/context.cpp @@ -24,8 +24,7 @@ // 4.6.2 Context class -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { context::context(const property_list &PropList) : context(default_selector().select_device(), PropList) {} @@ -132,5 +131,5 @@ context::context(std::shared_ptr Impl) : impl(Impl) {} pi_native_handle context::getNative() const { return impl->getNative(); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/accessor_impl.cpp b/sycl/source/detail/accessor_impl.cpp index 4b3b2a144579a..5a8bc2a98b1a1 100644 --- a/sycl/source/detail/accessor_impl.cpp +++ b/sycl/source/detail/accessor_impl.cpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { AccessorImplHost::~AccessorImplHost() { @@ -38,5 +37,5 @@ void addHostAccessorAndWait(Requirement *Req) { Event->wait(Event); } } -} -} +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/allowlist.cpp b/sycl/source/detail/allowlist.cpp index fe8edecc5f2a4..7f358f57590e5 100644 --- a/sycl/source/detail/allowlist.cpp +++ b/sycl/source/detail/allowlist.cpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { constexpr char BackendNameKeyName[] = "BackendName"; @@ -370,5 +369,5 @@ void applyAllowList(std::vector &PiDevices, } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/allowlist.hpp b/sycl/source/detail/allowlist.hpp index b12f2eab5a3ac..aed60db0b6c84 100644 --- a/sycl/source/detail/allowlist.hpp +++ b/sycl/source/detail/allowlist.hpp @@ -15,8 +15,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { using DeviceDescT = std::map; @@ -31,5 +30,5 @@ void applyAllowList(std::vector &PiDevices, RT::PiPlatform PiPlatform, const plugin &Plugin); } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/backend_impl.hpp b/sycl/source/detail/backend_impl.hpp index f85c20c9cd6ef..dd6eba0523bb3 100644 --- a/sycl/source/detail/backend_impl.hpp +++ b/sycl/source/detail/backend_impl.hpp @@ -10,8 +10,7 @@ #pragma once #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template backend getImplBackend(const T &Impl) { @@ -25,5 +24,5 @@ template backend getImplBackend(const T &Impl) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/buffer_impl.cpp b/sycl/source/detail/buffer_impl.cpp index 4f3d018b601c3..1b0c8f63ca2ec 100644 --- a/sycl/source/detail/buffer_impl.cpp +++ b/sycl/source/detail/buffer_impl.cpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { void *buffer_impl::allocateMem(ContextImplPtr Context, bool InitFromUserData, void *HostPtr, RT::PiEvent &OutEventToWait) { @@ -28,5 +27,5 @@ void *buffer_impl::allocateMem(ContextImplPtr Context, bool InitFromUserData, BaseT::MInteropEvent, BaseT::MInteropContext, MProps, OutEventToWait); } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/builtins_common.cpp b/sycl/source/detail/builtins_common.cpp index 7e813d3273a91..10d7df232f2a4 100644 --- a/sycl/source/detail/builtins_common.cpp +++ b/sycl/source/detail/builtins_common.cpp @@ -19,7 +19,7 @@ #include -namespace s = cl::sycl; +namespace s = __sycl_ns; namespace d = s::detail; __SYCL_INLINE_NAMESPACE(cl) { diff --git a/sycl/source/detail/builtins_geometric.cpp b/sycl/source/detail/builtins_geometric.cpp index 9b75ba514ca7a..fafc40eebe266 100644 --- a/sycl/source/detail/builtins_geometric.cpp +++ b/sycl/source/detail/builtins_geometric.cpp @@ -14,7 +14,7 @@ #include -namespace s = cl::sycl; +namespace s = __sycl_ns; namespace d = s::detail; __SYCL_INLINE_NAMESPACE(cl) { diff --git a/sycl/source/detail/builtins_integer.cpp b/sycl/source/detail/builtins_integer.cpp index da3776c72614b..2036b959c324a 100644 --- a/sycl/source/detail/builtins_integer.cpp +++ b/sycl/source/detail/builtins_integer.cpp @@ -15,7 +15,7 @@ #include #include -namespace s = cl::sycl; +namespace s = __sycl_ns; namespace d = s::detail; __SYCL_INLINE_NAMESPACE(cl) { diff --git a/sycl/source/detail/builtins_math.cpp b/sycl/source/detail/builtins_math.cpp index 5a78d6cb80a5b..5699e6ad9ad83 100644 --- a/sycl/source/detail/builtins_math.cpp +++ b/sycl/source/detail/builtins_math.cpp @@ -20,7 +20,7 @@ #include -namespace s = cl::sycl; +namespace s = __sycl_ns; namespace d = s::detail; __SYCL_INLINE_NAMESPACE(cl) { diff --git a/sycl/source/detail/builtins_relational.cpp b/sycl/source/detail/builtins_relational.cpp index 8ae7ca1990689..a3aee270153d8 100644 --- a/sycl/source/detail/builtins_relational.cpp +++ b/sycl/source/detail/builtins_relational.cpp @@ -14,7 +14,7 @@ #include -namespace s = cl::sycl; +namespace s = __sycl_ns; namespace d = s::detail; __SYCL_INLINE_NAMESPACE(cl) { diff --git a/sycl/source/detail/circular_buffer.hpp b/sycl/source/detail/circular_buffer.hpp index c72c68c39ca82..330599910c296 100644 --- a/sycl/source/detail/circular_buffer.hpp +++ b/sycl/source/detail/circular_buffer.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // A partial implementation of a circular buffer: once its capacity is full, @@ -95,5 +94,5 @@ template class CircularBuffer { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/common.cpp b/sycl/source/detail/common.cpp index ae43d75e8edc3..c21640b533412 100644 --- a/sycl/source/detail/common.cpp +++ b/sycl/source/detail/common.cpp @@ -9,8 +9,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { const char *stringifyErrorCode(cl_int error) { @@ -241,5 +240,5 @@ std::vector split_string(const std::string &str, char delimeter) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/config.cpp b/sycl/source/detail/config.cpp index baf686c269fc9..224a7b9b3ba75 100644 --- a/sycl/source/detail/config.cpp +++ b/sycl/source/detail/config.cpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #ifndef SYCL_CONFIG_FILE_NAME @@ -136,5 +135,5 @@ const std::array, 6> &getSyclBeMap() { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/config.hpp b/sycl/source/detail/config.hpp index c81a246ad9296..5e6ad45f8f6f0 100644 --- a/sycl/source/detail/config.hpp +++ b/sycl/source/detail/config.hpp @@ -21,8 +21,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #ifdef DISABLE_CONFIG_FROM_ENV @@ -283,5 +282,5 @@ template <> class SYCLConfig { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/context_impl.cpp b/sycl/source/detail/context_impl.cpp index 32f2ed4df6191..225e0cd73b656 100644 --- a/sycl/source/detail/context_impl.cpp +++ b/sycl/source/detail/context_impl.cpp @@ -21,8 +21,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { context_impl::context_impl(const device &Device, async_handler AsyncHandler, @@ -32,7 +31,7 @@ context_impl::context_impl(const device &Device, async_handler AsyncHandler, MKernelProgramCache.setContextPtr(this); } -context_impl::context_impl(const std::vector Devices, +context_impl::context_impl(const std::vector<__sycl_ns::device> Devices, async_handler AsyncHandler, const property_list &PropList) : MAsyncHandler(AsyncHandler), MDevices(Devices), MContext(nullptr), @@ -95,7 +94,7 @@ context_impl::context_impl(RT::PiContext PiContext, async_handler AsyncHandler, // // TODO: Move this backend-specific retain of the context to SYCL-2020 style // make_context interop, when that is created. - if (getPlugin().getBackend() == cl::sycl::backend::opencl) { + if (getPlugin().getBackend() == __sycl_ns::backend::opencl) { getPlugin().call(MContext); } MKernelProgramCache.setContextPtr(this); @@ -142,18 +141,18 @@ template <> platform context_impl::get_info() const { return createSyclObjFromImpl(MPlatform); } template <> -std::vector +std::vector<__sycl_ns::device> context_impl::get_info() const { return MDevices; } template <> -std::vector +std::vector<__sycl_ns::memory_order> context_impl::get_info() const { if (is_host()) - return {cl::sycl::memory_order::relaxed, cl::sycl::memory_order::acquire, - cl::sycl::memory_order::release, cl::sycl::memory_order::acq_rel, - cl::sycl::memory_order::seq_cst}; + return {__sycl_ns::memory_order::relaxed, __sycl_ns::memory_order::acquire, + __sycl_ns::memory_order::release, __sycl_ns::memory_order::acq_rel, + __sycl_ns::memory_order::seq_cst}; pi_memory_order_capabilities Result; getPlugin().call( @@ -189,5 +188,5 @@ pi_native_handle context_impl::getNative() const { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/context_impl.hpp b/sycl/source/detail/context_impl.hpp index d8b2c38b524a8..4b6c7e42ac133 100644 --- a/sycl/source/detail/context_impl.hpp +++ b/sycl/source/detail/context_impl.hpp @@ -22,8 +22,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration class device; namespace detail { @@ -54,7 +53,7 @@ class context_impl { /// \param DeviceList is a list of SYCL device instances. /// \param AsyncHandler is an instance of async_handler. /// \param PropList is an instance of property_list. - context_impl(const std::vector DeviceList, + context_impl(const std::vector<__sycl_ns::device> DeviceList, async_handler AsyncHandler, const property_list &PropList); /// Construct a context_impl using plug-in interoperability handle. @@ -180,5 +179,5 @@ class context_impl { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/context_info.hpp b/sycl/source/detail/context_info.hpp index 737c6bbb7a508..d006d73a1b2f0 100644 --- a/sycl/source/detail/context_info.hpp +++ b/sycl/source/detail/context_info.hpp @@ -12,8 +12,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template struct get_context_info { @@ -49,5 +48,5 @@ struct get_context_info { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/device_binary_image.cpp b/sycl/source/detail/device_binary_image.cpp index c1ea2a347c061..92dcd797d5ca9 100644 --- a/sycl/source/detail/device_binary_image.cpp +++ b/sycl/source/detail/device_binary_image.cpp @@ -12,8 +12,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { DynRTDeviceBinaryImage::DynRTDeviceBinaryImage( @@ -48,5 +47,5 @@ DynRTDeviceBinaryImage::~DynRTDeviceBinaryImage() { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/device_filter.cpp b/sycl/source/detail/device_filter.cpp index 6ff840c578290..e149822a840d8 100644 --- a/sycl/source/detail/device_filter.cpp +++ b/sycl/source/detail/device_filter.cpp @@ -13,8 +13,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { device_filter::device_filter(const std::string &FilterString) { @@ -79,7 +78,7 @@ device_filter::device_filter(const std::string &FilterString) { "{host,opencl,level_zero,cuda,rocm,*}.\n" "Possible device types are {host,cpu,gpu,acc,*}.\n" "Device number should be an non-negative integer.\n"; - throw cl::sycl::invalid_parameter_error(Message, PI_INVALID_VALUE); + throw __sycl_ns::invalid_parameter_error(Message, PI_INVALID_VALUE); } } } @@ -156,5 +155,5 @@ bool device_filter_list::containsHost() { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/device_image_impl.hpp b/sycl/source/detail/device_image_impl.hpp index e6e9050d24d98..f21175683adbe 100644 --- a/sycl/source/detail/device_image_impl.hpp +++ b/sycl/source/detail/device_image_impl.hpp @@ -27,8 +27,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // The class is impl counterpart for sycl::device_image @@ -310,5 +309,5 @@ class device_image_impl { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/device_impl.cpp b/sycl/source/detail/device_impl.cpp index 8446dbe7127a4..7cc7b77e26ccb 100644 --- a/sycl/source/detail/device_impl.cpp +++ b/sycl/source/detail/device_impl.cpp @@ -12,8 +12,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { device_impl::device_impl() @@ -156,7 +155,7 @@ std::vector device_impl::create_sub_devices(size_t ComputeUnits) const { PI_INVALID_DEVICE); if (!is_partition_supported(info::partition_property::partition_equally)) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } size_t SubDevicesCount = get_info() / ComputeUnits; @@ -176,7 +175,7 @@ device_impl::create_sub_devices(const std::vector &Counts) const { PI_INVALID_DEVICE); if (!is_partition_supported(info::partition_property::partition_by_counts)) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } static const cl_device_partition_property P[] = { CL_DEVICE_PARTITION_BY_COUNTS, CL_DEVICE_PARTITION_BY_COUNTS_LIST_END, 0}; @@ -197,7 +196,7 @@ std::vector device_impl::create_sub_devices( if (!is_partition_supported( info::partition_property::partition_by_affinity_domain) || !is_affinity_supported(AffinityDomain)) { - throw cl::sycl::feature_not_supported(); + throw __sycl_ns::feature_not_supported(); } const pi_device_partition_property Properties[3] = { PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, @@ -332,5 +331,5 @@ std::shared_ptr device_impl::getHostDeviceImpl() { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/device_impl.hpp b/sycl/source/detail/device_impl.hpp index 8de4bb1435229..5cc440797fd36 100644 --- a/sycl/source/detail/device_impl.hpp +++ b/sycl/source/detail/device_impl.hpp @@ -16,8 +16,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration class platform; @@ -233,5 +232,5 @@ class device_impl { }; // class device_impl } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/device_info.hpp b/sycl/source/detail/device_info.hpp index 718a0919f906a..a19fffd9c55e2 100644 --- a/sycl/source/detail/device_info.hpp +++ b/sycl/source/detail/device_info.hpp @@ -23,8 +23,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { inline std::vector read_fp_bitfield(cl_device_fp_config bits) { @@ -1136,5 +1135,5 @@ get_device_info_host() { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/error_handling/enqueue_kernel.cpp b/sycl/source/detail/error_handling/enqueue_kernel.cpp index e968588525d47..dea87d52d6e13 100644 --- a/sycl/source/detail/error_handling/enqueue_kernel.cpp +++ b/sycl/source/detail/error_handling/enqueue_kernel.cpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace enqueue_kernel_launch { @@ -28,7 +27,7 @@ bool handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel, const plugin &Plugin = DeviceImpl.getPlugin(); RT::PiDevice Device = DeviceImpl.getHandleRef(); - cl::sycl::platform Platform = DeviceImpl.get_platform(); + __sycl_ns::platform Platform = DeviceImpl.get_platform(); if (HasLocalSize) { size_t MaxThreadsPerBlock[3] = {}; @@ -54,7 +53,7 @@ bool handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel, bool IsOpenCL = false; // Backend is any OpenCL version bool IsOpenCLV1x = false; // Backend is OpenCL 1.x bool IsOpenCLV20 = false; // Backend is OpenCL 2.0 - if (Platform.get_backend() == cl::sycl::backend::opencl) { + if (Platform.get_backend() == __sycl_ns::backend::opencl) { std::string VersionString = DeviceImpl.get_info(); IsOpenCL = true; IsOpenCLV1x = (VersionString.find("1.") == 0); @@ -326,5 +325,5 @@ bool handleError(pi_result Error, const device_impl &DeviceImpl, } // namespace enqueue_kernel_launch } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/error_handling/error_handling.hpp b/sycl/source/detail/error_handling/error_handling.hpp index 06bfe4cec173c..089887ff24ac0 100644 --- a/sycl/source/detail/error_handling/error_handling.hpp +++ b/sycl/source/detail/error_handling/error_handling.hpp @@ -12,8 +12,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace enqueue_kernel_launch { @@ -29,5 +28,5 @@ bool handleError(pi_result, const device_impl &, pi_kernel, const NDRDescT &); } // namespace enqueue_kernel_launch } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/event_impl.cpp b/sycl/source/detail/event_impl.cpp index 96581cf6a4b54..095c3b7682348 100644 --- a/sycl/source/detail/event_impl.cpp +++ b/sycl/source/detail/event_impl.cpp @@ -24,8 +24,7 @@ #include #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #ifdef XPTI_ENABLE_INSTRUMENTATION extern xpti::trace_event_data_t *GSYCLGraphEvent; @@ -100,7 +99,7 @@ event_impl::event_impl(RT::PiEvent Event, const context &SyclContext) MOpenCLInterop(true), MHostEvent(false), MState(HES_Complete) { if (MContext->is_host()) { - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "The syclContext must match the OpenCL context associated with the " "clEvent.", PI_INVALID_CONTEXT); @@ -111,7 +110,7 @@ event_impl::event_impl(RT::PiEvent Event, const context &SyclContext) sizeof(RT::PiContext), &TempContext, nullptr); if (MContext->getHandleRef() != TempContext) { - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "The syclContext must match the OpenCL context associated with the " "clEvent.", PI_INVALID_CONTEXT); @@ -186,7 +185,7 @@ void event_impl::instrumentationEpilog(void *TelemetryEvent, } void event_impl::wait( - std::shared_ptr Self) const { + std::shared_ptr<__sycl_ns::detail::event_impl> Self) const { #ifdef XPTI_ENABLE_INSTRUMENTATION void *TelemetryEvent = nullptr; uint64_t IId; @@ -209,7 +208,7 @@ void event_impl::wait( } void event_impl::wait_and_throw( - std::shared_ptr Self) { + std::shared_ptr<__sycl_ns::detail::event_impl> Self) { Command *Cmd = static_cast(Self->getCommand()); QueueImplPtr submittedQueue = nullptr; if (Cmd) @@ -228,7 +227,7 @@ void event_impl::wait_and_throw( } void event_impl::cleanupCommand( - std::shared_ptr Self) const { + std::shared_ptr<__sycl_ns::detail::event_impl> Self) const { if (MCommand && !SYCLConfig::get()) detail::Scheduler::getInstance().cleanupFinishedCommands(std::move(Self)); } @@ -326,5 +325,5 @@ pi_native_handle event_impl::getNative() const { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/event_impl.hpp b/sycl/source/detail/event_impl.hpp index d2b31fcdfbe69..47a47b355bfa4 100644 --- a/sycl/source/detail/event_impl.hpp +++ b/sycl/source/detail/event_impl.hpp @@ -18,15 +18,14 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { class context; namespace detail { class plugin; class context_impl; -using ContextImplPtr = std::shared_ptr; +using ContextImplPtr = std::shared_ptr<__sycl_ns::detail::context_impl>; class queue_impl; -using QueueImplPtr = std::shared_ptr; +using QueueImplPtr = std::shared_ptr<__sycl_ns::detail::queue_impl>; class event_impl { public: @@ -62,7 +61,7 @@ class event_impl { /// Self is needed in order to pass shared_ptr to Scheduler. /// /// \param Self is a pointer to this event. - void wait(std::shared_ptr Self) const; + void wait(std::shared_ptr<__sycl_ns::detail::event_impl> Self) const; /// Waits for the event. /// @@ -72,13 +71,14 @@ class event_impl { /// pass shared_ptr to Scheduler. /// /// \param Self is a pointer to this event. - void wait_and_throw(std::shared_ptr Self); + void wait_and_throw(std::shared_ptr<__sycl_ns::detail::event_impl> Self); /// Clean up the command associated with the event. Assumes that the task this /// event is associated with has been completed. /// /// \param Self is a pointer to this event. - void cleanupCommand(std::shared_ptr Self) const; + void + cleanupCommand(std::shared_ptr<__sycl_ns::detail::event_impl> Self) const; /// Queries this event for profiling information. /// @@ -186,5 +186,5 @@ class event_impl { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/event_info.hpp b/sycl/source/detail/event_info.hpp index 62d4ed01c2947..f5b57047c440c 100644 --- a/sycl/source/detail/event_info.hpp +++ b/sycl/source/detail/event_info.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template struct get_event_profiling_info { @@ -43,5 +42,5 @@ template struct get_event_info { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/filter_selector_impl.cpp b/sycl/source/detail/filter_selector_impl.cpp index 78fe5c6651a0c..a6b2cb21c68bf 100644 --- a/sycl/source/detail/filter_selector_impl.cpp +++ b/sycl/source/detail/filter_selector_impl.cpp @@ -19,8 +19,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { namespace detail { @@ -189,5 +188,5 @@ void filter_selector_impl::reset() const { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/filter_selector_impl.hpp b/sycl/source/detail/filter_selector_impl.hpp index d29b831ef921e..3054755a21ec8 100644 --- a/sycl/source/detail/filter_selector_impl.hpp +++ b/sycl/source/detail/filter_selector_impl.hpp @@ -13,8 +13,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations class device; @@ -46,5 +45,5 @@ class filter_selector_impl { namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { using namespace ext::oneapi; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/force_device.cpp b/sycl/source/detail/force_device.cpp index 052d6bbd1fb25..911d93a59b035 100644 --- a/sycl/source/detail/force_device.cpp +++ b/sycl/source/detail/force_device.cpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { bool match_types(const info::device_type &l, const info::device_type &r) { @@ -38,13 +37,13 @@ info::device_type get_forced_type() { if (type == "host") { return info::device_type::host; } - throw cl::sycl::runtime_error("SYCL_DEVICE_TYPE is not recognized. Must " - "be GPU, CPU, ACC or HOST.", - PI_INVALID_VALUE); + throw __sycl_ns::runtime_error("SYCL_DEVICE_TYPE is not recognized. Must " + "be GPU, CPU, ACC or HOST.", + PI_INVALID_VALUE); } return info::device_type::all; } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/force_device.hpp b/sycl/source/detail/force_device.hpp index 0700634ade578..fb9fa05db7536 100644 --- a/sycl/source/detail/force_device.hpp +++ b/sycl/source/detail/force_device.hpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { bool match_types(const info::device_type &l, const info::device_type &r); @@ -20,5 +19,5 @@ bool match_types(const info::device_type &l, const info::device_type &r); info::device_type get_forced_type(); } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/global_handler.cpp b/sycl/source/detail/global_handler.cpp index 692a0044157c2..143ac3652eaba 100644 --- a/sycl/source/detail/global_handler.cpp +++ b/sycl/source/detail/global_handler.cpp @@ -22,8 +22,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { using LockGuard = std::lock_guard; @@ -129,5 +128,5 @@ extern "C" __SYCL_EXPORT BOOL WINAPI DllMain(HINSTANCE hinstDLL, __attribute__((destructor(110))) static void syclUnload() { shutdown(); } #endif } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/global_handler.hpp b/sycl/source/detail/global_handler.hpp index fe785f96c50d9..b1bcb0144c749 100644 --- a/sycl/source/detail/global_handler.hpp +++ b/sycl/source/detail/global_handler.hpp @@ -13,8 +13,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class platform_impl; class Scheduler; @@ -89,5 +88,5 @@ class GlobalHandler { InstWithLock MHandlerExtendedMembersMutex; }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/handler_proxy.cpp b/sycl/source/detail/handler_proxy.cpp index c294634763b76..cdf005dc0f026 100644 --- a/sycl/source/detail/handler_proxy.cpp +++ b/sycl/source/detail/handler_proxy.cpp @@ -10,8 +10,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { void associateWithHandler(handler &CGH, AccessorBaseHost *Acc, @@ -20,5 +19,5 @@ void associateWithHandler(handler &CGH, AccessorBaseHost *Acc, } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/helpers.cpp b/sycl/source/detail/helpers.cpp index 73ed626761904..7f96e4d518d3e 100644 --- a/sycl/source/detail/helpers.cpp +++ b/sycl/source/detail/helpers.cpp @@ -14,12 +14,12 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { -using ContextImplPtr = std::shared_ptr; +__SYCL_OPEN_NS() { +using ContextImplPtr = std::shared_ptr<__sycl_ns::detail::context_impl>; namespace detail { -std::vector getOrWaitEvents(std::vector DepEvents, - ContextImplPtr Context) { +std::vector +getOrWaitEvents(std::vector<__sycl_ns::event> DepEvents, + ContextImplPtr Context) { std::vector Events; for (auto SyclEvent : DepEvents) { auto SyclEventImplPtr = detail::getSyclObjImpl(SyclEvent); @@ -33,12 +33,12 @@ std::vector getOrWaitEvents(std::vector DepEvents, return Events; } -void waitEvents(std::vector DepEvents) { +void waitEvents(std::vector<__sycl_ns::event> DepEvents) { for (auto SyclEvent : DepEvents) { detail::getSyclObjImpl(SyclEvent)->waitInternal(); } } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/image_accessor_util.cpp b/sycl/source/detail/image_accessor_util.cpp index 06b32c56a0556..6d34afb2f17d4 100644 --- a/sycl/source/detail/image_accessor_util.cpp +++ b/sycl/source/detail/image_accessor_util.cpp @@ -9,8 +9,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // For Nearest Filtering mode, process cl_float4 Coordinates and return the @@ -23,12 +22,12 @@ cl_int4 getPixelCoordNearestFiltMode(cl_float4 Coorduvw, switch (SmplAddrMode) { case addressing_mode::mirrored_repeat: { cl_float4 Tempuvw(0); - Tempuvw = 2.0f * cl::sycl::rint(0.5f * Coorduvw); - Tempuvw = cl::sycl::fabs(Coorduvw - Tempuvw); + Tempuvw = 2.0f * __sycl_ns::rint(0.5f * Coorduvw); + Tempuvw = __sycl_ns::fabs(Coorduvw - Tempuvw); Tempuvw = Tempuvw * (Rangewhd.convert()); - Tempuvw = (cl::sycl::floor(Tempuvw)); + Tempuvw = (__sycl_ns::floor(Tempuvw)); Coordijk = Tempuvw.convert(); - Coordijk = cl::sycl::min(Coordijk, (Rangewhd - 1)); + Coordijk = __sycl_ns::min(Coordijk, (Rangewhd - 1)); // Eg: // u,v,w = {2.3,1.7,0.5} // normalized coordinates. // w,h,d = {9,9,9} @@ -48,11 +47,11 @@ cl_int4 getPixelCoordNearestFiltMode(cl_float4 Coorduvw, cl_float4 Tempuvw(0); Tempuvw = - (Coorduvw - cl::sycl::floor(Coorduvw)) * Rangewhd.convert(); - Coordijk = (cl::sycl::floor(Tempuvw)).convert(); + (Coorduvw - __sycl_ns::floor(Coorduvw)) * Rangewhd.convert(); + Coordijk = (__sycl_ns::floor(Tempuvw)).convert(); cl_int4 GreaterThanEqual = (Coordijk >= Rangewhd); Coordijk = - cl::sycl::select(Coordijk, (Coordijk - Rangewhd), GreaterThanEqual); + __sycl_ns::select(Coordijk, (Coordijk - Rangewhd), GreaterThanEqual); // Eg: // u = 2.3; v = 1.5; w = 0.5; // normalized coordinates. // w,h,d = {9,9,9}; @@ -70,15 +69,15 @@ cl_int4 getPixelCoordNearestFiltMode(cl_float4 Coorduvw, // i = 2; j = 4; k = 4; } break; case addressing_mode::clamp_to_edge: - Coordijk = (cl::sycl::floor(Coorduvw)).convert(); - Coordijk = cl::sycl::clamp(Coordijk, cl_int4(0), (Rangewhd - 1)); + Coordijk = (__sycl_ns::floor(Coorduvw)).convert(); + Coordijk = __sycl_ns::clamp(Coordijk, cl_int4(0), (Rangewhd - 1)); break; case addressing_mode::clamp: - Coordijk = (cl::sycl::floor(Coorduvw)).convert(); - Coordijk = cl::sycl::clamp(Coordijk, cl_int4(-1), Rangewhd); + Coordijk = (__sycl_ns::floor(Coorduvw)).convert(); + Coordijk = __sycl_ns::clamp(Coordijk, cl_int4(-1), Rangewhd); break; case addressing_mode::none: - Coordijk = (cl::sycl::floor(Coorduvw)).convert(); + Coordijk = (__sycl_ns::floor(Coorduvw)).convert(); break; } return Coordijk; @@ -96,45 +95,46 @@ cl_int8 getPixelCoordLinearFiltMode(cl_float4 Coorduvw, cl_int4 Rangewhd(ImgRange[0], ImgRange[1], ImgRange[2], 0); cl_int4 Ci0j0k0(0); cl_int4 Ci1j1k1(0); - cl_int4 Int_uvwsubhalf = cl::sycl::floor(Coorduvw - 0.5f).convert(); + cl_int4 Int_uvwsubhalf = __sycl_ns::floor(Coorduvw - 0.5f).convert(); switch (SmplAddrMode) { case addressing_mode::mirrored_repeat: { cl_float4 Temp; - Temp = (cl::sycl::rint(Coorduvw * 0.5f)) * 2.0f; - Temp = cl::sycl::fabs(Coorduvw - Temp); + Temp = (__sycl_ns::rint(Coorduvw * 0.5f)) * 2.0f; + Temp = __sycl_ns::fabs(Coorduvw - Temp); Coorduvw = Temp * Rangewhd.convert(); - Int_uvwsubhalf = cl::sycl::floor(Coorduvw - 0.5f).convert(); + Int_uvwsubhalf = __sycl_ns::floor(Coorduvw - 0.5f).convert(); Ci0j0k0 = Int_uvwsubhalf; Ci1j1k1 = Ci0j0k0 + 1; - Ci0j0k0 = cl::sycl::max(Ci0j0k0, 0); - Ci1j1k1 = cl::sycl::min(Ci1j1k1, (Rangewhd - 1)); + Ci0j0k0 = __sycl_ns::max(Ci0j0k0, 0); + Ci1j1k1 = __sycl_ns::min(Ci1j1k1, (Rangewhd - 1)); } break; case addressing_mode::repeat: { Coorduvw = - (Coorduvw - cl::sycl::floor(Coorduvw)) * Rangewhd.convert(); - Int_uvwsubhalf = cl::sycl::floor(Coorduvw - 0.5f).convert(); + (Coorduvw - __sycl_ns::floor(Coorduvw)) * Rangewhd.convert(); + Int_uvwsubhalf = __sycl_ns::floor(Coorduvw - 0.5f).convert(); Ci0j0k0 = Int_uvwsubhalf; Ci1j1k1 = Ci0j0k0 + 1; Ci0j0k0 = - cl::sycl::select(Ci0j0k0, (Ci0j0k0 + Rangewhd), Ci0j0k0 < cl_int4(0)); + __sycl_ns::select(Ci0j0k0, (Ci0j0k0 + Rangewhd), Ci0j0k0 < cl_int4(0)); Ci1j1k1 = - cl::sycl::select(Ci1j1k1, (Ci1j1k1 - Rangewhd), Ci1j1k1 >= Rangewhd); + __sycl_ns::select(Ci1j1k1, (Ci1j1k1 - Rangewhd), Ci1j1k1 >= Rangewhd); } break; case addressing_mode::clamp_to_edge: { - Ci0j0k0 = cl::sycl::clamp(Int_uvwsubhalf, cl_int4(0), (Rangewhd - 1)); - Ci1j1k1 = cl::sycl::clamp((Int_uvwsubhalf + 1), cl_int4(0), (Rangewhd - 1)); + Ci0j0k0 = __sycl_ns::clamp(Int_uvwsubhalf, cl_int4(0), (Rangewhd - 1)); + Ci1j1k1 = + __sycl_ns::clamp((Int_uvwsubhalf + 1), cl_int4(0), (Rangewhd - 1)); break; } case addressing_mode::clamp: { - Ci0j0k0 = cl::sycl::clamp(Int_uvwsubhalf, cl_int4(-1), Rangewhd); - Ci1j1k1 = cl::sycl::clamp((Int_uvwsubhalf + 1), cl_int4(-1), Rangewhd); + Ci0j0k0 = __sycl_ns::clamp(Int_uvwsubhalf, cl_int4(-1), Rangewhd); + Ci1j1k1 = __sycl_ns::clamp((Int_uvwsubhalf + 1), cl_int4(-1), Rangewhd); break; } case addressing_mode::none: { @@ -188,5 +188,5 @@ cl_float4 getBorderColor(const image_channel_order ImgChannelOrder) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/image_impl.cpp b/sycl/source/detail/image_impl.cpp index f84377145cd99..f383876e2c8af 100644 --- a/sycl/source/detail/image_impl.cpp +++ b/sycl/source/detail/image_impl.cpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template @@ -455,5 +454,5 @@ template class image_impl<2>; template class image_impl<3>; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/kernel_bundle_impl.hpp b/sycl/source/detail/kernel_bundle_impl.hpp index daa16ef08a717..43b5fadc2df79 100644 --- a/sycl/source/detail/kernel_bundle_impl.hpp +++ b/sycl/source/detail/kernel_bundle_impl.hpp @@ -24,8 +24,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template struct LessByHash { @@ -486,5 +485,5 @@ class kernel_bundle_impl { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/kernel_id_impl.hpp b/sycl/source/detail/kernel_id_impl.hpp index 51a716bc24de1..c72eaaf3de90d 100644 --- a/sycl/source/detail/kernel_id_impl.hpp +++ b/sycl/source/detail/kernel_id_impl.hpp @@ -8,8 +8,7 @@ #pragma once -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // Used for sorting vector of kernel_id's @@ -42,5 +41,5 @@ class kernel_id_impl { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/kernel_impl.cpp b/sycl/source/detail/kernel_impl.cpp index ffda1739c238b..8f892c165cbf1 100644 --- a/sycl/source/detail/kernel_impl.cpp +++ b/sycl/source/detail/kernel_impl.cpp @@ -13,8 +13,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { kernel_impl::kernel_impl(RT::PiKernel Kernel, ContextImplPtr Context) @@ -44,7 +43,7 @@ kernel_impl::kernel_impl(RT::PiKernel Kernel, ContextImplPtr ContextImpl, getPlugin().call( MKernel, PI_KERNEL_INFO_CONTEXT, sizeof(Context), &Context, nullptr); if (ContextImpl->getHandleRef() != Context) - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Input context must be the same as the context of cl_kernel", PI_INVALID_CONTEXT); } @@ -91,5 +90,5 @@ bool kernel_impl::isCreatedFromSource() const { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/kernel_impl.hpp b/sycl/source/detail/kernel_impl.hpp index f4b734d37ebe8..8e0a993a74dec 100644 --- a/sycl/source/detail/kernel_impl.hpp +++ b/sycl/source/detail/kernel_impl.hpp @@ -21,8 +21,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // Forward declaration class program_impl; @@ -289,5 +288,5 @@ kernel_impl::get_sub_group_info( } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/kernel_info.hpp b/sycl/source/detail/kernel_info.hpp index 85f46e00637e3..ad8159b385ae7 100644 --- a/sycl/source/detail/kernel_info.hpp +++ b/sycl/source/detail/kernel_info.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // OpenCL kernel information methods @@ -91,26 +90,26 @@ struct get_kernel_device_specific_info { }; template -struct get_kernel_device_specific_info, Param> { - static cl::sycl::range<3> get(RT::PiKernel Kernel, RT::PiDevice Device, - const plugin &Plugin) { +struct get_kernel_device_specific_info<__sycl_ns::range<3>, Param> { + static __sycl_ns::range<3> get(RT::PiKernel Kernel, RT::PiDevice Device, + const plugin &Plugin) { size_t Result[3]; // TODO catch an exception and put it to list of asynchronous exceptions Plugin.call( Kernel, Device, pi::cast(Param), sizeof(size_t) * 3, Result, nullptr); - return cl::sycl::range<3>(Result[0], Result[1], Result[2]); + return __sycl_ns::range<3>(Result[0], Result[1], Result[2]); } }; template inline typename info::param_traits::return_type -get_kernel_device_specific_info_host(const cl::sycl::device &Device); +get_kernel_device_specific_info_host(const __sycl_ns::device &Device); template <> -inline cl::sycl::range<3> get_kernel_device_specific_info_host< - info::kernel_device_specific::global_work_size>(const cl::sycl::device &) { +inline __sycl_ns::range<3> get_kernel_device_specific_info_host< + info::kernel_device_specific::global_work_size>(const __sycl_ns::device &) { throw invalid_object_error("This instance of kernel is a host instance", PI_INVALID_KERNEL); } @@ -118,35 +117,35 @@ inline cl::sycl::range<3> get_kernel_device_specific_info_host< template <> inline size_t get_kernel_device_specific_info_host< info::kernel_device_specific::work_group_size>( - const cl::sycl::device &Dev) { + const __sycl_ns::device &Dev) { return Dev.get_info(); } template <> -inline cl::sycl::range<3> get_kernel_device_specific_info_host< +inline __sycl_ns::range<3> get_kernel_device_specific_info_host< info::kernel_device_specific::compile_work_group_size>( - const cl::sycl::device &) { + const __sycl_ns::device &) { return {0, 0, 0}; } template <> inline size_t get_kernel_device_specific_info_host< info::kernel_device_specific::preferred_work_group_size_multiple>( - const cl::sycl::device &Dev) { + const __sycl_ns::device &Dev) { return get_kernel_device_specific_info_host< info::kernel_device_specific::work_group_size>(Dev); } template <> inline cl_ulong get_kernel_device_specific_info_host< - info::kernel_device_specific::private_mem_size>(const cl::sycl::device &) { + info::kernel_device_specific::private_mem_size>(const __sycl_ns::device &) { return 0; } template <> inline uint32_t get_kernel_device_specific_info_host< info::kernel_device_specific::max_num_sub_groups>( - const cl::sycl::device &) { + const __sycl_ns::device &) { throw invalid_object_error("This instance of kernel is a host instance", PI_INVALID_KERNEL); } @@ -154,7 +153,7 @@ inline uint32_t get_kernel_device_specific_info_host< template <> inline uint32_t get_kernel_device_specific_info_host< info::kernel_device_specific::compile_num_sub_groups>( - const cl::sycl::device &) { + const __sycl_ns::device &) { throw invalid_object_error("This instance of kernel is a host instance", PI_INVALID_KERNEL); } @@ -162,7 +161,7 @@ inline uint32_t get_kernel_device_specific_info_host< template <> inline uint32_t get_kernel_device_specific_info_host< info::kernel_device_specific::compile_sub_group_size>( - const cl::sycl::device &) { + const __sycl_ns::device &) { throw invalid_object_error("This instance of kernel is a host instance", PI_INVALID_KERNEL); } @@ -170,7 +169,7 @@ inline uint32_t get_kernel_device_specific_info_host< template struct get_kernel_device_specific_info_with_input { static uint32_t get(RT::PiKernel Kernel, RT::PiDevice Device, - cl::sycl::range<3> In, const plugin &Plugin) { + __sycl_ns::range<3> In, const plugin &Plugin) { size_t Input[3] = {In[0], In[1], In[2]}; uint32_t Result; // TODO catch an exception and put it to list of asynchronous exceptions @@ -182,5 +181,5 @@ struct get_kernel_device_specific_info_with_input { } }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/kernel_program_cache.cpp b/sycl/source/detail/kernel_program_cache.cpp index 18b13f3fd589c..bb181ac85247c 100644 --- a/sycl/source/detail/kernel_program_cache.cpp +++ b/sycl/source/detail/kernel_program_cache.cpp @@ -10,8 +10,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { KernelProgramCache::~KernelProgramCache() { for (auto &ProgIt : MCachedPrograms) { @@ -41,5 +40,5 @@ KernelProgramCache::~KernelProgramCache() { } } } -} -} +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/kernel_program_cache.hpp b/sycl/source/detail/kernel_program_cache.hpp index 356c0a1288429..49490f0f9e455 100644 --- a/sycl/source/detail/kernel_program_cache.hpp +++ b/sycl/source/detail/kernel_program_cache.hpp @@ -24,13 +24,12 @@ // For testing purposes class MockKernelProgramCache; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class context_impl; class KernelProgramCache { public: - /// Denotes build error data. The data is filled in from cl::sycl::exception + /// Denotes build error data. The data is filled in from sycl::exception /// class instance. struct BuildError { std::string Msg; @@ -143,5 +142,5 @@ class KernelProgramCache { friend class ::MockKernelProgramCache; }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/memory_manager.cpp b/sycl/source/detail/memory_manager.cpp index d8d4a05c4b75c..9510851e05803 100644 --- a/sycl/source/detail/memory_manager.cpp +++ b/sycl/source/detail/memory_manager.cpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { static void waitForEvents(const std::vector &Events) { @@ -717,5 +716,5 @@ void MemoryManager::advise_usm(const void *Mem, QueueImplPtr Queue, } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/online_compiler/online_compiler.cpp b/sycl/source/detail/online_compiler/online_compiler.cpp index 2c304f602af8d..7cbf5602e5985 100644 --- a/sycl/source/detail/online_compiler/online_compiler.cpp +++ b/sycl/source/detail/online_compiler/online_compiler.cpp @@ -14,8 +14,7 @@ #include "ocloc_api.h" -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace intel { namespace detail { @@ -251,5 +250,5 @@ namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL { return MOnlineCompiler.compile(Source, UserArgs); } } // namespace INTEL -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/os_util.cpp b/sycl/source/detail/os_util.cpp index 36d42624d6714..d48b09a8f52c5 100644 --- a/sycl/source/detail/os_util.cpp +++ b/sycl/source/detail/os_util.cpp @@ -42,8 +42,7 @@ #endif // __SYCL_RT_OS -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #if defined(__SYCL_RT_OS_LINUX) @@ -300,5 +299,5 @@ int OSUtil::makeDir(const char *Dir) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/persistent_device_code_cache.cpp b/sycl/source/detail/persistent_device_code_cache.cpp index 0ad560b6094ca..0c6b1700067b9 100644 --- a/sycl/source/detail/persistent_device_code_cache.cpp +++ b/sycl/source/detail/persistent_device_code_cache.cpp @@ -19,8 +19,7 @@ #include #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { /* Lock file suffix */ @@ -410,5 +409,5 @@ std::string PersistentDeviceCodeCache::getRootDir() { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/persistent_device_code_cache.hpp b/sycl/source/detail/persistent_device_code_cache.hpp index d02ca5f03915e..4999eade3ab45 100644 --- a/sycl/source/detail/persistent_device_code_cache.hpp +++ b/sycl/source/detail/persistent_device_code_cache.hpp @@ -20,8 +20,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { /* This is temporary solution until std::filesystem is available when SYCL RT @@ -192,5 +191,5 @@ class PersistentDeviceCodeCache { } }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/pi.cpp b/sycl/source/detail/pi.cpp index 4c5a323c35499..afa03edf68008 100644 --- a/sycl/source/detail/pi.cpp +++ b/sycl/source/detail/pi.cpp @@ -42,8 +42,7 @@ #define SYCL_VERSION_STR \ "sycl " STR(__LIBSYCL_MAJOR_VERSION) "." STR(__LIBSYCL_MINOR_VERSION) -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #ifdef XPTI_ENABLE_INSTRUMENTATION // Global (to the SYCL runtime) graph handle that all command groups are a @@ -61,20 +60,20 @@ constexpr uint32_t GMinVer = __LIBSYCL_MINOR_VERSION; constexpr const char *GVerStr = SYCL_VERSION_STR; #endif // XPTI_ENABLE_INSTRUMENTATION -template +template <__sycl_ns::backend BE> void *getPluginOpaqueData(void *OpaqueDataParam) { void *ReturnOpaqueData = nullptr; - const cl::sycl::detail::plugin &Plugin = - cl::sycl::detail::pi::getPlugin(); + const __sycl_ns::detail::plugin &Plugin = + __sycl_ns::detail::pi::getPlugin(); - Plugin.call( + Plugin.call<__sycl_ns::detail::PiApiKind::piextPluginGetOpaqueData>( OpaqueDataParam, &ReturnOpaqueData); return ReturnOpaqueData; } template __SYCL_EXPORT void * -getPluginOpaqueData(void *); +getPluginOpaqueData<__sycl_ns::backend::esimd_cpu>(void *); namespace pi { @@ -180,7 +179,7 @@ void emitFunctionWithArgsEndTrace(uint64_t CorrelationID, uint32_t FuncID, #endif } -void contextSetExtendedDeleter(const cl::sycl::context &context, +void contextSetExtendedDeleter(const __sycl_ns::context &context, pi_context_extended_deleter func, void *user_data) { auto impl = getSyclObjImpl(context); @@ -204,7 +203,7 @@ std::string platformInfoToString(pi_platform_info info) { return "PI_PLATFORM_INFO_EXTENSIONS"; } die("Unknown pi_platform_info value passed to " - "cl::sycl::detail::pi::platformInfoToString"); + "__sycl_ns::detail::pi::platformInfoToString"); } std::string memFlagToString(pi_mem_flags Flag) { @@ -713,5 +712,5 @@ void DeviceBinaryImage::init(pi_device_binary Bin) { } // namespace pi } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/platform_impl.cpp b/sycl/source/detail/platform_impl.cpp index 42a639dae7835..eef8aae6b4efb 100644 --- a/sycl/source/detail/platform_impl.cpp +++ b/sycl/source/detail/platform_impl.cpp @@ -20,8 +20,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { using PlatformImplPtr = std::shared_ptr; @@ -297,5 +296,5 @@ bool platform_impl::has(aspect Aspect) const { #undef __SYCL_PARAM_TRAITS_SPEC } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/platform_impl.hpp b/sycl/source/detail/platform_impl.hpp index 37c5f03aa0a64..c4a4b3aa0841d 100644 --- a/sycl/source/detail/platform_impl.hpp +++ b/sycl/source/detail/platform_impl.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declaration class device_selector; @@ -189,5 +188,5 @@ class platform_impl { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/platform_info.hpp b/sycl/source/detail/platform_info.hpp index ff385c3bb4250..262ea191141e7 100644 --- a/sycl/source/detail/platform_info.hpp +++ b/sycl/source/detail/platform_info.hpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // The platform information methods @@ -81,5 +80,5 @@ get_platform_info_host() { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/platform_util.cpp b/sycl/source/detail/platform_util.cpp index 1ba46fd66aef3..ba1ffc60f0cc8 100644 --- a/sycl/source/detail/platform_util.cpp +++ b/sycl/source/detail/platform_util.cpp @@ -20,8 +20,7 @@ #include #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #if defined(__x86_64__) || defined(__i386__) @@ -179,5 +178,5 @@ void PlatformUtil::prefetch(const char *Ptr, size_t NumBytes) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/platform_util.hpp b/sycl/source/detail/platform_util.hpp index bf7a445d349ae..aeb9a9b2f3c17 100644 --- a/sycl/source/detail/platform_util.hpp +++ b/sycl/source/detail/platform_util.hpp @@ -16,8 +16,7 @@ #define __builtin_expect(a, b) (a) #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { struct PlatformUtil { @@ -44,5 +43,5 @@ struct PlatformUtil { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/plugin.hpp b/sycl/source/detail/plugin.hpp index bfd614893f221..da0e95f1eb861 100644 --- a/sycl/source/detail/plugin.hpp +++ b/sycl/source/detail/plugin.hpp @@ -21,8 +21,7 @@ #include "xpti_trace_framework.h" #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #ifdef XPTI_ENABLE_INSTRUMENTATION extern xpti::trace_event_data_t *GPICallEvent; @@ -107,16 +106,16 @@ class plugin { /// Checks return value from PI calls. /// /// \throw Exception if pi_result is not a PI_SUCCESS. - template + template void checkPiResult(RT::PiResult pi_result) const { __SYCL_CHECK_OCL_CODE_THROW(pi_result, Exception); } void reportPiError(RT::PiResult pi_result, const char *context) const { if (pi_result != PI_SUCCESS) { - throw cl::sycl::runtime_error( + throw __sycl_ns::runtime_error( std::string(context) + " API failed with error: " + - cl::sycl::detail::codeToString(pi_result), + __sycl_ns::detail::codeToString(pi_result), pi_result); } } @@ -172,7 +171,7 @@ class plugin { /// Calls the API, traces the call, checks the result /// - /// \throw cl::sycl::runtime_exception if the call was not successful. + /// \throw sycl::runtime_exception if the call was not successful. template void call(ArgsT... Args) const { RT::PiResult Err = call_nocheck(Args...); @@ -191,5 +190,5 @@ class plugin { std::shared_ptr TracingMutex; }; // class plugin } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/plugin_printers.hpp b/sycl/source/detail/plugin_printers.hpp index b28dc24dcc472..1eb6a5785c1fb 100644 --- a/sycl/source/detail/plugin_printers.hpp +++ b/sycl/source/detail/plugin_printers.hpp @@ -14,8 +14,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace pi { @@ -178,5 +177,5 @@ void printOuts(Arg0 arg0, Args... args) { } // namespace pi } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/posix_pi.cpp b/sycl/source/detail/posix_pi.cpp index 2e501abecafaa..621e041079e8d 100644 --- a/sycl/source/detail/posix_pi.cpp +++ b/sycl/source/detail/posix_pi.cpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace pi { @@ -30,5 +29,5 @@ void *getOsLibraryFuncAddress(void *Library, const std::string &FunctionName) { } // namespace pi } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/program_impl.cpp b/sycl/source/detail/program_impl.cpp index 8090280afa7e0..910f485c1b3eb 100644 --- a/sycl/source/detail/program_impl.cpp +++ b/sycl/source/detail/program_impl.cpp @@ -22,8 +22,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { program_impl::program_impl(ContextImplPtr Context, @@ -523,7 +522,7 @@ std::vector program_impl::get_info() const { void program_impl::set_spec_constant_impl(const char *Name, const void *ValAddr, size_t ValSize) { if (MState != program_state::none) - throw cl::sycl::ext::oneapi::experimental::spec_const_error( + throw __sycl_ns::ext::oneapi::experimental::spec_const_error( "Invalid program state", PI_INVALID_PROGRAM); // Reuse cached programs lock as opposed to introducing a new lock. auto LockGuard = MContext->getKernelProgramCache().acquireCachedPrograms(); @@ -581,5 +580,5 @@ pi_native_handle program_impl::getNative() const { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/program_impl.hpp b/sycl/source/detail/program_impl.hpp index 83e36eded6e14..e678cd6b4a79f 100644 --- a/sycl/source/detail/program_impl.hpp +++ b/sycl/source/detail/program_impl.hpp @@ -24,8 +24,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Forward declarations class kernel; @@ -459,5 +458,5 @@ template <> std::vector program_impl::get_info() const; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 645f4710559bd..c0d9ea5e57964 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -37,11 +37,10 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { -using ContextImplPtr = std::shared_ptr; +using ContextImplPtr = std::shared_ptr<__sycl_ns::detail::context_impl>; static constexpr int DbgProgMgr = 0; @@ -802,7 +801,7 @@ ProgramManager::getDeviceImage(OSModuleHandle M, KernelSetId KSId, pi_uint32 ImgInd = 0; RTDeviceBinaryImage *Img = nullptr; - // TODO: There may be cases with cl::sycl::program class usage in source code + // TODO: There may be cases with sycl::program class usage in source code // that will result in a multi-device context. This case needs to be handled // here or at the program_impl class level @@ -1785,11 +1784,11 @@ std::pair ProgramManager::getOrCreateKernel( } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() extern "C" void __sycl_register_lib(pi_device_binaries desc) { - cl::sycl::detail::ProgramManager::getInstance().addImages(desc); + __sycl_ns::detail::ProgramManager::getInstance().addImages(desc); } // Executed as a part of current module's (.exe, .dll) static initialization diff --git a/sycl/source/detail/program_manager/program_manager.hpp b/sycl/source/detail/program_manager/program_manager.hpp index cfa23ede6234e..ef4fd79c0f2bb 100644 --- a/sycl/source/detail/program_manager/program_manager.hpp +++ b/sycl/source/detail/program_manager/program_manager.hpp @@ -37,8 +37,7 @@ extern "C" __SYCL_EXPORT void __sycl_unregister_lib(pi_device_binaries desc); // +++ } -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { class context; namespace detail { @@ -320,5 +319,5 @@ class ProgramManager { bool m_UseSpvFile = false; }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index 40d30f7f7acc0..33113341432be 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -22,8 +22,7 @@ #include #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template <> cl_uint queue_impl::get_info() const { RT::PiResult result = PI_SUCCESS; @@ -352,5 +351,5 @@ pi_native_handle queue_impl::getNative() const { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/queue_impl.hpp b/sycl/source/detail/queue_impl.hpp index 031b893fd05bd..0895f3afdfe90 100644 --- a/sycl/source/detail/queue_impl.hpp +++ b/sycl/source/detail/queue_impl.hpp @@ -28,8 +28,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { using ContextImplPtr = std::shared_ptr; @@ -81,7 +80,7 @@ class queue_impl { : MDevice(Device), MContext(Context), MAsyncHandler(AsyncHandler), MPropList(PropList), MHostQueue(MDevice->is_host()) { if (!Context->hasDevice(Device)) - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Queue cannot be constructed with the given context and device " "as the context does not contain the given device.", PI_INVALID_DEVICE); @@ -477,5 +476,5 @@ class queue_impl { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/reduction.cpp b/sycl/source/detail/reduction.cpp index 6f268f2fb15a6..6c1ac80719961 100644 --- a/sycl/source/detail/reduction.cpp +++ b/sycl/source/detail/reduction.cpp @@ -9,8 +9,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace ext { namespace oneapi { namespace detail { @@ -131,5 +130,5 @@ namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { } } // namespace detail } // namespace ONEAPI -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/sampler_impl.cpp b/sycl/source/detail/sampler_impl.cpp index f7a56b56bb78a..f1ca7179f6e8a 100644 --- a/sycl/source/detail/sampler_impl.cpp +++ b/sycl/source/detail/sampler_impl.cpp @@ -10,8 +10,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { sampler_impl::sampler_impl(coordinate_normalization_mode normalizationMode, @@ -92,5 +91,5 @@ sampler_impl::get_coordinate_normalization_mode() const { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/sampler_impl.hpp b/sycl/source/detail/sampler_impl.hpp index 682b92bf70a29..b8bb69afa2dfc 100644 --- a/sycl/source/detail/sampler_impl.hpp +++ b/sycl/source/detail/sampler_impl.hpp @@ -15,8 +15,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { enum class addressing_mode : unsigned int; enum class filtering_mode : unsigned int; @@ -71,5 +70,5 @@ class __SYCL_EXPORT sampler_impl { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/commands.cpp b/sycl/source/detail/scheduler/commands.cpp index 4a6630c2a672e..7b82b47cdcc22 100644 --- a/sycl/source/detail/scheduler/commands.cpp +++ b/sycl/source/detail/scheduler/commands.cpp @@ -47,8 +47,7 @@ #include #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { #ifdef XPTI_ENABLE_INSTRUMENTATION @@ -1686,7 +1685,7 @@ static void adjustNDRangePerKernel(NDRDescT &NDR, RT::PiKernel Kernel, // avoid get_kernel_work_group_info on every kernel run range<3> WGSize = get_kernel_device_specific_info< range<3>, - cl::sycl::info::kernel_device_specific::compile_work_group_size>:: + __sycl_ns::info::kernel_device_specific::compile_work_group_size>:: get(Kernel, DeviceImpl.getHandleRef(), DeviceImpl.getPlugin()); if (WGSize[0] == 0) { @@ -1758,7 +1757,7 @@ pi_result ExecCGCommand::SetKernelParamsAndLaunch( } case kernel_param_kind_t::kind_specialization_constants_buffer: { if (MQueue->is_host()) { - throw cl::sycl::feature_not_supported( + throw __sycl_ns::feature_not_supported( "SYCL2020 specialization constants are not yet supported on host " "device", PI_INVALID_OPERATION); @@ -1992,12 +1991,12 @@ cl_int ExecCGCommand::enqueueImp() { switch (Error) { case PI_INVALID_OPERATION: - throw cl::sycl::runtime_error( + throw __sycl_ns::runtime_error( "Device doesn't support run_on_host_intel tasks.", Error); case PI_SUCCESS: return Error; default: - throw cl::sycl::runtime_error( + throw __sycl_ns::runtime_error( "Enqueueing run_on_host_intel task has failed.", Error); } } @@ -2263,5 +2262,5 @@ bool ExecCGCommand::producesPiEvent() const { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/commands.hpp b/sycl/source/detail/scheduler/commands.hpp index b907ef12e32f6..2db3a07c020a8 100644 --- a/sycl/source/detail/scheduler/commands.hpp +++ b/sycl/source/detail/scheduler/commands.hpp @@ -21,8 +21,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class queue_impl; @@ -569,5 +568,5 @@ class UpdateHostRequirementCommand : public Command { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/graph_builder.cpp b/sycl/source/detail/scheduler/graph_builder.cpp index c59aa11046e1a..1acda53a165b8 100644 --- a/sycl/source/detail/scheduler/graph_builder.cpp +++ b/sycl/source/detail/scheduler/graph_builder.cpp @@ -24,8 +24,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { /// Checks whether two requirements overlap or not. @@ -1264,5 +1263,5 @@ Command *Scheduler::GraphBuilder::connectDepEvent(Command *const Cmd, } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/graph_processor.cpp b/sycl/source/detail/scheduler/graph_processor.cpp index cc2e0cb15067c..bf2c81bb10912 100644 --- a/sycl/source/detail/scheduler/graph_processor.cpp +++ b/sycl/source/detail/scheduler/graph_processor.cpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { static Command *getCommand(const EventImplPtr &Event) { @@ -24,8 +23,8 @@ static Command *getCommand(const EventImplPtr &Event) { std::vector Scheduler::GraphProcessor::getWaitList(EventImplPtr Event) { Command *Cmd = getCommand(Event); - // Command can be nullptr if user creates cl::sycl::event explicitly, - // as such event is not mapped to any SYCL task. + // Command can be nullptr if user creates sycl::event explicitly, as such + // event is not mapped to any SYCL task. if (!Cmd) return {}; std::vector Result; @@ -40,8 +39,8 @@ void Scheduler::GraphProcessor::waitForEvent(EventImplPtr Event, ReadLockT &GraphReadLock, bool LockTheLock) { Command *Cmd = getCommand(Event); - // Command can be nullptr if user creates cl::sycl::event explicitly or the - // event has been waited on by another thread + // Command can be nullptr if user creates sycl::event explicitly or the event + // has been waited on by another thread if (!Cmd) return; @@ -112,5 +111,5 @@ bool Scheduler::GraphProcessor::enqueueCommand(Command *Cmd, } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/leaves_collection.cpp b/sycl/source/detail/scheduler/leaves_collection.cpp index 0ae0bcfbb9c0e..4a5e6f3bc1d97 100644 --- a/sycl/source/detail/scheduler/leaves_collection.cpp +++ b/sycl/source/detail/scheduler/leaves_collection.cpp @@ -11,8 +11,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // TODO merge with GraphBuilder's version of doOverlap (see graph_builder.cpp). @@ -81,7 +80,7 @@ bool LeavesCollection::addHostAccessorCommand(EmptyCommand *Cmd, // HACK we believe here that read accessors never overlap as it doesn't add // any real dependency (e.g. data copy to device) except for blocking. - if (Cmd->getRequirement()->MAccessMode == cl::sycl::access::mode::read) + if (Cmd->getRequirement()->MAccessMode == __sycl_ns::access::mode::read) OldCmdIt = MHostAccessorCommands.end(); else OldCmdIt = std::find_if( @@ -145,5 +144,5 @@ size_t LeavesCollection::eraseHostAccessorCommand(EmptyCommand *Cmd) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/leaves_collection.hpp b/sycl/source/detail/scheduler/leaves_collection.hpp index 54b162693355a..547ea362bd6d5 100644 --- a/sycl/source/detail/scheduler/leaves_collection.hpp +++ b/sycl/source/detail/scheduler/leaves_collection.hpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { struct MemObjRecord; @@ -264,5 +263,5 @@ class LeavesCollection { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/scheduler.cpp b/sycl/source/detail/scheduler/scheduler.cpp index 56ec1aec109c3..598a6e4203538 100644 --- a/sycl/source/detail/scheduler/scheduler.cpp +++ b/sycl/source/detail/scheduler/scheduler.cpp @@ -22,8 +22,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { void Scheduler::waitForRecordToFinish(MemObjRecord *Record, @@ -470,5 +469,5 @@ MemObjRecord *Scheduler::getMemObjRecord(const Requirement *const Req) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/scheduler.hpp b/sycl/source/detail/scheduler/scheduler.hpp index a8010990d6c1d..2c6bec4d0b5de 100644 --- a/sycl/source/detail/scheduler/scheduler.hpp +++ b/sycl/source/detail/scheduler/scheduler.hpp @@ -64,8 +64,8 @@ /// \code{.cpp} /// { /// // Creating SYCL CPU and GPU queues -/// cl::sycl::queue CPU_Queue = ...; -/// cl::sycl::queue GPU_Queue = ...; +/// sycl::queue CPU_Queue = ...; +/// sycl::queue GPU_Queue = ...; /// /// // Creating 3 SYCL buffers /// auto BufferA = ...; // Buffer is initialized with host memory. @@ -171,8 +171,7 @@ // For testing purposes class MockScheduler; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class queue_impl; @@ -512,7 +511,7 @@ class Scheduler { /// (assuming that all its commands have been waited for). void cleanupFinishedCommands( Command *FinishedCmd, - std::vector> &); + std::vector> &); /// Reschedules the command passed using Queue provided. /// @@ -538,7 +537,7 @@ class Scheduler { /// Removes commands that use the given MemObjRecord from the graph. void cleanupCommandsForRecord( MemObjRecord *Record, - std::vector> &); + std::vector> &); /// Removes the MemObjRecord for the memory object passed. void removeRecordForMemObj(SYCLMemObjI *MemObject); @@ -812,5 +811,5 @@ class Scheduler { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/scheduler_helpers.cpp b/sycl/source/detail/scheduler/scheduler_helpers.cpp index c86ddaa789003..bdf5928fce9a5 100644 --- a/sycl/source/detail/scheduler/scheduler_helpers.cpp +++ b/sycl/source/detail/scheduler/scheduler_helpers.cpp @@ -12,8 +12,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { void initStream(StreamImplPtr Stream, QueueImplPtr Queue) { @@ -51,5 +50,5 @@ void initStream(StreamImplPtr Stream, QueueImplPtr Queue) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/scheduler/scheduler_helpers.hpp b/sycl/source/detail/scheduler/scheduler_helpers.hpp index c7030c9b69603..80fb95a50a864 100644 --- a/sycl/source/detail/scheduler/scheduler_helpers.hpp +++ b/sycl/source/detail/scheduler/scheduler_helpers.hpp @@ -12,8 +12,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class stream_impl; @@ -25,5 +24,5 @@ using QueueImplPtr = std::shared_ptr; void initStream(StreamImplPtr Stream, QueueImplPtr Queue); } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/spec_constant_impl.cpp b/sycl/source/detail/spec_constant_impl.cpp index 898fb584f07b7..46c00b6db8d2a 100644 --- a/sycl/source/detail/spec_constant_impl.cpp +++ b/sycl/source/detail/spec_constant_impl.cpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { void spec_constant_impl::set(size_t Size, const void *Val) { @@ -49,5 +48,5 @@ std::ostream &operator<<(std::ostream &Out, const spec_constant_impl &V) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/spec_constant_impl.hpp b/sycl/source/detail/spec_constant_impl.hpp index 5e076cd5070c4..e0710ae0e327e 100644 --- a/sycl/source/detail/spec_constant_impl.hpp +++ b/sycl/source/detail/spec_constant_impl.hpp @@ -16,8 +16,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // Represents a specialization constant value in SYCL runtime. @@ -47,5 +46,5 @@ void stableSerializeSpecConstRegistry(const SpecConstRegistryT &Reg, SerializedObj &Dst); } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/stream_impl.cpp b/sycl/source/detail/stream_impl.cpp index 0da23fd7e2d7a..42bb146cd188a 100644 --- a/sycl/source/detail/stream_impl.cpp +++ b/sycl/source/detail/stream_impl.cpp @@ -12,8 +12,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { stream_impl::stream_impl(size_t BufferSize, size_t MaxStatementSize, @@ -35,7 +34,7 @@ stream_impl::stream_impl(size_t BufferSize, size_t MaxStatementSize, GlobalBufAccessorT stream_impl::accessGlobalBuf(handler &CGH) { return detail::Scheduler::getInstance() .StreamBuffersPool.find(this) - ->second->Buf.get_access( + ->second->Buf.get_access<__sycl_ns::access::mode::read_write>( CGH, range<1>(BufferSize_), id<1>(OffsetSize)); } @@ -43,7 +42,7 @@ GlobalBufAccessorT stream_impl::accessGlobalBuf(handler &CGH) { GlobalBufAccessorT stream_impl::accessGlobalFlushBuf(handler &CGH) { return detail::Scheduler::getInstance() .StreamBuffersPool.find(this) - ->second->FlushBuf.get_access( + ->second->FlushBuf.get_access<__sycl_ns::access::mode::read_write>( CGH, range<1>(MaxStatementSize_ + FLUSH_BUF_OFFSET_SIZE), id<1>(0)); } @@ -55,7 +54,7 @@ GlobalOffsetAccessorT stream_impl::accessGlobalOffset(handler &CGH) { ->second->Buf, id<1>(0), range<1>(OffsetSize)); auto ReinterpretedBuf = OffsetSubBuf.reinterpret(range<1>(2)); - return ReinterpretedBuf.get_access( + return ReinterpretedBuf.get_access<__sycl_ns::access::mode::atomic>( CGH, range<1>(2), id<1>(0)); } size_t stream_impl::get_size() const { return BufferSize_; } @@ -67,7 +66,7 @@ void stream_impl::flush() { // host task to print stream buffer. It will fire up as soon as the kernel // finishes execution. auto Q = detail::createSyclObjFromImpl( - cl::sycl::detail::Scheduler::getInstance().getDefaultHostQueue()); + __sycl_ns::detail::Scheduler::getInstance().getDefaultHostQueue()); Q.submit([&](handler &cgh) { auto BufHostAcc = detail::Scheduler::getInstance() @@ -92,6 +91,5 @@ void stream_impl::flush() { }); } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) - +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/stream_impl.hpp b/sycl/source/detail/stream_impl.hpp index 5de08e7cb6d08..9a9ed61e5cab1 100644 --- a/sycl/source/detail/stream_impl.hpp +++ b/sycl/source/detail/stream_impl.hpp @@ -17,8 +17,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class __SYCL_EXPORT stream_impl { @@ -59,5 +58,5 @@ class __SYCL_EXPORT stream_impl { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/sycl_mem_obj_t.cpp b/sycl/source/detail/sycl_mem_obj_t.cpp index 8a43345738216..391890c3d8481 100644 --- a/sycl/source/detail/sycl_mem_obj_t.cpp +++ b/sycl/source/detail/sycl_mem_obj_t.cpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { SYCLMemObjT::SYCLMemObjT(cl_mem MemObject, const context &SyclContext, const size_t SizeInBytes, event AvailableEvent, @@ -27,7 +26,7 @@ SYCLMemObjT::SYCLMemObjT(cl_mem MemObject, const context &SyclContext, MUserPtr(nullptr), MShadowCopy(nullptr), MUploadDataFunctor(nullptr), MSharedPtrStorage(nullptr) { if (MInteropContext->is_host()) - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Creation of interoperability memory object using host context is " "not allowed", PI_INVALID_CONTEXT); @@ -39,7 +38,7 @@ SYCLMemObjT::SYCLMemObjT(cl_mem MemObject, const context &SyclContext, &Context, nullptr); if (MInteropContext->getHandleRef() != Context) - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Input context must be the same as the context of cl_mem", PI_INVALID_CONTEXT); Plugin.call(Mem); @@ -131,5 +130,5 @@ void SYCLMemObjT::determineHostPtr(const ContextImplPtr &Context, HostPtrReadOnly = false; } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/thread_pool.hpp b/sycl/source/detail/thread_pool.hpp index 2d7873748bcc9..5ed960a6e560a 100644 --- a/sycl/source/detail/thread_pool.hpp +++ b/sycl/source/detail/thread_pool.hpp @@ -18,8 +18,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class ThreadPool { @@ -95,5 +94,5 @@ class ThreadPool { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/usm/usm_impl.cpp b/sycl/source/detail/usm/usm_impl.cpp index 54d530c5ca3cd..1a27ed7b70639 100644 --- a/sycl/source/detail/usm/usm_impl.cpp +++ b/sycl/source/detail/usm/usm_impl.cpp @@ -16,10 +16,9 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { -using alloc = cl::sycl::usm::alloc; +using alloc = __sycl_ns::usm::alloc; namespace detail { namespace usm { @@ -416,5 +415,5 @@ device get_pointer_device(const void *Ptr, const context &Ctxt) { PI_INVALID_OPERATION); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/util.cpp b/sycl/source/detail/util.cpp index 5cf6633486a4f..b34d5994c91b6 100644 --- a/sycl/source/detail/util.cpp +++ b/sycl/source/detail/util.cpp @@ -9,12 +9,11 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { Sync &Sync::getInstance() { return GlobalHandler::instance().getSync(); } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/windows_pi.cpp b/sycl/source/detail/windows_pi.cpp index 51d1f4066c92c..806032b6bac64 100644 --- a/sycl/source/detail/windows_pi.cpp +++ b/sycl/source/detail/windows_pi.cpp @@ -12,8 +12,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace pi { @@ -43,5 +42,5 @@ void *getOsLibraryFuncAddress(void *Library, const std::string &FunctionName) { } // namespace pi } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/detail/xpti_registry.hpp b/sycl/source/detail/xpti_registry.hpp index b0c5db3af8cdd..8d8563f65ccba 100644 --- a/sycl/source/detail/xpti_registry.hpp +++ b/sycl/source/detail/xpti_registry.hpp @@ -17,8 +17,7 @@ #include "xpti_trace_framework.h" #endif -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { // We define a sycl stream name and this will be used by the instrumentation // framework @@ -57,5 +56,5 @@ class XPTIRegistry { std::unordered_set MActiveStreams; }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/device.cpp b/sycl/source/device.cpp index f2e09cd1d0e61..59cc83ab83f72 100644 --- a/sycl/source/device.cpp +++ b/sycl/source/device.cpp @@ -16,15 +16,14 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { void force_type(info::device_type &t, const info::device_type &ft) { if (t == info::device_type::all) { t = ft; } else if (ft != info::device_type::all && t != ft) { - throw cl::sycl::invalid_parameter_error("No device of forced type.", - PI_INVALID_OPERATION); + throw __sycl_ns::invalid_parameter_error("No device of forced type.", + PI_INVALID_OPERATION); } } } // namespace detail @@ -162,5 +161,5 @@ pi_native_handle device::getNative() const { return impl->getNative(); } bool device::has(aspect Aspect) const { return impl->has(Aspect); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/device_selector.cpp b/sycl/source/device_selector.cpp index fe52090008ce2..ae17b03695222 100644 --- a/sycl/source/device_selector.cpp +++ b/sycl/source/device_selector.cpp @@ -24,8 +24,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Utility function to check if device is of the preferred backend. // Currently preference is given to the level_zero backend. @@ -121,8 +120,8 @@ device device_selector::select_device() const { return *res; } - throw cl::sycl::runtime_error("No device of requested type available.", - PI_DEVICE_NOT_FOUND); + throw __sycl_ns::runtime_error("No device of requested type available.", + PI_DEVICE_NOT_FOUND); } /// Devices of different kinds are prioritized in the following order: @@ -285,5 +284,5 @@ namespace __SYCL2020_DEPRECATED("use 'ext::oneapi' instead") ONEAPI { return ext::oneapi::filter_selector::select_device(); } } // namespace ONEAPI -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/event.cpp b/sycl/source/event.cpp index a777a1c66d088..f6f8bb98e964b 100644 --- a/sycl/source/event.cpp +++ b/sycl/source/event.cpp @@ -19,8 +19,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { event::event() : impl(std::make_shared()) {} @@ -90,5 +89,5 @@ backend event::get_backend() const noexcept { return getImplBackend(impl); } pi_native_handle event::getNative() const { return impl->getNative(); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/exception.cpp b/sycl/source/exception.cpp index aeeda10dbaec1..817a91a4b6266 100644 --- a/sycl/source/exception.cpp +++ b/sycl/source/exception.cpp @@ -12,8 +12,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace { // anonymous constexpr char ReservedForErrorcode[] = @@ -122,5 +121,5 @@ std::error_code make_error_code(sycl::errc Err) noexcept { return {static_cast(Err), sycl_category()}; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/exception_list.cpp b/sycl/source/exception_list.cpp index 93cdbf9ef850f..f100098a6ad5c 100644 --- a/sycl/source/exception_list.cpp +++ b/sycl/source/exception_list.cpp @@ -11,8 +11,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { exception_list::size_type exception_list::size() const { return MList.size(); } @@ -26,5 +25,5 @@ void exception_list::PushBack(value_type&& Value) { MList.emplace_back(std::move void exception_list::Clear() noexcept { MList.clear(); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/function_pointer.cpp b/sycl/source/function_pointer.cpp index 18fa8f3f99e72..59c2db5bcba49 100644 --- a/sycl/source/function_pointer.cpp +++ b/sycl/source/function_pointer.cpp @@ -10,8 +10,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { ext::oneapi::device_func_ptr_holder_t getDeviceFunctionPointerImpl(device &D, program &P, const char *FuncName) { @@ -19,7 +18,7 @@ getDeviceFunctionPointerImpl(device &D, program &P, const char *FuncName) { // FIXME: return value must be checked here, but since we cannot yet check // if corresponding extension is supported, let's silently ignore it here. const detail::plugin &Plugin = detail::getSyclObjImpl(P)->getPlugin(); - Plugin.call( + Plugin.call<__sycl_ns::detail::PiApiKind::piextGetDeviceFunctionPointer>( detail::pi::cast(detail::getSyclObjImpl(D)->getHandleRef()), detail::pi::cast(detail::getSyclObjImpl(P)->getHandleRef()), FuncName, &FPtr); @@ -27,5 +26,5 @@ getDeviceFunctionPointerImpl(device &D, program &P, const char *FuncName) { } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/half_type.cpp b/sycl/source/half_type.cpp index f17541fa9b8a8..11c006811beec 100644 --- a/sycl/source/half_type.cpp +++ b/sycl/source/half_type.cpp @@ -13,8 +13,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { namespace host_half_impl { @@ -84,5 +83,5 @@ bool operator!=(const half &LHS, const half &RHS) { return !(LHS == RHS); } } // namespace host_half_impl } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index 72e9cf42e0b27..8a00fa9f35cee 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -22,8 +22,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { handler::handler(std::shared_ptr Queue, bool IsHost) : MQueue(std::move(Queue)), MIsHost(IsHost) { @@ -214,7 +213,7 @@ event handler::finalize() { std::cout << "WARNING: An empty command group is submitted." << std::endl; } detail::EventImplPtr Event = - std::make_shared(); + std::make_shared<__sycl_ns::detail::event_impl>(); MLastEvent = detail::createSyclObjFromImpl(Event); return MLastEvent; } @@ -384,7 +383,7 @@ void handler::processArg(void *Ptr, const detail::kernel_param_kind_t &Kind, } case access::target::host_image: case access::target::host_buffer: { - throw cl::sycl::invalid_parameter_error( + throw __sycl_ns::invalid_parameter_error( "Unsupported accessor target case.", PI_INVALID_OPERATION); break; } @@ -555,5 +554,5 @@ void handler::mem_advise(const void *Ptr, size_t Count, int Advice) { ExtendedMembersVec->push_back(EMember); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/interop_handle.cpp b/sycl/source/interop_handle.cpp index fff99ab730d6d..5a2e4eb6c64a9 100644 --- a/sycl/source/interop_handle.cpp +++ b/sycl/source/interop_handle.cpp @@ -16,8 +16,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { backend interop_handle::get_backend() const noexcept { return detail::getImplBackend(MQueue); @@ -51,5 +50,5 @@ pi_native_handle interop_handle::getNativeQueue() const { return MQueue->getNative(); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/interop_handler.cpp b/sycl/source/interop_handler.cpp index f6fb55ad28120..f54c74401ef46 100644 --- a/sycl/source/interop_handler.cpp +++ b/sycl/source/interop_handler.cpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { pi_native_handle interop_handler::GetNativeQueue() const { return MQueue->getNative(); @@ -33,5 +32,5 @@ pi_native_handle interop_handler::GetNativeMem(detail::Requirement *Req) const { return Handle; } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/kernel.cpp b/sycl/source/kernel.cpp index f36fbe3e7b0b2..826934f8b9866 100644 --- a/sycl/source/kernel.cpp +++ b/sycl/source/kernel.cpp @@ -13,8 +13,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { kernel::kernel(cl_kernel ClKernel, const context &SyclContext) : impl(std::make_shared( @@ -127,5 +126,5 @@ kernel::kernel(std::shared_ptr Impl) : impl(Impl) {} pi_native_handle kernel::getNativeImpl() const { return impl->getNative(); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/kernel_bundle.cpp b/sycl/source/kernel_bundle.cpp index 3d162b3eb3325..b2138ee5c226f 100644 --- a/sycl/source/kernel_bundle.cpp +++ b/sycl/source/kernel_bundle.cpp @@ -11,8 +11,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { kernel_id::kernel_id(const char *Name) : impl(std::make_shared(Name)) {} @@ -275,5 +274,5 @@ std::vector get_kernel_ids() { return detail::ProgramManager::getInstance().getAllSYCLKernelIDs(); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/ld-version-script.txt b/sycl/source/ld-version-script.txt index f66b55fd09a9c..546e0f41e5dd2 100644 --- a/sycl/source/ld-version-script.txt +++ b/sycl/source/ld-version-script.txt @@ -3,11 +3,11 @@ /* because vtable and typeinfo symbols make extern "C++" patterns more */ /* complicated than patterns against mangled names. */ /* */ - /* With extern "C++" we have to match for "vtable for cl::sycl::foo", but */ - /* not match for "vtable for std::__internal". */ + /* With extern "C++" we have to match for "vtable for sycl::foo", but */ + /* not match for "vtable for std::__internal". */ global: - /* Export everything from cl::sycl namespace */ + /* Export everything from sycl namespace */ _ZNK2cl4sycl*; /* function */ _ZN2cl4sycl*; /* function */ _ZTIN2cl4sycl*; /* typeinfo */ diff --git a/sycl/source/platform.cpp b/sycl/source/platform.cpp index b38f28960030e..7d2b112876d6b 100644 --- a/sycl/source/platform.cpp +++ b/sycl/source/platform.cpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { platform::platform() : impl(detail::platform_impl::getHostPlatformImpl()) {} @@ -65,5 +64,5 @@ bool platform::has(aspect Aspect) const { return impl->has(Aspect); } #undef __SYCL_PARAM_TRAITS_SPEC -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/program.cpp b/sycl/source/program.cpp index 6adb31c754195..29b8b691794ca 100644 --- a/sycl/source/program.cpp +++ b/sycl/source/program.cpp @@ -14,8 +14,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { program::program(const context &context, const property_list &PropList) : impl(std::make_shared( @@ -158,5 +157,5 @@ void program::set_spec_constant_impl(const char *Name, void *Data, impl->set_spec_constant_impl(Name, Data, Size); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index 298068ee45201..dc1fd0d21c155 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -16,8 +16,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { queue::queue(const context &SyclContext, const device_selector &DeviceSelector, const async_handler &AsyncHandler, const property_list &PropList) { @@ -175,5 +174,5 @@ backend queue::get_backend() const noexcept { return getImplBackend(impl); } pi_native_handle queue::getNative() const { return impl->getNative(); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/sampler.cpp b/sycl/source/sampler.cpp index 1f5073cf47da8..7d3dec6cf9e30 100644 --- a/sycl/source/sampler.cpp +++ b/sycl/source/sampler.cpp @@ -11,8 +11,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { sampler::sampler(coordinate_normalization_mode normalizationMode, addressing_mode addressingMode, filtering_mode filteringMode, const property_list &propList) @@ -60,5 +59,5 @@ bool sampler::operator!=(const sampler &rhs) const { #undef __SYCL_PARAM_TRAITS_SPEC -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/source/spirv_ops.cpp b/sycl/source/spirv_ops.cpp index 1f67db77ba0e8..158e0030656ee 100644 --- a/sycl/source/spirv_ops.cpp +++ b/sycl/source/spirv_ops.cpp @@ -46,5 +46,5 @@ __SYCL_EXPORT void __spirv_MemoryBarrier(__spv::Scope Memory, __SYCL_EXPORT void __spirv_ocl_prefetch(const char *Ptr, size_t NumBytes) noexcept { - cl::sycl::detail::PlatformUtil::prefetch(Ptr, NumBytes); + __sycl_ns::detail::PlatformUtil::prefetch(Ptr, NumBytes); } diff --git a/sycl/source/stream.cpp b/sycl/source/stream.cpp index 6d000751e0354..1d0d8d398b604 100644 --- a/sycl/source/stream.cpp +++ b/sycl/source/stream.cpp @@ -10,8 +10,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { // Maximum possible size of a flush buffer statement in bytes static constexpr size_t MAX_STATEMENT_SIZE = @@ -52,6 +51,5 @@ bool stream::operator==(const stream &RHS) const { return (impl == RHS.impl); } bool stream::operator!=(const stream &RHS) const { return !(impl == RHS.impl); } -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) - +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/test/basic_tests/test_new_namespace.cpp b/sycl/test/basic_tests/test_new_namespace.cpp new file mode 100644 index 0000000000000..2708b70cf445c --- /dev/null +++ b/sycl/test/basic_tests/test_new_namespace.cpp @@ -0,0 +1,13 @@ +// RUN: %clangxx -fsycl -fsyntax-only %s + +// The test checks that compilation with SYCL 2020 style namespaces (sycl +// instead of cl::sycl) works fine +// +// This test is temporary one which should make sure that such a compilation +// mode is not broken until complete transition happens. + +#define __SYCL_DISABLE_SYCL121_NAMESPACE + +#include + +int main() {} diff --git a/sycl/tools/pi-trace/pi_trace.cpp b/sycl/tools/pi-trace/pi_trace.cpp index 5a355e407a484..68140e8ff74a6 100644 --- a/sycl/tools/pi-trace/pi_trace.cpp +++ b/sycl/tools/pi-trace/pi_trace.cpp @@ -25,7 +25,7 @@ static uint8_t GStreamID = 0; std::mutex GIOMutex; -sycl::xpti_helpers::PiArgumentsHandler ArgHandler; +xpti_helpers::PiArgumentsHandler ArgHandler; // The lone callback function we are going to use to demonstrate how to attach // the collector to the running executable diff --git a/sycl/tools/xpti_helpers/pi_arguments_handler.hpp b/sycl/tools/xpti_helpers/pi_arguments_handler.hpp index 08049cef70d20..5d959581c98af 100644 --- a/sycl/tools/xpti_helpers/pi_arguments_handler.hpp +++ b/sycl/tools/xpti_helpers/pi_arguments_handler.hpp @@ -16,10 +16,10 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { namespace xpti_helpers { +using namespace sycl; + template inline auto get(char *Data, const std::index_sequence &) { // Our type should be last in Is sequence @@ -102,5 +102,3 @@ class PiArgumentsHandler { #undef _PI_API }; } // namespace xpti_helpers -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) diff --git a/sycl/unittests/SYCL2020/KernelBundle.cpp b/sycl/unittests/SYCL2020/KernelBundle.cpp index 175dbb928e1e7..8021870398dbc 100644 --- a/sycl/unittests/SYCL2020/KernelBundle.cpp +++ b/sycl/unittests/SYCL2020/KernelBundle.cpp @@ -17,8 +17,7 @@ class TestKernel; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template <> struct KernelInfo { static constexpr unsigned getNumParams() { return 0; } @@ -33,8 +32,8 @@ template <> struct KernelInfo { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() static sycl::unittest::PiImage generateDefaultImage() { using namespace sycl::unittest; diff --git a/sycl/unittests/SYCL2020/KernelID.cpp b/sycl/unittests/SYCL2020/KernelID.cpp index fc4d34f99ac3e..003dd041ca2ef 100644 --- a/sycl/unittests/SYCL2020/KernelID.cpp +++ b/sycl/unittests/SYCL2020/KernelID.cpp @@ -18,8 +18,7 @@ class TestKernel1; class TestKernel2; class TestKernel3; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template <> struct KernelInfo { static constexpr unsigned getNumParams() { return 0; } @@ -58,8 +57,8 @@ template <> struct KernelInfo { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() static sycl::unittest::PiImage generateDefaultImage(std::initializer_list Kernels) { diff --git a/sycl/unittests/SYCL2020/SpecConstDefaultValues.cpp b/sycl/unittests/SYCL2020/SpecConstDefaultValues.cpp index d755e24433454..98653619ca998 100644 --- a/sycl/unittests/SYCL2020/SpecConstDefaultValues.cpp +++ b/sycl/unittests/SYCL2020/SpecConstDefaultValues.cpp @@ -20,8 +20,7 @@ class TestKernel; const static sycl::specialization_id SpecConst1{42}; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template <> struct KernelInfo { static constexpr unsigned getNumParams() { return 0; } @@ -41,8 +40,8 @@ template <> const char *get_spec_constant_symbolic_ID() { return "SC1"; } } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() static sycl::unittest::PiImage generateImageWithSpecConsts() { using namespace sycl::unittest; diff --git a/sycl/unittests/helpers/PiImage.hpp b/sycl/unittests/helpers/PiImage.hpp index e996e4cbe2d6e..1ac8142921672 100644 --- a/sycl/unittests/helpers/PiImage.hpp +++ b/sycl/unittests/helpers/PiImage.hpp @@ -14,8 +14,7 @@ #include #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace unittest { /// Convinience wrapper around _pi_device_binary_property_struct. class PiProperty { @@ -394,5 +393,5 @@ makeEmptyKernels(std::initializer_list KernelNames) { } } // namespace unittest -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/unittests/helpers/PiMock.hpp b/sycl/unittests/helpers/PiMock.hpp index 9d08a01cd53d8..7363ebca5c674 100644 --- a/sycl/unittests/helpers/PiMock.hpp +++ b/sycl/unittests/helpers/PiMock.hpp @@ -34,8 +34,7 @@ #include -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace unittest { namespace detail = cl::sycl::detail; @@ -188,5 +187,5 @@ class PiMock { }; } // namespace unittest -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index 4204908798e91..23d515fe74b11 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -34,8 +34,7 @@ class TestKernel2 { void operator()(cl::sycl::item<1>){}; }; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { struct MockKernelInfo { static constexpr unsigned getNumParams() { return 0; } @@ -57,8 +56,8 @@ template <> struct KernelInfo : public MockKernelInfo { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() static sycl::unittest::PiImage generateDefaultImage() { using namespace sycl::unittest; diff --git a/sycl/unittests/misc/KernelBuildOptions.cpp b/sycl/unittests/misc/KernelBuildOptions.cpp index 91d84e30c39de..508a92976c01e 100644 --- a/sycl/unittests/misc/KernelBuildOptions.cpp +++ b/sycl/unittests/misc/KernelBuildOptions.cpp @@ -17,8 +17,7 @@ class TestKernel; static std::string BuildOpts; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template <> struct KernelInfo { static constexpr unsigned getNumParams() { return 0; } @@ -33,8 +32,8 @@ template <> struct KernelInfo { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() static pi_result redefinedProgramCreate(pi_context, const void *, size_t, pi_program *) { diff --git a/sycl/unittests/pi/pi_arguments_handler.cpp b/sycl/unittests/pi/pi_arguments_handler.cpp index ca43ceb039b37..bbb50ebca5e21 100644 --- a/sycl/unittests/pi/pi_arguments_handler.cpp +++ b/sycl/unittests/pi/pi_arguments_handler.cpp @@ -15,7 +15,7 @@ #include TEST(PiArgumentsHandlerTest, CanUnpackArguments) { - sycl::xpti_helpers::PiArgumentsHandler Handler; + xpti_helpers::PiArgumentsHandler Handler; const pi_uint32 NumPlatforms = 42; pi_platform *Platforms = new pi_platform[NumPlatforms]; diff --git a/sycl/unittests/program_manager/itt_annotations.cpp b/sycl/unittests/program_manager/itt_annotations.cpp index 625d90bf024b9..c2a44f24af561 100644 --- a/sycl/unittests/program_manager/itt_annotations.cpp +++ b/sycl/unittests/program_manager/itt_annotations.cpp @@ -39,8 +39,7 @@ static void unset_env(const char *name) { class TestKernel; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template <> struct KernelInfo { static constexpr unsigned getNumParams() { return 0; } @@ -55,8 +54,8 @@ template <> struct KernelInfo { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() static pi_result redefinedProgramCreate(pi_context, const void *, size_t, pi_program *) { diff --git a/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp b/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp index 5fb7589605e4a..5f4b4b71aa487 100644 --- a/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp +++ b/sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp @@ -20,8 +20,7 @@ class TestKernel; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template <> struct KernelInfo { static constexpr unsigned getNumParams() { return 0; } @@ -36,8 +35,8 @@ template <> struct KernelInfo { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() static sycl::unittest::PiImage generateDefaultImage() { using namespace sycl::unittest; diff --git a/sycl/unittests/scheduler/RequiredWGSize.cpp b/sycl/unittests/scheduler/RequiredWGSize.cpp index 3d4fb1ddffb90..e9865a7d1855c 100644 --- a/sycl/unittests/scheduler/RequiredWGSize.cpp +++ b/sycl/unittests/scheduler/RequiredWGSize.cpp @@ -24,8 +24,7 @@ bool KernelGetGroupInfoCalled = false; std::array IncomingLocalSize = {0, 0, 0}; std::array RequiredLocalSize = {0, 0, 0}; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { template <> struct KernelInfo { static constexpr unsigned getNumParams() { return 0; } @@ -40,8 +39,8 @@ template <> struct KernelInfo { }; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() static pi_result redefinedProgramCreate(pi_context, const void *, size_t, pi_program *) { diff --git a/sycl/unittests/scheduler/SchedulerTestUtils.hpp b/sycl/unittests/scheduler/SchedulerTestUtils.hpp index e918951108488..2e1238cfe21a6 100644 --- a/sycl/unittests/scheduler/SchedulerTestUtils.hpp +++ b/sycl/unittests/scheduler/SchedulerTestUtils.hpp @@ -22,13 +22,12 @@ cl::sycl::detail::Requirement getMockRequirement(); -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { +__SYCL_OPEN_NS() { namespace detail { class Command; } // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) +} // __SYCL_OPEN_NS() +__SYCL_CLOSE_NS() class MockCommand : public cl::sycl::detail::Command { public: