From 698d64ff16e590e00e1e84347dfa74a26aac2e41 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Wed, 15 Apr 2020 11:48:08 +0300 Subject: [PATCH 1/3] [SYCL] Fix inline namespaces Signed-off-by: Alexander Batashev --- sycl/include/CL/sycl/backend_types.hpp | 6 ++++-- sycl/plugins/cuda/pi_cuda.cpp | 5 +++-- sycl/source/detail/cg.cpp | 7 ++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sycl/include/CL/sycl/backend_types.hpp b/sycl/include/CL/sycl/backend_types.hpp index 3db71b8b47485..5e8e57ea70b2e 100644 --- a/sycl/include/CL/sycl/backend_types.hpp +++ b/sycl/include/CL/sycl/backend_types.hpp @@ -8,7 +8,9 @@ #pragma once -namespace cl { +#include + +__SYCL_INLINE_NAMESPACE(cl) { namespace sycl { enum class backend { host, opencl, cuda }; @@ -16,4 +18,4 @@ enum class backend { host, opencl, cuda }; template struct interop; } // namespace sycl -} // namespace cl \ No newline at end of file +} // __SYCL_INLINE_NAMESPACE(cl) diff --git a/sycl/plugins/cuda/pi_cuda.cpp b/sycl/plugins/cuda/pi_cuda.cpp index bbe3bc4442630..af15743438da8 100644 --- a/sycl/plugins/cuda/pi_cuda.cpp +++ b/sycl/plugins/cuda/pi_cuda.cpp @@ -12,6 +12,7 @@ /// \ingroup sycl_pi_cuda #include +#include #include #include @@ -229,7 +230,7 @@ int getAttribute(pi_device device, CUdevice_attribute attribute) { } // anonymous namespace /// ------ Error handling, matching OpenCL plugin semantics. -namespace cl { +__SYCL_INLINE_NAMESPACE(cl) { namespace sycl { namespace detail { namespace pi { @@ -251,7 +252,7 @@ void assertion(bool Condition, const char *Message) { } // namespace pi } // namespace detail } // namespace sycl -} // namespace cl +} // __SYCL_INLINE_NAMESPACE(cl) //-------------- // PI object implementation diff --git a/sycl/source/detail/cg.cpp b/sycl/source/detail/cg.cpp index 2441d1cb7e919..a9a226dee277f 100644 --- a/sycl/source/detail/cg.cpp +++ b/sycl/source/detail/cg.cpp @@ -6,7 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CL/sycl/detail/cg.hpp" +#include +#include #include #include #include @@ -18,7 +19,7 @@ #include #include -namespace cl { +__SYCL_INLINE_NAMESPACE(cl) { namespace sycl { pi_native_handle interop_handler::GetNativeQueue() const { @@ -41,4 +42,4 @@ pi_native_handle interop_handler::GetNativeMem(detail::Requirement *Req) const { } } // sycl -} // cl +} // __SYCL_INLINE_NAMESPACE(cl) From 193426208ab78661bce14fb65cf59edb1252cb48 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Wed, 15 Apr 2020 13:03:08 +0300 Subject: [PATCH 2/3] Fix more warnings Signed-off-by: Alexander Batashev --- sycl/include/CL/sycl/detail/cg.hpp | 2 +- sycl/tools/get_device_count_by_type.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sycl/include/CL/sycl/detail/cg.hpp b/sycl/include/CL/sycl/detail/cg.hpp index 8dbe84d10e209..da51a99b6a9cd 100644 --- a/sycl/include/CL/sycl/detail/cg.hpp +++ b/sycl/include/CL/sycl/detail/cg.hpp @@ -78,7 +78,7 @@ class interop_handler { template - __SYCL_EXPORT auto + auto getMemImpl(detail::Requirement *Req) const -> typename interop< BackendName, accessor>::type { diff --git a/sycl/tools/get_device_count_by_type.cpp b/sycl/tools/get_device_count_by_type.cpp index 77ef2a023326a..31d741950730b 100644 --- a/sycl/tools/get_device_count_by_type.cpp +++ b/sycl/tools/get_device_count_by_type.cpp @@ -193,7 +193,7 @@ int main(int argc, char *argv[]) { } else if (backend == "cuda" || backend == "pi_cuda") { querySuccess = queryCUDA(deviceType, deviceCount, msg); } else { - msg + "ERROR: Unknown backend " + backend + "\n" + help + "\n"; + msg = "ERROR: Unknown backend " + backend + "\n" + help + "\n"; } std::cout << deviceCount << ":" << msg << std::endl; From 394bddb322031bbd36d38e7ee58696b987bbd599 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Wed, 15 Apr 2020 13:04:47 +0300 Subject: [PATCH 3/3] Properly format files Signed-off-by: Alexander Batashev --- sycl/include/CL/sycl/detail/cg.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sycl/include/CL/sycl/detail/cg.hpp b/sycl/include/CL/sycl/detail/cg.hpp index da51a99b6a9cd..ebe934468f087 100644 --- a/sycl/include/CL/sycl/detail/cg.hpp +++ b/sycl/include/CL/sycl/detail/cg.hpp @@ -78,8 +78,7 @@ class interop_handler { template - auto - getMemImpl(detail::Requirement *Req) const -> typename interop< + auto getMemImpl(detail::Requirement *Req) const -> typename interop< BackendName, accessor>::type { return (typename interop