DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
stl.hpp
Go to the documentation of this file.
1 //==----------- stl.hpp - basic STL implementation -------------------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 // 4.5 C++ Standard library classes required for the interface
12 
13 #include <CL/sycl/bit_cast.hpp>
15 #include <CL/sycl/sycl_span.hpp>
16 
17 #include <exception>
18 #include <functional>
19 #include <memory>
20 #include <mutex>
21 #include <string>
22 #include <vector>
23 
25 namespace sycl {
26 
27 #if defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__)
28 // SYCL library is designed such a way that STL objects cross DLL boundary,
29 // which is guaranteed to work properly only when the application uses the same
30 // C++ runtime that SYCL library uses.
31 // The appplications using sycl.dll must be linked with dynamic/release C++ MSVC
32 // runtime, i.e. be compiled with /MD switch. Similarly, the applications using
33 // sycld.dll must be linked with dynamic/debug C++ runtime and be compiled with
34 // /MDd switch.
35 // Compiler automatically adds /MD or /MDd when -fsycl switch is used.
36 // The options /MD and /MDd that make the code to use dynamic runtime also
37 // define the _DLL macro.
38 #if defined(_MSC_VER)
39 #pragma message( \
40  "SYCL library is designed to work safely with dynamic C++ runtime." \
41  "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, " \
42  "or -fsycl switch to set C++ runtime automatically.")
43 #else
44 #warning "SYCL library is designed to work safely with dynamic C++ runtime."\
45  "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, "\
46  "or -fsycl switch to set C++ runtime automatically."
47 #endif
48 #endif // defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__)
49 
50 template <typename T, typename... ArgsT>
51 std::unique_ptr<T> make_unique_ptr(ArgsT &&... Args) {
52  return std::unique_ptr<T>(new T(std::forward<ArgsT>(Args)...));
53 }
54 
55 } // namespace sycl
56 } // __SYCL_INLINE_NAMESPACE(cl)
T
defines.hpp
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
bit_cast.hpp
sycl_span.hpp
cl::sycl::make_unique_ptr
std::unique_ptr< T > make_unique_ptr(ArgsT &&... Args)
Definition: stl.hpp:51
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12