From 74375584fa960fdb9adda2001c77465ae3fd1c38 Mon Sep 17 00:00:00 2001 From: Alexey Bader Date: Wed, 25 Dec 2019 15:56:29 +0300 Subject: [PATCH 1/2] [SYCL] Fix compiler crash Signed-off-by: Alexey Bader --- clang/lib/AST/QualTypeNames.cpp | 2 +- clang/test/CodeGenSYCL/kernel-name.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 clang/test/CodeGenSYCL/kernel-name.cpp diff --git a/clang/lib/AST/QualTypeNames.cpp b/clang/lib/AST/QualTypeNames.cpp index d63fa47529720..3a0f2f2a9a262 100644 --- a/clang/lib/AST/QualTypeNames.cpp +++ b/clang/lib/AST/QualTypeNames.cpp @@ -197,7 +197,7 @@ static NestedNameSpecifier *createOuterNNS(const ASTContext &Ctx, const Decl *D, // Ignore inline namespace; NS = dyn_cast(NS->getDeclContext()); } - if (NS->getDeclName()) { + if (NS && NS->getDeclName()) { return createNestedNameSpecifier(Ctx, NS, WithGlobalNsPrefix); } return nullptr; // no starting '::', no anonymous diff --git a/clang/test/CodeGenSYCL/kernel-name.cpp b/clang/test/CodeGenSYCL/kernel-name.cpp new file mode 100644 index 0000000000000..4d1bf4ab2836e --- /dev/null +++ b/clang/test/CodeGenSYCL/kernel-name.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple spir64-unknown-linux-sycldevice -std=c++11 -fsycl-is-device -S -emit-llvm -x c++ %s -o - | FileCheck %s + +inline namespace cl { + namespace sycl { + class kernel {}; + } +} + +using namespace cl::sycl; + +template +__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) { + kernelFunc(); +} + +// CHECK: define spir_kernel {{.*}}2cl4sycl6kernel +int main() { + kernel_single_task([]() {}); + return 0; +} From 315948f72f1712d0931ce827e42c6a13cf45dd58 Mon Sep 17 00:00:00 2001 From: Alexey Bader Date: Wed, 30 Oct 2019 18:46:26 +0300 Subject: [PATCH 2/2] [SYCL] Inline cl namespace to simplify SYCL API usage The inlining is enabled by default and make using SYCL API a little bit easier. In order to disable cl namespace inlining user should define __SYCL_DISABLE_NAMESPACE_INLINE__ macro. Signed-off-by: Alexey Bader --- clang/lib/Sema/SemaSYCL.cpp | 3 +- sycl/include/CL/sycl.hpp | 1 + sycl/include/CL/sycl/access/access.hpp | 4 ++- sycl/include/CL/sycl/accessor.hpp | 2 +- sycl/include/CL/sycl/aliases.hpp | 4 +-- sycl/include/CL/sycl/atomic.hpp | 6 ++-- sycl/include/CL/sycl/buffer.hpp | 2 +- sycl/include/CL/sycl/builtins.hpp | 4 +-- sycl/include/CL/sycl/context.hpp | 2 +- sycl/include/CL/sycl/detail/accessor_impl.hpp | 2 +- .../CL/sycl/detail/aligned_allocator.hpp | 2 +- sycl/include/CL/sycl/detail/array.hpp | 2 +- sycl/include/CL/sycl/detail/boolean.hpp | 2 +- sycl/include/CL/sycl/detail/buffer_impl.hpp | 2 +- sycl/include/CL/sycl/detail/builtins.hpp | 2 +- sycl/include/CL/sycl/detail/cg.hpp | 2 +- sycl/include/CL/sycl/detail/clusm.hpp | 2 +- sycl/include/CL/sycl/detail/common.hpp | 22 ++++---------- sycl/include/CL/sycl/detail/common_info.hpp | 2 +- sycl/include/CL/sycl/detail/context_impl.hpp | 2 +- sycl/include/CL/sycl/detail/context_info.hpp | 2 +- sycl/include/CL/sycl/detail/defines.hpp | 29 +++++++++++++++++++ sycl/include/CL/sycl/detail/device_impl.hpp | 2 +- sycl/include/CL/sycl/detail/device_info.hpp | 3 +- sycl/include/CL/sycl/detail/event_impl.hpp | 2 +- sycl/include/CL/sycl/detail/event_info.hpp | 2 +- sycl/include/CL/sycl/detail/force_device.hpp | 3 +- .../CL/sycl/detail/generic_type_lists.hpp | 4 +-- .../CL/sycl/detail/generic_type_traits.hpp | 2 +- sycl/include/CL/sycl/detail/helpers.hpp | 2 +- .../CL/sycl/detail/image_accessor_util.hpp | 2 +- sycl/include/CL/sycl/detail/image_impl.hpp | 2 +- .../CL/sycl/detail/image_ocl_types.hpp | 2 +- sycl/include/CL/sycl/detail/item_base.hpp | 2 +- sycl/include/CL/sycl/detail/kernel_desc.hpp | 2 +- sycl/include/CL/sycl/detail/kernel_impl.hpp | 2 +- sycl/include/CL/sycl/detail/kernel_info.hpp | 2 +- .../CL/sycl/detail/kernel_program_cache.hpp | 2 +- sycl/include/CL/sycl/detail/locked.hpp | 4 ++- .../include/CL/sycl/detail/memory_manager.hpp | 2 +- sycl/include/CL/sycl/detail/os_util.hpp | 4 ++- sycl/include/CL/sycl/detail/pi.hpp | 2 +- sycl/include/CL/sycl/detail/platform_impl.hpp | 2 +- sycl/include/CL/sycl/detail/platform_info.hpp | 2 +- sycl/include/CL/sycl/detail/platform_util.hpp | 3 +- sycl/include/CL/sycl/detail/program_impl.hpp | 2 +- .../program_manager/program_manager.hpp | 2 +- sycl/include/CL/sycl/detail/queue_impl.hpp | 2 +- sycl/include/CL/sycl/detail/sampler_impl.hpp | 2 +- .../CL/sycl/detail/scheduler/commands.hpp | 3 +- .../CL/sycl/detail/scheduler/scheduler.hpp | 2 +- .../CL/sycl/detail/stl_type_traits.hpp | 2 +- sycl/include/CL/sycl/detail/stream_impl.hpp | 2 +- .../include/CL/sycl/detail/sycl_mem_obj_i.hpp | 2 +- .../include/CL/sycl/detail/sycl_mem_obj_t.hpp | 2 +- sycl/include/CL/sycl/detail/type_list.hpp | 2 +- sycl/include/CL/sycl/detail/type_traits.hpp | 2 +- sycl/include/CL/sycl/detail/usm_dispatch.hpp | 2 +- sycl/include/CL/sycl/detail/usm_impl.hpp | 2 +- sycl/include/CL/sycl/detail/util.hpp | 4 ++- sycl/include/CL/sycl/device.hpp | 2 +- sycl/include/CL/sycl/device_event.hpp | 2 +- sycl/include/CL/sycl/device_selector.hpp | 2 +- sycl/include/CL/sycl/event.hpp | 2 +- sycl/include/CL/sycl/exception.hpp | 2 +- sycl/include/CL/sycl/exception_list.hpp | 3 +- sycl/include/CL/sycl/group.hpp | 2 +- sycl/include/CL/sycl/h_item.hpp | 2 +- sycl/include/CL/sycl/half_type.hpp | 4 ++- sycl/include/CL/sycl/handler.hpp | 2 +- sycl/include/CL/sycl/id.hpp | 2 +- sycl/include/CL/sycl/image.hpp | 2 +- sycl/include/CL/sycl/info/info_desc.hpp | 2 +- .../CL/sycl/intel/fpga_device_selector.hpp | 2 +- sycl/include/CL/sycl/intel/fpga_reg.hpp | 2 +- .../CL/sycl/intel/function_pointer.hpp | 2 +- sycl/include/CL/sycl/intel/functional.hpp | 2 +- sycl/include/CL/sycl/intel/pipes.hpp | 2 +- sycl/include/CL/sycl/intel/sub_group.hpp | 2 +- sycl/include/CL/sycl/intel/sub_group_host.hpp | 2 +- sycl/include/CL/sycl/item.hpp | 2 +- sycl/include/CL/sycl/kernel.hpp | 2 +- sycl/include/CL/sycl/multi_ptr.hpp | 2 +- sycl/include/CL/sycl/nd_item.hpp | 3 +- sycl/include/CL/sycl/nd_range.hpp | 2 +- sycl/include/CL/sycl/ordered_queue.hpp | 2 +- sycl/include/CL/sycl/pipes.hpp | 2 +- sycl/include/CL/sycl/platform.hpp | 2 +- sycl/include/CL/sycl/pointers.hpp | 2 +- sycl/include/CL/sycl/program.hpp | 2 +- sycl/include/CL/sycl/property_list.hpp | 2 +- sycl/include/CL/sycl/queue.hpp | 2 +- sycl/include/CL/sycl/range.hpp | 2 +- sycl/include/CL/sycl/sampler.hpp | 2 +- sycl/include/CL/sycl/stl.hpp | 4 ++- sycl/include/CL/sycl/stream.hpp | 2 +- sycl/include/CL/sycl/types.hpp | 5 ++-- sycl/include/CL/sycl/usm.hpp | 2 +- sycl/include/CL/sycl/usm/usm_allocator.hpp | 2 +- sycl/include/CL/sycl/usm/usm_enums.hpp | 2 +- sycl/source/detail/builtins_helper.hpp | 2 +- .../kernel_name_inside_sycl_namespace.cpp | 2 +- 102 files changed, 160 insertions(+), 122 deletions(-) create mode 100644 sycl/include/CL/sycl/detail/defines.hpp diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp index b6a6344a2dd7a..23ef6c4ad920c 100644 --- a/clang/lib/Sema/SemaSYCL.cpp +++ b/clang/lib/Sema/SemaSYCL.cpp @@ -1638,6 +1638,7 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) { O << "// This is auto-generated SYCL integration header.\n"; O << "\n"; + O << "#include \n"; O << "#include \n"; O << "\n"; @@ -1651,7 +1652,7 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) { } O << "\n"; - O << "namespace cl {\n"; + O << "__SYCL_INLINE namespace cl {\n"; O << "namespace sycl {\n"; O << "namespace detail {\n"; diff --git a/sycl/include/CL/sycl.hpp b/sycl/include/CL/sycl.hpp index ef6a3c016ad80..026dbf9cf36f2 100644 --- a/sycl/include/CL/sycl.hpp +++ b/sycl/include/CL/sycl.hpp @@ -40,3 +40,4 @@ #include #include #include + diff --git a/sycl/include/CL/sycl/access/access.hpp b/sycl/include/CL/sycl/access/access.hpp index d4c962c20d3c2..415104a5b5343 100644 --- a/sycl/include/CL/sycl/access/access.hpp +++ b/sycl/include/CL/sycl/access/access.hpp @@ -7,7 +7,9 @@ //===----------------------------------------------------------------------===// #pragma once -namespace cl { +#include + +__SYCL_INLINE namespace cl { namespace sycl { namespace access { diff --git a/sycl/include/CL/sycl/accessor.hpp b/sycl/include/CL/sycl/accessor.hpp index 697bda6e252cd..28a1785b71ced 100644 --- a/sycl/include/CL/sycl/accessor.hpp +++ b/sycl/include/CL/sycl/accessor.hpp @@ -143,7 +143,7 @@ // accessor_common contains several helpers common for both accessor(1) and // accessor(3) -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class vec; namespace detail { @@ -69,7 +69,7 @@ using half = cl::sycl::detail::half_impl::half; MAKE_VECTOR_ALIASES_FOR_OPENCL_TYPES(N) \ MAKE_VECTOR_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES(N) -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { using byte = std::uint8_t; using schar = signed char; diff --git a/sycl/include/CL/sycl/atomic.hpp b/sycl/include/CL/sycl/atomic.hpp index 5f4c12628f0ce..90cd0789e64e0 100644 --- a/sycl/include/CL/sycl/atomic.hpp +++ b/sycl/include/CL/sycl/atomic.hpp @@ -23,7 +23,7 @@ static_assert(!std::is_same::value, \ "SYCL atomic function not available for float type") -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { enum class memory_order : int { relaxed }; @@ -66,7 +66,7 @@ template <> struct GetSpirvMemoryScope { #ifndef __SYCL_DEVICE_ONLY__ // host implementation of SYCL atomics -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { // Translate cl::sycl::memory_order or __spv::MemorySemanticsMask @@ -161,7 +161,7 @@ extern T __spirv_AtomicMax(std::atomic *Ptr, __spv::Scope S, #endif // !defined(__SYCL_DEVICE_ONLY__) -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template // 4.6.2 Context class -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declarations class device; diff --git a/sycl/include/CL/sycl/detail/accessor_impl.hpp b/sycl/include/CL/sycl/detail/accessor_impl.hpp index c239822831450..b561e123baefe 100644 --- a/sycl/include/CL/sycl/detail/accessor_impl.hpp +++ b/sycl/include/CL/sycl/detail/accessor_impl.hpp @@ -16,7 +16,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/aligned_allocator.hpp b/sycl/include/CL/sycl/detail/aligned_allocator.hpp index f07d65d3c8778..59a69660bfa2c 100644 --- a/sycl/include/CL/sycl/detail/aligned_allocator.hpp +++ b/sycl/include/CL/sycl/detail/aligned_allocator.hpp @@ -19,7 +19,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { template class aligned_allocator { diff --git a/sycl/include/CL/sycl/detail/array.hpp b/sycl/include/CL/sycl/detail/array.hpp index df99314fcbd0d..3b23e9fca80d0 100644 --- a/sycl/include/CL/sycl/detail/array.hpp +++ b/sycl/include/CL/sycl/detail/array.hpp @@ -12,7 +12,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class id; template class range; diff --git a/sycl/include/CL/sycl/detail/boolean.hpp b/sycl/include/CL/sycl/detail/boolean.hpp index 8ca8a4decf62d..f59fb4fe860c2 100644 --- a/sycl/include/CL/sycl/detail/boolean.hpp +++ b/sycl/include/CL/sycl/detail/boolean.hpp @@ -14,7 +14,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/buffer_impl.hpp b/sycl/include/CL/sycl/detail/buffer_impl.hpp index b7f83c9fd50e3..09b6d761fe5f7 100644 --- a/sycl/include/CL/sycl/detail/buffer_impl.hpp +++ b/sycl/include/CL/sycl/detail/buffer_impl.hpp @@ -29,7 +29,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declarations template #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/clusm.hpp b/sycl/include/CL/sycl/detail/clusm.hpp index 85b4a23d9ae07..893982f359bf5 100644 --- a/sycl/include/CL/sycl/detail/clusm.hpp +++ b/sycl/include/CL/sycl/detail/clusm.hpp @@ -17,7 +17,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { namespace usm { diff --git a/sycl/include/CL/sycl/detail/common.hpp b/sycl/include/CL/sycl/detail/common.hpp index 1f63a7420be61..d366b00739598 100644 --- a/sycl/include/CL/sycl/detail/common.hpp +++ b/sycl/include/CL/sycl/detail/common.hpp @@ -8,6 +8,8 @@ #pragma once +#include + // Suppress a compiler warning about undefined CL_TARGET_OPENCL_VERSION // Khronos ICD supports only latest OpenCL version #define CL_TARGET_OPENCL_VERSION 220 @@ -20,7 +22,7 @@ #define STRINGIFY_LINE_HELP(s) #s #define STRINGIFY_LINE(s) STRINGIFY_LINE_HELP(s) -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { @@ -85,21 +87,7 @@ static inline std::string codeToString(cl_int code){ #define CHECK_OCL_CODE_NO_EXC(X) REPORT_OCL_ERR_TO_STREAM(X) #endif -#ifndef __has_attribute -#define __has_attribute(x) 0 -#endif - -#if __has_attribute(always_inline) -#define ALWAYS_INLINE __attribute__((always_inline)) -#else -#define ALWAYS_INLINE -#endif - -#ifndef SYCL_EXTERNAL -#define SYCL_EXTERNAL -#endif - -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { @@ -175,7 +163,7 @@ struct NDLoopIterateImpl { } }; -// spcialization for DIM=0 to terminate recursion +// Specialization for DIM=0 to terminate recursion template class LoopBoundTy, typename FuncTy, template class LoopIndexTy> struct NDLoopIterateImpl { diff --git a/sycl/include/CL/sycl/detail/common_info.hpp b/sycl/include/CL/sycl/detail/common_info.hpp index 814707f0bb4ea..0ae24b2a996aa 100644 --- a/sycl/include/CL/sycl/detail/common_info.hpp +++ b/sycl/include/CL/sycl/detail/common_info.hpp @@ -9,7 +9,7 @@ #pragma once #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/context_impl.hpp b/sycl/include/CL/sycl/detail/context_impl.hpp index efdfbab6465a3..cf5aaae90210f 100644 --- a/sycl/include/CL/sycl/detail/context_impl.hpp +++ b/sycl/include/CL/sycl/detail/context_impl.hpp @@ -22,7 +22,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration class device; diff --git a/sycl/include/CL/sycl/detail/context_info.hpp b/sycl/include/CL/sycl/detail/context_info.hpp index 5c73c167219f2..0f55b177ba638 100644 --- a/sycl/include/CL/sycl/detail/context_info.hpp +++ b/sycl/include/CL/sycl/detail/context_info.hpp @@ -11,7 +11,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/defines.hpp b/sycl/include/CL/sycl/detail/defines.hpp new file mode 100644 index 0000000000000..3e781281e46c7 --- /dev/null +++ b/sycl/include/CL/sycl/detail/defines.hpp @@ -0,0 +1,29 @@ +//==---------- defines.hpp ----- Preprocessor directives -------------------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#pragma once + +#ifndef __SYCL_DISABLE_NAMESPACE_INLINE__ +#define __SYCL_INLINE inline +#else +#define __SYCL_INLINE +#endif // __SYCL_DISABLE_NAMESPACE_INLINE__ + +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + +#if __has_attribute(always_inline) +#define ALWAYS_INLINE __attribute__((always_inline)) +#else +#define ALWAYS_INLINE +#endif + +#ifndef SYCL_EXTERNAL +#define SYCL_EXTERNAL +#endif diff --git a/sycl/include/CL/sycl/detail/device_impl.hpp b/sycl/include/CL/sycl/detail/device_impl.hpp index 72397c872a0b0..30e758777f461 100644 --- a/sycl/include/CL/sycl/detail/device_impl.hpp +++ b/sycl/include/CL/sycl/detail/device_impl.hpp @@ -13,7 +13,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration diff --git a/sycl/include/CL/sycl/detail/device_info.hpp b/sycl/include/CL/sycl/detail/device_info.hpp index f2db09623d19f..4f4081da86999 100644 --- a/sycl/include/CL/sycl/detail/device_info.hpp +++ b/sycl/include/CL/sycl/detail/device_info.hpp @@ -8,12 +8,13 @@ #pragma once #include +#include #include #include #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/event_impl.hpp b/sycl/include/CL/sycl/detail/event_impl.hpp index df071198cfb14..8d28ea278fccd 100644 --- a/sycl/include/CL/sycl/detail/event_impl.hpp +++ b/sycl/include/CL/sycl/detail/event_impl.hpp @@ -15,7 +15,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { class context; namespace detail { diff --git a/sycl/include/CL/sycl/detail/event_info.hpp b/sycl/include/CL/sycl/detail/event_info.hpp index 397cb02458467..7164534a25fa2 100644 --- a/sycl/include/CL/sycl/detail/event_info.hpp +++ b/sycl/include/CL/sycl/detail/event_info.hpp @@ -11,7 +11,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/force_device.hpp b/sycl/include/CL/sycl/detail/force_device.hpp index 855bd310e3c87..e437620803723 100644 --- a/sycl/include/CL/sycl/detail/force_device.hpp +++ b/sycl/include/CL/sycl/detail/force_device.hpp @@ -8,9 +8,10 @@ #pragma once +#include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/generic_type_lists.hpp b/sycl/include/CL/sycl/detail/generic_type_lists.hpp index c777a0553d768..68c663adbc79b 100644 --- a/sycl/include/CL/sycl/detail/generic_type_lists.hpp +++ b/sycl/include/CL/sycl/detail/generic_type_lists.hpp @@ -15,13 +15,13 @@ // types of parameters to kernel functions // Forward declaration -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class vec; } // namespace sycl } // namespace cl -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { namespace gtl { diff --git a/sycl/include/CL/sycl/detail/generic_type_traits.hpp b/sycl/include/CL/sycl/detail/generic_type_traits.hpp index 645410294547c..7e449263087cf 100644 --- a/sycl/include/CL/sycl/detail/generic_type_traits.hpp +++ b/sycl/include/CL/sycl/detail/generic_type_traits.hpp @@ -18,7 +18,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/helpers.hpp b/sycl/include/CL/sycl/detail/helpers.hpp index 5131e0b1664f8..9f04541276562 100644 --- a/sycl/include/CL/sycl/detail/helpers.hpp +++ b/sycl/include/CL/sycl/detail/helpers.hpp @@ -20,7 +20,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { class context; class event; diff --git a/sycl/include/CL/sycl/detail/image_accessor_util.hpp b/sycl/include/CL/sycl/detail/image_accessor_util.hpp index 9c7625267a7fe..c10dbbbf36d8b 100644 --- a/sycl/include/CL/sycl/detail/image_accessor_util.hpp +++ b/sycl/include/CL/sycl/detail/image_accessor_util.hpp @@ -18,7 +18,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/image_impl.hpp b/sycl/include/CL/sycl/detail/image_impl.hpp index 43d154b25bfb5..b57b0b5025f29 100644 --- a/sycl/include/CL/sycl/detail/image_impl.hpp +++ b/sycl/include/CL/sycl/detail/image_impl.hpp @@ -21,7 +21,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // forward declarations diff --git a/sycl/include/CL/sycl/detail/image_ocl_types.hpp b/sycl/include/CL/sycl/detail/image_ocl_types.hpp index e8d622fc3ffd9..e8c925f76ef94 100644 --- a/sycl/include/CL/sycl/detail/image_ocl_types.hpp +++ b/sycl/include/CL/sycl/detail/image_ocl_types.hpp @@ -100,7 +100,7 @@ static RetType __invoke__ImageReadSampler(ImageT Img, CoordT Coords, return cl::sycl::detail::convertDataToType(Ret); } -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/item_base.hpp b/sycl/include/CL/sycl/detail/item_base.hpp index 3ea9b8edb1a49..5b8ae983d36a5 100644 --- a/sycl/include/CL/sycl/detail/item_base.hpp +++ b/sycl/include/CL/sycl/detail/item_base.hpp @@ -11,7 +11,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class id; template class range; diff --git a/sycl/include/CL/sycl/detail/kernel_desc.hpp b/sycl/include/CL/sycl/detail/kernel_desc.hpp index 221fe123d44ee..9051c4ea98f42 100644 --- a/sycl/include/CL/sycl/detail/kernel_desc.hpp +++ b/sycl/include/CL/sycl/detail/kernel_desc.hpp @@ -11,7 +11,7 @@ #include #include // for DLL_LOCAL used in int. header -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/kernel_impl.hpp b/sycl/include/CL/sycl/detail/kernel_impl.hpp index 1502f43e63ff2..e1935698f94e4 100644 --- a/sycl/include/CL/sycl/detail/kernel_impl.hpp +++ b/sycl/include/CL/sycl/detail/kernel_impl.hpp @@ -18,7 +18,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration class program; diff --git a/sycl/include/CL/sycl/detail/kernel_info.hpp b/sycl/include/CL/sycl/detail/kernel_info.hpp index dd0ed7de7d273..ad4e4356063c1 100644 --- a/sycl/include/CL/sycl/detail/kernel_info.hpp +++ b/sycl/include/CL/sycl/detail/kernel_info.hpp @@ -13,7 +13,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/kernel_program_cache.hpp b/sycl/include/CL/sycl/detail/kernel_program_cache.hpp index 4f842d26f6603..8fece6399f4cc 100644 --- a/sycl/include/CL/sycl/detail/kernel_program_cache.hpp +++ b/sycl/include/CL/sycl/detail/kernel_program_cache.hpp @@ -18,7 +18,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { class KernelProgramCache { diff --git a/sycl/include/CL/sycl/detail/locked.hpp b/sycl/include/CL/sycl/detail/locked.hpp index 048e4da61df2e..b74437102665d 100644 --- a/sycl/include/CL/sycl/detail/locked.hpp +++ b/sycl/include/CL/sycl/detail/locked.hpp @@ -8,10 +8,12 @@ #pragma once +#include + #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { /// Represents a reference to value with appropriate lock acquired. diff --git a/sycl/include/CL/sycl/detail/memory_manager.hpp b/sycl/include/CL/sycl/detail/memory_manager.hpp index 05f97d88a3d42..8d5b2b3d201dd 100644 --- a/sycl/include/CL/sycl/detail/memory_manager.hpp +++ b/sycl/include/CL/sycl/detail/memory_manager.hpp @@ -16,7 +16,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/os_util.hpp b/sycl/include/CL/sycl/detail/os_util.hpp index 577396342c809..d0a8b95530848 100644 --- a/sycl/include/CL/sycl/detail/os_util.hpp +++ b/sycl/include/CL/sycl/detail/os_util.hpp @@ -10,6 +10,8 @@ #pragma once +#include + #include #include #include @@ -54,7 +56,7 @@ #endif -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/pi.hpp b/sycl/include/CL/sycl/detail/pi.hpp index 1a6dc67887efe..579ba0c237c4f 100644 --- a/sycl/include/CL/sycl/detail/pi.hpp +++ b/sycl/include/CL/sycl/detail/pi.hpp @@ -17,7 +17,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { namespace pi { diff --git a/sycl/include/CL/sycl/detail/platform_impl.hpp b/sycl/include/CL/sycl/detail/platform_impl.hpp index 7b31e0ec00805..e3728eb2c196e 100644 --- a/sycl/include/CL/sycl/detail/platform_impl.hpp +++ b/sycl/include/CL/sycl/detail/platform_impl.hpp @@ -14,7 +14,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration diff --git a/sycl/include/CL/sycl/detail/platform_info.hpp b/sycl/include/CL/sycl/detail/platform_info.hpp index 8401a9db6a482..820d10b0756ca 100644 --- a/sycl/include/CL/sycl/detail/platform_info.hpp +++ b/sycl/include/CL/sycl/detail/platform_info.hpp @@ -12,7 +12,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/platform_util.hpp b/sycl/include/CL/sycl/detail/platform_util.hpp index f114719c0df34..532368e18079e 100644 --- a/sycl/include/CL/sycl/detail/platform_util.hpp +++ b/sycl/include/CL/sycl/detail/platform_util.hpp @@ -8,6 +8,7 @@ #pragma once +#include #include #ifdef _MSC_VER @@ -15,7 +16,7 @@ #define __builtin_expect(a, b) (a) #endif -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/program_impl.hpp b/sycl/include/CL/sycl/detail/program_impl.hpp index c48d797d48160..66f6b3b471472 100644 --- a/sycl/include/CL/sycl/detail/program_impl.hpp +++ b/sycl/include/CL/sycl/detail/program_impl.hpp @@ -22,7 +22,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { enum class program_state { none, compiled, linked }; diff --git a/sycl/include/CL/sycl/detail/program_manager/program_manager.hpp b/sycl/include/CL/sycl/detail/program_manager/program_manager.hpp index 1774c90cbe195..88d49fcbce8b4 100644 --- a/sycl/include/CL/sycl/detail/program_manager/program_manager.hpp +++ b/sycl/include/CL/sycl/detail/program_manager/program_manager.hpp @@ -29,7 +29,7 @@ extern "C" void __tgt_unregister_lib(pi_device_binaries desc); // +++ } -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { class context; namespace detail { diff --git a/sycl/include/CL/sycl/detail/queue_impl.hpp b/sycl/include/CL/sycl/detail/queue_impl.hpp index 860dc21fee0a8..149c6f42b6069 100644 --- a/sycl/include/CL/sycl/detail/queue_impl.hpp +++ b/sycl/include/CL/sycl/detail/queue_impl.hpp @@ -20,7 +20,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/sampler_impl.hpp b/sycl/include/CL/sycl/detail/sampler_impl.hpp index bdbfa4764b924..07166375f0fd0 100644 --- a/sycl/include/CL/sycl/detail/sampler_impl.hpp +++ b/sycl/include/CL/sycl/detail/sampler_impl.hpp @@ -13,7 +13,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { enum class addressing_mode : unsigned int; diff --git a/sycl/include/CL/sycl/detail/scheduler/commands.hpp b/sycl/include/CL/sycl/detail/scheduler/commands.hpp index 2706de2937eee..2ebc00e4c0864 100644 --- a/sycl/include/CL/sycl/detail/scheduler/commands.hpp +++ b/sycl/include/CL/sycl/detail/scheduler/commands.hpp @@ -12,10 +12,11 @@ #include #include +#include #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/scheduler/scheduler.hpp b/sycl/include/CL/sycl/detail/scheduler/scheduler.hpp index 20c3f398d5336..d936732e4566f 100644 --- a/sycl/include/CL/sycl/detail/scheduler/scheduler.hpp +++ b/sycl/include/CL/sycl/detail/scheduler/scheduler.hpp @@ -17,7 +17,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/stl_type_traits.hpp b/sycl/include/CL/sycl/detail/stl_type_traits.hpp index eba4e7b5baa22..63ab19ec6eb65 100644 --- a/sycl/include/CL/sycl/detail/stl_type_traits.hpp +++ b/sycl/include/CL/sycl/detail/stl_type_traits.hpp @@ -12,7 +12,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/stream_impl.hpp b/sycl/include/CL/sycl/detail/stream_impl.hpp index 305f2d2298d17..81015b12c00e9 100644 --- a/sycl/include/CL/sycl/detail/stream_impl.hpp +++ b/sycl/include/CL/sycl/detail/stream_impl.hpp @@ -15,7 +15,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { 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 3e3ec79780354..23704a3053b6c 100644 --- a/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp +++ b/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp @@ -12,7 +12,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { 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 b86aabefe0624..e8f80eaa4cb96 100644 --- a/sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp +++ b/sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp @@ -19,7 +19,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/type_list.hpp b/sycl/include/CL/sycl/detail/type_list.hpp index fef9edbfbe388..31d4fadb1ba2c 100644 --- a/sycl/include/CL/sycl/detail/type_list.hpp +++ b/sycl/include/CL/sycl/detail/type_list.hpp @@ -13,7 +13,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/detail/type_traits.hpp b/sycl/include/CL/sycl/detail/type_traits.hpp index a78832e49fe56..bde91d54f49ef 100644 --- a/sycl/include/CL/sycl/detail/type_traits.hpp +++ b/sycl/include/CL/sycl/detail/type_traits.hpp @@ -16,7 +16,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration diff --git a/sycl/include/CL/sycl/detail/usm_dispatch.hpp b/sycl/include/CL/sycl/detail/usm_dispatch.hpp index 7248e8544b1c1..89d56e87dc315 100644 --- a/sycl/include/CL/sycl/detail/usm_dispatch.hpp +++ b/sycl/include/CL/sycl/detail/usm_dispatch.hpp @@ -11,7 +11,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { namespace usm { diff --git a/sycl/include/CL/sycl/detail/usm_impl.hpp b/sycl/include/CL/sycl/detail/usm_impl.hpp index d650164e65336..26dd72b41e93e 100644 --- a/sycl/include/CL/sycl/detail/usm_impl.hpp +++ b/sycl/include/CL/sycl/detail/usm_impl.hpp @@ -11,7 +11,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { namespace usm { diff --git a/sycl/include/CL/sycl/detail/util.hpp b/sycl/include/CL/sycl/detail/util.hpp index 80c0374d373f9..8263f316daf59 100644 --- a/sycl/include/CL/sycl/detail/util.hpp +++ b/sycl/include/CL/sycl/detail/util.hpp @@ -10,9 +10,11 @@ #ifndef __SYCL_DEVICE_ONLY +#include + #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/device.hpp b/sycl/include/CL/sycl/device.hpp index eac87b89880fa..d8a03626e455f 100644 --- a/sycl/include/CL/sycl/device.hpp +++ b/sycl/include/CL/sycl/device.hpp @@ -15,7 +15,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declarations class device_selector; diff --git a/sycl/include/CL/sycl/device_event.hpp b/sycl/include/CL/sycl/device_event.hpp index 7267fca01e034..72270e04b8684 100644 --- a/sycl/include/CL/sycl/device_event.hpp +++ b/sycl/include/CL/sycl/device_event.hpp @@ -11,7 +11,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { class device_event { diff --git a/sycl/include/CL/sycl/device_selector.hpp b/sycl/include/CL/sycl/device_selector.hpp index c05b7e2ac496b..8fca60ec76abb 100644 --- a/sycl/include/CL/sycl/device_selector.hpp +++ b/sycl/include/CL/sycl/device_selector.hpp @@ -10,7 +10,7 @@ // 4.6.1 Device selection class -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declarations diff --git a/sycl/include/CL/sycl/event.hpp b/sycl/include/CL/sycl/event.hpp index 593f6353c6516..59b8eec9a9f94 100644 --- a/sycl/include/CL/sycl/event.hpp +++ b/sycl/include/CL/sycl/event.hpp @@ -13,7 +13,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration class context; diff --git a/sycl/include/CL/sycl/exception.hpp b/sycl/include/CL/sycl/exception.hpp index 722f0396ab36a..a01971aa5d662 100644 --- a/sycl/include/CL/sycl/exception.hpp +++ b/sycl/include/CL/sycl/exception.hpp @@ -15,7 +15,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration diff --git a/sycl/include/CL/sycl/exception_list.hpp b/sycl/include/CL/sycl/exception_list.hpp index 3b374942b4d26..6864732a8a5d4 100644 --- a/sycl/include/CL/sycl/exception_list.hpp +++ b/sycl/include/CL/sycl/exception_list.hpp @@ -10,11 +10,12 @@ // 4.9.2 Exception Class Interface +#include #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration diff --git a/sycl/include/CL/sycl/group.hpp b/sycl/include/CL/sycl/group.hpp index 3f86bf5d4ffca..e96759a911e35 100644 --- a/sycl/include/CL/sycl/group.hpp +++ b/sycl/include/CL/sycl/group.hpp @@ -21,7 +21,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { class Builder; diff --git a/sycl/include/CL/sycl/h_item.hpp b/sycl/include/CL/sycl/h_item.hpp index 53da0e9b617b9..fc8053afe5de4 100644 --- a/sycl/include/CL/sycl/h_item.hpp +++ b/sycl/include/CL/sycl/h_item.hpp @@ -13,7 +13,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { diff --git a/sycl/include/CL/sycl/half_type.hpp b/sycl/include/CL/sycl/half_type.hpp index b8a4ea83bd98c..85584690a1644 100644 --- a/sycl/include/CL/sycl/half_type.hpp +++ b/sycl/include/CL/sycl/half_type.hpp @@ -8,13 +8,15 @@ #pragma once +#include + #include #include #include #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { namespace half_impl { diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index 7d3ef925c99a5..6c054a6c3f383 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -59,7 +59,7 @@ template class __copyAcc2Acc; -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration diff --git a/sycl/include/CL/sycl/id.hpp b/sycl/include/CL/sycl/id.hpp index 89530b5992007..1a993c281953e 100644 --- a/sycl/include/CL/sycl/id.hpp +++ b/sycl/include/CL/sycl/id.hpp @@ -13,7 +13,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class range; template class item; diff --git a/sycl/include/CL/sycl/image.hpp b/sycl/include/CL/sycl/image.hpp index 945c50cf7fe34..2a31a852f2d81 100644 --- a/sycl/include/CL/sycl/image.hpp +++ b/sycl/include/CL/sycl/image.hpp @@ -16,7 +16,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { enum class image_channel_order : unsigned int { diff --git a/sycl/include/CL/sycl/info/info_desc.hpp b/sycl/include/CL/sycl/info/info_desc.hpp index d0969c49399d4..05c70191fc89a 100644 --- a/sycl/include/CL/sycl/info/info_desc.hpp +++ b/sycl/include/CL/sycl/info/info_desc.hpp @@ -12,7 +12,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { class program; diff --git a/sycl/include/CL/sycl/intel/fpga_device_selector.hpp b/sycl/include/CL/sycl/intel/fpga_device_selector.hpp index 8084f67f91b6b..7979eb4a71068 100644 --- a/sycl/include/CL/sycl/intel/fpga_device_selector.hpp +++ b/sycl/include/CL/sycl/intel/fpga_device_selector.hpp @@ -10,7 +10,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace intel { diff --git a/sycl/include/CL/sycl/intel/fpga_reg.hpp b/sycl/include/CL/sycl/intel/fpga_reg.hpp index 0ebd6e1148482..4fee91ed109ec 100644 --- a/sycl/include/CL/sycl/intel/fpga_reg.hpp +++ b/sycl/include/CL/sycl/intel/fpga_reg.hpp @@ -8,7 +8,7 @@ #pragma once -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace intel { diff --git a/sycl/include/CL/sycl/intel/function_pointer.hpp b/sycl/include/CL/sycl/intel/function_pointer.hpp index c41971e24fecb..1dce2bb202db2 100644 --- a/sycl/include/CL/sycl/intel/function_pointer.hpp +++ b/sycl/include/CL/sycl/intel/function_pointer.hpp @@ -14,7 +14,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace intel { diff --git a/sycl/include/CL/sycl/intel/functional.hpp b/sycl/include/CL/sycl/intel/functional.hpp index ef1729f0e8ced..88b40489a0848 100644 --- a/sycl/include/CL/sycl/intel/functional.hpp +++ b/sycl/include/CL/sycl/intel/functional.hpp @@ -9,7 +9,7 @@ #pragma once #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace intel { diff --git a/sycl/include/CL/sycl/intel/pipes.hpp b/sycl/include/CL/sycl/intel/pipes.hpp index 9f6542e1a01c9..e670f83817006 100644 --- a/sycl/include/CL/sycl/intel/pipes.hpp +++ b/sycl/include/CL/sycl/intel/pipes.hpp @@ -12,7 +12,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace intel { diff --git a/sycl/include/CL/sycl/intel/sub_group.hpp b/sycl/include/CL/sycl/intel/sub_group.hpp index 35e394fe951cd..8de208238b71a 100644 --- a/sycl/include/CL/sycl/intel/sub_group.hpp +++ b/sycl/include/CL/sycl/intel/sub_group.hpp @@ -19,7 +19,7 @@ #include #ifdef __SYCL_DEVICE_ONLY__ -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class multi_ptr; diff --git a/sycl/include/CL/sycl/intel/sub_group_host.hpp b/sycl/include/CL/sycl/intel/sub_group_host.hpp index 67d73a21271a4..441c229c8bf44 100644 --- a/sycl/include/CL/sycl/intel/sub_group_host.hpp +++ b/sycl/include/CL/sycl/intel/sub_group_host.hpp @@ -15,7 +15,7 @@ #include #ifndef __SYCL_DEVICE_ONLY__ -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class multi_ptr; namespace intel { diff --git a/sycl/include/CL/sycl/item.hpp b/sycl/include/CL/sycl/item.hpp index ac719907a5053..10c7003cfa9cb 100644 --- a/sycl/include/CL/sycl/item.hpp +++ b/sycl/include/CL/sycl/item.hpp @@ -14,7 +14,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { class Builder; diff --git a/sycl/include/CL/sycl/kernel.hpp b/sycl/include/CL/sycl/kernel.hpp index dd4a9fc218405..79e72aa4f5aab 100644 --- a/sycl/include/CL/sycl/kernel.hpp +++ b/sycl/include/CL/sycl/kernel.hpp @@ -14,7 +14,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration class program; diff --git a/sycl/include/CL/sycl/multi_ptr.hpp b/sycl/include/CL/sycl/multi_ptr.hpp index 7c7b4e6391bdd..d67390b96831f 100644 --- a/sycl/include/CL/sycl/multi_ptr.hpp +++ b/sycl/include/CL/sycl/multi_ptr.hpp @@ -13,7 +13,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration template #include +#include #include #include #include @@ -21,7 +22,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { class Builder; diff --git a/sycl/include/CL/sycl/nd_range.hpp b/sycl/include/CL/sycl/nd_range.hpp index 2f35a3705a357..2e90636c138ba 100644 --- a/sycl/include/CL/sycl/nd_range.hpp +++ b/sycl/include/CL/sycl/nd_range.hpp @@ -13,7 +13,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class nd_range { diff --git a/sycl/include/CL/sycl/ordered_queue.hpp b/sycl/include/CL/sycl/ordered_queue.hpp index 1a50be13606bf..319055cd73e0b 100644 --- a/sycl/include/CL/sycl/ordered_queue.hpp +++ b/sycl/include/CL/sycl/ordered_queue.hpp @@ -18,7 +18,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration diff --git a/sycl/include/CL/sycl/pipes.hpp b/sycl/include/CL/sycl/pipes.hpp index 20d7299fd5b47..5eb1f3d654bf2 100644 --- a/sycl/include/CL/sycl/pipes.hpp +++ b/sycl/include/CL/sycl/pipes.hpp @@ -10,7 +10,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template using pipe = intel::pipe; diff --git a/sycl/include/CL/sycl/platform.hpp b/sycl/include/CL/sycl/platform.hpp index ae949da54e636..4facc7c2bc733 100644 --- a/sycl/include/CL/sycl/platform.hpp +++ b/sycl/include/CL/sycl/platform.hpp @@ -13,7 +13,7 @@ // 4.6.2 Platform class #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // TODO: make code thread-safe diff --git a/sycl/include/CL/sycl/pointers.hpp b/sycl/include/CL/sycl/pointers.hpp index b9df17c6a6b72..4141d59b4701f 100644 --- a/sycl/include/CL/sycl/pointers.hpp +++ b/sycl/include/CL/sycl/pointers.hpp @@ -10,7 +10,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class multi_ptr; diff --git a/sycl/include/CL/sycl/program.hpp b/sycl/include/CL/sycl/program.hpp index a36c0812c03de..504a6661ad30b 100644 --- a/sycl/include/CL/sycl/program.hpp +++ b/sycl/include/CL/sycl/program.hpp @@ -15,7 +15,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { class context; diff --git a/sycl/include/CL/sycl/property_list.hpp b/sycl/include/CL/sycl/property_list.hpp index a21ed1896662b..2a446245af2ef 100644 --- a/sycl/include/CL/sycl/property_list.hpp +++ b/sycl/include/CL/sycl/property_list.hpp @@ -13,7 +13,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // HOW TO ADD NEW PROPERTY INSTRUCTION: diff --git a/sycl/include/CL/sycl/queue.hpp b/sycl/include/CL/sycl/queue.hpp index 4fcf38408d919..622238531ed1c 100644 --- a/sycl/include/CL/sycl/queue.hpp +++ b/sycl/include/CL/sycl/queue.hpp @@ -18,7 +18,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { // Forward declaration diff --git a/sycl/include/CL/sycl/range.hpp b/sycl/include/CL/sycl/range.hpp index 259613ebb82fe..1355818c6a985 100644 --- a/sycl/include/CL/sycl/range.hpp +++ b/sycl/include/CL/sycl/range.hpp @@ -12,7 +12,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template class id; template class range : public detail::array { diff --git a/sycl/include/CL/sycl/sampler.hpp b/sycl/include/CL/sycl/sampler.hpp index 4fd1db1af46ec..5c10eab555854 100644 --- a/sycl/include/CL/sycl/sampler.hpp +++ b/sycl/include/CL/sycl/sampler.hpp @@ -13,7 +13,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { enum class addressing_mode : unsigned int { mirrored_repeat = CL_ADDRESS_MIRRORED_REPEAT, diff --git a/sycl/include/CL/sycl/stl.hpp b/sycl/include/CL/sycl/stl.hpp index d946c48fdfbe7..f6b01a4080c2b 100644 --- a/sycl/include/CL/sycl/stl.hpp +++ b/sycl/include/CL/sycl/stl.hpp @@ -10,6 +10,8 @@ // 4.5 C++ Standard library classes required for the interface +#include + #include #include #include @@ -17,7 +19,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template < class T, class Alloc = std::allocator > diff --git a/sycl/include/CL/sycl/stream.hpp b/sycl/include/CL/sycl/stream.hpp index 5c78eda50e6d3..1dfbfab064386 100644 --- a/sycl/include/CL/sycl/stream.hpp +++ b/sycl/include/CL/sycl/stream.hpp @@ -10,7 +10,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { enum class stream_manipulator { diff --git a/sycl/include/CL/sycl/types.hpp b/sycl/include/CL/sycl/types.hpp index ba7e004a5c8bf..1d8b43f6bc771 100644 --- a/sycl/include/CL/sycl/types.hpp +++ b/sycl/include/CL/sycl/types.hpp @@ -45,6 +45,7 @@ #endif // __HAS_EXT_VECTOR_TYPE__ #include +#include #include #include #include @@ -60,7 +61,7 @@ // 4.10.1: Scalar data types // 4.10.2: SYCL vector types -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { enum class rounding_mode { automatic, rte, rtz, rtp, rtn }; @@ -1837,7 +1838,7 @@ using __half16_vec_t = half_vec<16>; #define GET_CL_HALF_TYPE(target, num) __##target##num##_vec_t -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace detail { // select_apply_cl_t selects from T8/T16/T32/T64 basing on diff --git a/sycl/include/CL/sycl/usm.hpp b/sycl/include/CL/sycl/usm.hpp index 8b6b5919d831e..f96eda45631ac 100644 --- a/sycl/include/CL/sycl/usm.hpp +++ b/sycl/include/CL/sycl/usm.hpp @@ -13,7 +13,7 @@ #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { /// // Explicit USM diff --git a/sycl/include/CL/sycl/usm/usm_allocator.hpp b/sycl/include/CL/sycl/usm/usm_allocator.hpp index 72509af8aee0d..91f726142b789 100644 --- a/sycl/include/CL/sycl/usm/usm_allocator.hpp +++ b/sycl/include/CL/sycl/usm/usm_allocator.hpp @@ -17,7 +17,7 @@ #include #include -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { template diff --git a/sycl/include/CL/sycl/usm/usm_enums.hpp b/sycl/include/CL/sycl/usm/usm_enums.hpp index 3a65a48f1c862..502ca66da1963 100644 --- a/sycl/include/CL/sycl/usm/usm_enums.hpp +++ b/sycl/include/CL/sycl/usm/usm_enums.hpp @@ -7,7 +7,7 @@ // ===--------------------------------------------------------------------=== // #pragma once -namespace cl { +__SYCL_INLINE namespace cl { namespace sycl { namespace usm { diff --git a/sycl/source/detail/builtins_helper.hpp b/sycl/source/detail/builtins_helper.hpp index 282078302b2e8..1d46c731ae86e 100644 --- a/sycl/source/detail/builtins_helper.hpp +++ b/sycl/source/detail/builtins_helper.hpp @@ -206,7 +206,7 @@ __MAKE_1V_2V_3P(Fun, 8, Ret, Arg1, Arg2, Arg3) \ __MAKE_1V_2V_3P(Fun, 16, Ret, Arg1, Arg2, Arg3) -namespace cl { +__SYCL_INLINE namespace cl { namespace __host_std { namespace detail { diff --git a/sycl/test/regression/kernel_name_inside_sycl_namespace.cpp b/sycl/test/regression/kernel_name_inside_sycl_namespace.cpp index 8f7557ce1b24b..b28a43994b624 100644 --- a/sycl/test/regression/kernel_name_inside_sycl_namespace.cpp +++ b/sycl/test/regression/kernel_name_inside_sycl_namespace.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl %s -o %t.out +// RUN: %clangxx -fsycl -D__SYCL_DISABLE_NAMESPACE_INLINE__ %s -o %t.out // RUN: env SYCL_DEVICE_TYPE=HOST %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out