DPC++ Runtime
Runtime libraries for oneAPI DPC++
common.hpp
Go to the documentation of this file.
1 //==---------- common.hpp ----- Common declarations ------------------------==//
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 #include <sycl/detail/defines.hpp>
13 #include <sycl/detail/export.hpp>
14 #include <sycl/detail/pi.hpp>
16 
17 #include <cstdint>
18 #include <string>
19 
20 // Default signature enables the passing of user code location information to
21 // public methods as a default argument. If the end-user wants to disable the
22 // code location information, they must compile the code with
23 // -DDISABLE_SYCL_INSTRUMENTATION_METADATA flag
24 namespace sycl {
26 namespace detail {
27 
28 // The check for output iterator is commented out as it blocks set_final_data
29 // with void * argument to be used.
30 // TODO: Align these checks with the SYCL specification when the behaviour
31 // with void * is clarified.
32 template <typename DataT>
34  /*is_output_iterator<DataT>::value &&*/ std::is_pointer<DataT>::value>;
35 
36 template <typename DataT>
38  /*is_output_iterator<DataT>::value &&*/ !std::is_pointer<DataT>::value>;
39 
40 #if !defined(NDEBUG) && (_MSC_VER > 1929 || __has_builtin(__builtin_FILE))
41 #define __CODELOC_FILE_NAME __builtin_FILE()
42 #else
43 #define __CODELOC_FILE_NAME nullptr
44 #endif
45 
46 #if _MSC_VER > 1929 || __has_builtin(__builtin_FUNCTION)
47 #define __CODELOC_FUNCTION __builtin_FUNCTION()
48 #else
49 #define __CODELOC_FUNCTION nullptr
50 #endif
51 
52 #if _MSC_VER > 1929 || __has_builtin(__builtin_LINE)
53 #define __CODELOC_LINE __builtin_LINE()
54 #else
55 #define __CODELOC_LINE 0
56 #endif
57 
58 #if _MSC_VER > 1929 || __has_builtin(__builtin_COLUMN)
59 #define __CODELOC_COLUMN __builtin_COLUMN()
60 #else
61 #define __CODELOC_COLUMN 0
62 #endif
63 
64 // Data structure that captures the user code location information using the
65 // builtin capabilities of the compiler
66 struct code_location {
67  static constexpr code_location
68  current(const char *fileName = __CODELOC_FILE_NAME,
69  const char *funcName = __CODELOC_FUNCTION,
70  unsigned long lineNo = __CODELOC_LINE,
71  unsigned long columnNo = __CODELOC_COLUMN) noexcept {
72  return code_location(fileName, funcName, lineNo, columnNo);
73  }
74 
75 #undef __CODELOC_FILE_NAME
76 #undef __CODELOC_FUNCTION
77 #undef __CODELOC_LINE
78 #undef __CODELOC_COLUMN
79 
80  constexpr code_location(const char *file, const char *func, int line,
81  int col) noexcept
82  : MFileName(file), MFunctionName(func), MLineNo(line), MColumnNo(col) {}
83 
84  constexpr code_location() noexcept
85  : MFileName(nullptr), MFunctionName(nullptr), MLineNo(0), MColumnNo(0) {}
86 
87  constexpr unsigned long lineNumber() const noexcept { return MLineNo; }
88  constexpr unsigned long columnNumber() const noexcept { return MColumnNo; }
89  constexpr const char *fileName() const noexcept { return MFileName; }
90  constexpr const char *functionName() const noexcept { return MFunctionName; }
91 
92 private:
93  const char *MFileName;
94  const char *MFunctionName;
95  unsigned long MLineNo;
96  unsigned long MColumnNo;
97 };
98 
99 // The C++ FE may instrument user calls with code location metadata.
100 // If it does then that will appear as an extra last argument.
101 // Having _TWO_ mid-param #ifdefs makes the functions very difficult to read.
102 // Here we simplify the &CodeLoc declaration to be _CODELOCPARAM(&CodeLoc) and
103 // _CODELOCARG(&CodeLoc).
104 
105 #ifndef DISABLE_SYCL_INSTRUMENTATION_METADATA
106 #define _CODELOCONLYPARAM(a) \
107  const detail::code_location a = detail::code_location::current()
108 #define _CODELOCPARAM(a) \
109  , const detail::code_location a = detail::code_location::current()
110 #define _CODELOCPARAMDEF(a) , const detail::code_location a
111 
112 #define _CODELOCARG(a)
113 #define _CODELOCFW(a) , a
114 #else
115 #define _CODELOCONLYPARAM(a)
116 #define _CODELOCPARAM(a)
117 
118 #define _CODELOCARG(a) const detail::code_location a = {}
119 #define _CODELOCFW(a)
120 #endif
121 
152 class __SYCL_EXPORT tls_code_loc_t {
153 public:
157  tls_code_loc_t();
160  tls_code_loc_t(const detail::code_location &CodeLoc);
162  ~tls_code_loc_t();
166  const detail::code_location &query();
167 
168 private:
169  // The flag that is used to determine if the object is in a local scope or in
170  // the top level scope.
171  bool MLocalScope = true;
172 };
173 
174 } // namespace detail
175 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
176 } // namespace sycl
177 
178 namespace sycl {
180 namespace detail {
181 
182 __SYCL_EXPORT const char *stringifyErrorCode(pi_int32 error);
183 
184 static inline std::string codeToString(pi_int32 code) {
185  return std::string(std::to_string(code) + " (" + stringifyErrorCode(code) +
186  ")");
187 }
188 
189 } // namespace detail
190 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
191 } // namespace sycl
192 
193 #ifdef __SYCL_DEVICE_ONLY__
194 // TODO remove this when 'assert' is supported in device code
195 #define __SYCL_ASSERT(x)
196 #else
197 #define __SYCL_ASSERT(x) assert(x)
198 #endif // #ifdef __SYCL_DEVICE_ONLY__
199 
200 #define __SYCL_PI_ERROR_REPORT \
201  "Native API failed. " /*__FILE__*/ \
202  /* TODO: replace __FILE__ to report only relative path*/ \
203  /* ":" __SYCL_STRINGIFY(__LINE__) ": " */ \
204  "Native API returns: "
205 
206 #ifndef __SYCL_SUPPRESS_PI_ERROR_REPORT
208 // TODO: rename all names with direct use of OCL/OPENCL to be backend agnostic.
209 #define __SYCL_REPORT_PI_ERR_TO_STREAM(expr) \
210  { \
211  auto code = expr; \
212  if (code != PI_SUCCESS) { \
213  std::cerr << __SYCL_PI_ERROR_REPORT << sycl::detail::codeToString(code) \
214  << std::endl; \
215  } \
216  }
217 #endif
218 
219 #ifndef SYCL_SUPPRESS_EXCEPTIONS
220 #include <sycl/exception.hpp>
221 // SYCL 1.2.1 exceptions
222 #define __SYCL_REPORT_PI_ERR_TO_EXC(expr, exc, str) \
223  { \
224  auto code = expr; \
225  if (code != PI_SUCCESS) { \
226  std::string err_str = \
227  str ? "\n" + std::string(str) + "\n" : std::string{}; \
228  throw exc(__SYCL_PI_ERROR_REPORT + sycl::detail::codeToString(code) + \
229  err_str, \
230  code); \
231  } \
232  }
233 #define __SYCL_REPORT_PI_ERR_TO_EXC_THROW(code, exc, str) \
234  __SYCL_REPORT_PI_ERR_TO_EXC(code, exc, str)
235 #define __SYCL_REPORT_PI_ERR_TO_EXC_BASE(code) \
236  __SYCL_REPORT_PI_ERR_TO_EXC(code, sycl::runtime_error, nullptr)
237 #else
238 #define __SYCL_REPORT_PI_ERR_TO_EXC_BASE(code) \
239  __SYCL_REPORT_PI_ERR_TO_STREAM(code)
240 #endif
241 // SYCL 2020 exceptions
242 #define __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC(expr, errc) \
243  { \
244  auto code = expr; \
245  if (code != PI_SUCCESS) { \
246  throw sycl::exception(sycl::make_error_code(errc), \
247  __SYCL_PI_ERROR_REPORT + \
248  sycl::detail::codeToString(code)); \
249  } \
250  }
251 #define __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC(code, errc) \
252  __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC(code, errc)
253 
254 #ifdef __SYCL_SUPPRESS_PI_ERROR_REPORT
255 // SYCL 1.2.1 exceptions
256 #define __SYCL_CHECK_OCL_CODE(X) (void)(X)
257 #define __SYCL_CHECK_OCL_CODE_THROW(X, EXC, STR) \
258  { \
259  (void)(X); \
260  (void)(STR); \
261  }
262 #define __SYCL_CHECK_OCL_CODE_NO_EXC(X) (void)(X)
263 // SYCL 2020 exceptions
264 #define __SYCL_CHECK_CODE_THROW_VIA_ERRC(X, ERRC) (void)(X)
265 #else
266 // SYCL 1.2.1 exceptions
267 #define __SYCL_CHECK_OCL_CODE(X) __SYCL_REPORT_PI_ERR_TO_EXC_BASE(X)
268 #define __SYCL_CHECK_OCL_CODE_THROW(X, EXC, STR) \
269  __SYCL_REPORT_PI_ERR_TO_EXC_THROW(X, EXC, STR)
270 #define __SYCL_CHECK_OCL_CODE_NO_EXC(X) __SYCL_REPORT_PI_ERR_TO_STREAM(X)
271 // SYCL 2020 exceptions
272 #define __SYCL_CHECK_CODE_THROW_VIA_ERRC(X, ERRC) \
273  __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC(X, ERRC)
274 #endif
275 
276 // Helper for enabling empty-base optimizations on MSVC.
277 // TODO: Remove this when MSVC has this optimization enabled by default.
278 #ifdef _MSC_VER
279 #define __SYCL_EBO __declspec(empty_bases)
280 #else
281 #define __SYCL_EBO
282 #endif
283 
284 namespace sycl {
286 namespace detail {
287 
288 // Helper function for extracting implementation from SYCL's interface objects.
289 // Note! This function relies on the fact that all SYCL interface classes
290 // contain "impl" field that points to implementation object. "impl" field
291 // should be accessible from this function.
292 //
293 // Note that due to a bug in MSVC compilers (including MSVC2019 v19.20), it
294 // may not recognize the usage of this function in friend member declarations
295 // if the template parameter name there is not equal to the name used here,
296 // i.e. 'Obj'. For example, using 'Obj' here and 'T' in such declaration
297 // would trigger that error in MSVC:
298 // template <class T>
299 // friend decltype(T::impl) detail::getSyclObjImpl(const T &SyclObject);
300 template <class Obj> decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject) {
301  assert(SyclObject.impl && "every constructor should create an impl");
302  return SyclObject.impl;
303 }
304 
305 // Returns the raw pointer to the impl object of given face object. The caller
306 // must make sure the returned pointer is not captured in a field or otherwise
307 // stored - i.e. must live only as on-stack value.
308 template <class T>
309 typename detail::add_pointer_t<typename decltype(T::impl)::element_type>
310 getRawSyclObjImpl(const T &SyclObject) {
311  return SyclObject.impl.get();
312 }
313 
314 // Helper function for creation SYCL interface objects from implementations.
315 // Note! This function relies on the fact that all SYCL interface classes
316 // contain "impl" field that points to implementation object. "impl" field
317 // should be accessible from this function.
318 template <class T> T createSyclObjFromImpl(decltype(T::impl) ImplObj) {
319  return T(ImplObj);
320 }
321 
322 // Produces N-dimensional object of type T whose all components are initialized
323 // to given integer value.
324 template <int N, template <int> class T> struct InitializedVal {
325  template <int Val> static T<N> get();
326 };
327 
328 // Specialization for a one-dimensional type.
329 template <template <int> class T> struct InitializedVal<1, T> {
330  template <int Val> static T<1> get() { return T<1>{Val}; }
331 };
332 
333 // Specialization for a two-dimensional type.
334 template <template <int> class T> struct InitializedVal<2, T> {
335  template <int Val> static T<2> get() { return T<2>{Val, Val}; }
336 };
337 
338 // Specialization for a three-dimensional type.
339 template <template <int> class T> struct InitializedVal<3, T> {
340  template <int Val> static T<3> get() { return T<3>{Val, Val, Val}; }
341 };
342 
344 template <int NDims, int Dim, template <int> class LoopBoundTy, typename FuncTy,
345  template <int> class LoopIndexTy>
347  NDLoopIterateImpl(const LoopIndexTy<NDims> &LowerBound,
348  const LoopBoundTy<NDims> &Stride,
349  const LoopBoundTy<NDims> &UpperBound, FuncTy f,
350  LoopIndexTy<NDims> &Index) {
351  constexpr size_t AdjIdx = NDims - 1 - Dim;
352  for (Index[AdjIdx] = LowerBound[AdjIdx]; Index[AdjIdx] < UpperBound[AdjIdx];
353  Index[AdjIdx] += Stride[AdjIdx]) {
354 
355  NDLoopIterateImpl<NDims, Dim - 1, LoopBoundTy, FuncTy, LoopIndexTy>{
356  LowerBound, Stride, UpperBound, f, Index};
357  }
358  }
359 };
360 
361 // Specialization for Dim=0 to terminate recursion
362 template <int NDims, template <int> class LoopBoundTy, typename FuncTy,
363  template <int> class LoopIndexTy>
364 struct NDLoopIterateImpl<NDims, 0, LoopBoundTy, FuncTy, LoopIndexTy> {
365  NDLoopIterateImpl(const LoopIndexTy<NDims> &LowerBound,
366  const LoopBoundTy<NDims> &Stride,
367  const LoopBoundTy<NDims> &UpperBound, FuncTy f,
368  LoopIndexTy<NDims> &Index) {
369 
370  constexpr size_t AdjIdx = NDims - 1;
371  for (Index[AdjIdx] = LowerBound[AdjIdx]; Index[AdjIdx] < UpperBound[AdjIdx];
372  Index[AdjIdx] += Stride[AdjIdx]) {
373 
374  f(Index);
375  }
376  }
377 };
378 
385 template <int NDims> struct NDLoop {
389  template <template <int> class LoopBoundTy, typename FuncTy,
390  template <int> class LoopIndexTy = LoopBoundTy>
391  static __SYCL_ALWAYS_INLINE void iterate(const LoopBoundTy<NDims> &UpperBound,
392  FuncTy f) {
393  const LoopIndexTy<NDims> LowerBound =
395  const LoopBoundTy<NDims> Stride =
397  LoopIndexTy<NDims> Index =
399 
400  NDLoopIterateImpl<NDims, NDims - 1, LoopBoundTy, FuncTy, LoopIndexTy>{
401  LowerBound, Stride, UpperBound, f, Index};
402  }
403 
407  template <template <int> class LoopBoundTy, typename FuncTy,
408  template <int> class LoopIndexTy = LoopBoundTy>
409  static __SYCL_ALWAYS_INLINE void iterate(const LoopIndexTy<NDims> &LowerBound,
410  const LoopBoundTy<NDims> &Stride,
411  const LoopBoundTy<NDims> &UpperBound,
412  FuncTy f) {
413  LoopIndexTy<NDims> Index =
415  NDLoopIterateImpl<NDims, NDims - 1, LoopBoundTy, FuncTy, LoopIndexTy>{
416  LowerBound, Stride, UpperBound, f, Index};
417  }
418 };
419 
420 constexpr size_t getNextPowerOfTwoHelper(size_t Var, size_t Offset) {
421  return Offset != 64
422  ? getNextPowerOfTwoHelper(Var | (Var >> Offset), Offset * 2)
423  : Var;
424 }
425 
426 // Returns the smallest power of two not less than Var
427 constexpr size_t getNextPowerOfTwo(size_t Var) {
428  return getNextPowerOfTwoHelper(Var - 1, 1) + 1;
429 }
430 
431 // Returns linear index by given index and range
432 template <int Dims, template <int> class T, template <int> class U>
433 size_t getLinearIndex(const T<Dims> &Index, const U<Dims> &Range) {
434  size_t LinearIndex = 0;
435  for (int I = 0; I < Dims; ++I)
436  LinearIndex = LinearIndex * Range[I] + Index[I];
437  return LinearIndex;
438 }
439 
440 // Kernel set ID, used to group kernels (represented by OSModule & kernel name
441 // pairs) into disjoint sets based on the kernel distribution among device
442 // images.
443 using KernelSetId = size_t;
444 // Kernel set ID for kernels contained within the SPIR-V file specified via
445 // environment.
446 constexpr KernelSetId SpvFileKSId = 0;
448 
449 template <typename T> struct InlineVariableHelper {
450  static constexpr T value{};
451 };
452 
453 template <typename T> constexpr T InlineVariableHelper<T>::value;
454 
455 // The function extends or truncates number of dimensions of objects of id
456 // or ranges classes. When extending the new values are filled with
457 // DefaultValue, truncation just removes extra values.
458 template <int NewDim, int DefaultValue, template <int> class T, int OldDim>
459 static T<NewDim> convertToArrayOfN(T<OldDim> OldObj) {
461  const int CopyDims = NewDim > OldDim ? OldDim : NewDim;
462  for (int I = 0; I < CopyDims; ++I)
463  NewObj[I] = OldObj[I];
464  for (int I = CopyDims; I < NewDim; ++I)
465  NewObj[I] = DefaultValue;
466  return NewObj;
467 }
468 
469 // Helper function for concatenating two std::array.
470 template <typename T, std::size_t... Is1, std::size_t... Is2>
471 constexpr std::array<T, sizeof...(Is1) + sizeof...(Is2)>
472 ConcatArrays(const std::array<T, sizeof...(Is1)> &A1,
473  const std::array<T, sizeof...(Is2)> &A2,
474  std::index_sequence<Is1...>, std::index_sequence<Is2...>) {
475  return {A1[Is1]..., A2[Is2]...};
476 }
477 template <typename T, std::size_t N1, std::size_t N2>
478 constexpr std::array<T, N1 + N2> ConcatArrays(const std::array<T, N1> &A1,
479  const std::array<T, N2> &A2) {
480  return ConcatArrays(A1, A2, std::make_index_sequence<N1>(),
481  std::make_index_sequence<N2>());
482 }
483 
484 // Utility for creating an std::array from the results of flattening the
485 // arguments using a flattening functor.
486 template <typename DataT, template <typename, typename> typename FlattenF,
487  typename... ArgTN>
489 template <typename DataT, template <typename, typename> typename FlattenF,
490  typename ArgT, typename... ArgTN>
491 struct ArrayCreator<DataT, FlattenF, ArgT, ArgTN...> {
492  static constexpr auto Create(const ArgT &Arg, const ArgTN &...Args) {
493  auto ImmArray = FlattenF<DataT, ArgT>()(Arg);
494  // Due to a bug in MSVC narrowing size_t to a bool in an if constexpr causes
495  // warnings. To avoid this we add the comparison to 0.
496  if constexpr (sizeof...(Args) > 0)
497  return ConcatArrays(
499  else
500  return ImmArray;
501  }
502 };
503 template <typename DataT, template <typename, typename> typename FlattenF>
504 struct ArrayCreator<DataT, FlattenF> {
505  static constexpr auto Create() { return std::array<DataT, 0>{}; }
506 };
507 
508 // Helper function for creating an arbitrary sized array with the same value
509 // repeating.
510 template <typename T, size_t... Is>
511 static constexpr std::array<T, sizeof...(Is)>
512 RepeatValueHelper(const T &Arg, std::index_sequence<Is...>) {
513  auto ReturnArg = [&](size_t) { return Arg; };
514  return {ReturnArg(Is)...};
515 }
516 template <size_t N, typename T>
517 static constexpr std::array<T, N> RepeatValue(const T &Arg) {
518  return RepeatValueHelper(Arg, std::make_index_sequence<N>());
519 }
520 
521 } // namespace detail
522 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
523 } // namespace sycl
sycl::_V1::detail::codeToString
static std::string codeToString(pi_int32 code)
Definition: common.hpp:184
sycl::_V1::detail::SpvFileKSId
constexpr KernelSetId SpvFileKSId
Definition: common.hpp:446
sycl::_V1::detail::InitializedVal
Definition: common.hpp:324
sycl::_V1::detail::NDLoop::iterate
static __SYCL_ALWAYS_INLINE void iterate(const LoopBoundTy< NDims > &UpperBound, FuncTy f)
Generates ND loop nest with {0,..0} .
Definition: common.hpp:391
T
sycl::_V1::detail::code_location::code_location
constexpr code_location() noexcept
Definition: common.hpp:84
sycl::_V1::detail::InitializedVal< 3, T >::get
static T< 3 > get()
Definition: common.hpp:340
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
sycl::_V1::detail::NDLoopIterateImpl::NDLoopIterateImpl
NDLoopIterateImpl(const LoopIndexTy< NDims > &LowerBound, const LoopBoundTy< NDims > &Stride, const LoopBoundTy< NDims > &UpperBound, FuncTy f, LoopIndexTy< NDims > &Index)
Definition: common.hpp:347
sycl::_V1::detail::get< 0 >
Definition: tuple.hpp:75
sycl::_V1::detail::getNextPowerOfTwoHelper
constexpr size_t getNextPowerOfTwoHelper(size_t Var, size_t Offset)
Definition: common.hpp:420
__SYCL_ALWAYS_INLINE
#define __SYCL_ALWAYS_INLINE
Definition: defines_elementary.hpp:25
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::detail::getRawSyclObjImpl
detail::add_pointer_t< typename decltype(T::impl)::element_type > getRawSyclObjImpl(const T &SyclObject)
Definition: common.hpp:310
pi.hpp
__CODELOC_FILE_NAME
#define __CODELOC_FILE_NAME
Definition: common.hpp:43
__CODELOC_LINE
#define __CODELOC_LINE
Definition: common.hpp:55
sycl::_V1::detail::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition: stl_type_traits.hpp:24
stl_type_traits.hpp
sycl::_V1::detail::ArrayCreator< DataT, FlattenF, ArgT, ArgTN... >::Create
static constexpr auto Create(const ArgT &Arg, const ArgTN &...Args)
Definition: common.hpp:492
sycl::_V1::ext::intel::experimental::esimd::line
ESIMD_NODEBUG ESIMD_INLINE std::enable_if_t< __ESIMD_DNS::is_fp_or_dword_type< T >::value &&std::is_floating_point< T >::value, sycl::ext::intel::esimd::simd< T, SZ > > line(sycl::ext::intel::esimd::simd< T, 4 > src0, sycl::ext::intel::esimd::simd< T, SZ > src1, Sat sat={})
Linear equation.
Definition: math.hpp:933
export.hpp
sycl::_V1::detail::stringifyErrorCode
const char * stringifyErrorCode(pi_int32 error)
Definition: common.cpp:57
__CODELOC_COLUMN
#define __CODELOC_COLUMN
Definition: common.hpp:61
std::get
constexpr tuple_element< I, tuple< Types... > >::type & get(sycl::detail::tuple< Types... > &Arg) noexcept
Definition: tuple.hpp:199
defines_elementary.hpp
sycl::_V1::detail::EnableIfOutputPointerT
detail::enable_if_t< std::is_pointer< DataT >::value > EnableIfOutputPointerT
Definition: common.hpp:34
sycl::_V1::detail::ArrayCreator
Definition: common.hpp:488
sycl::_V1::detail::tls_code_loc_t
Data type that manages the code_location information in TLS.
Definition: common.hpp:152
sycl::_V1::detail::code_location::functionName
constexpr const char * functionName() const noexcept
Definition: common.hpp:90
defines.hpp
sycl::_V1::detail::NDLoop
Generates an NDims-dimensional perfect loop nest.
Definition: common.hpp:385
sycl::_V1::detail::code_location::lineNumber
constexpr unsigned long lineNumber() const noexcept
Definition: common.hpp:87
sycl::_V1::detail::createSyclObjFromImpl
T createSyclObjFromImpl(decltype(T::impl) ImplObj)
Definition: common.hpp:318
sycl::_V1::detail::InitializedVal< 1, T >::get
static T< 1 > get()
Definition: common.hpp:330
sycl::_V1::detail::EnableIfOutputIteratorT
detail::enable_if_t< !std::is_pointer< DataT >::value > EnableIfOutputIteratorT
Definition: common.hpp:38
sycl::_V1::detail::RepeatValue
static constexpr std::array< T, N > RepeatValue(const T &Arg)
Definition: common.hpp:517
sycl::_V1::detail::convertToArrayOfN
static T< NewDim > convertToArrayOfN(T< OldDim > OldObj)
Definition: common.hpp:459
sycl::_V1::detail::InlineVariableHelper
Definition: common.hpp:449
sycl::_V1::detail::NDLoopIterateImpl< NDims, 0, LoopBoundTy, FuncTy, LoopIndexTy >::NDLoopIterateImpl
NDLoopIterateImpl(const LoopIndexTy< NDims > &LowerBound, const LoopBoundTy< NDims > &Stride, const LoopBoundTy< NDims > &UpperBound, FuncTy f, LoopIndexTy< NDims > &Index)
Definition: common.hpp:365
sycl::_V1::detail::code_location::current
static constexpr code_location current(const char *fileName=__CODELOC_FILE_NAME, const char *funcName=__CODELOC_FUNCTION, unsigned long lineNo=__CODELOC_LINE, unsigned long columnNo=__CODELOC_COLUMN) noexcept
Definition: common.hpp:68
sycl::_V1::detail::code_location::columnNumber
constexpr unsigned long columnNumber() const noexcept
Definition: common.hpp:88
sycl::_V1::detail::ArrayCreator< DataT, FlattenF >::Create
static constexpr auto Create()
Definition: common.hpp:505
sycl::_V1::detail::getNextPowerOfTwo
constexpr size_t getNextPowerOfTwo(size_t Var)
Definition: common.hpp:427
sycl::_V1::detail::KernelSetId
size_t KernelSetId
Definition: common.hpp:443
iostream_proxy.hpp
sycl::_V1::detail::code_location
Definition: common.hpp:66
exception.hpp
sycl::_V1::detail::code_location::code_location
constexpr code_location(const char *file, const char *func, int line, int col) noexcept
Definition: common.hpp:80
sycl::_V1::detail::code_location::fileName
constexpr const char * fileName() const noexcept
Definition: common.hpp:89
sycl::_V1::detail::NDLoopIterateImpl
Helper class for the NDLoop.
Definition: common.hpp:346
sycl::_V1::detail::InitializedVal< 2, T >::get
static T< 2 > get()
Definition: common.hpp:335
__CODELOC_FUNCTION
#define __CODELOC_FUNCTION
Definition: common.hpp:49
sycl::_V1::detail::getLinearIndex
size_t getLinearIndex(const T< Dims > &Index, const U< Dims > &Range)
Definition: common.hpp:433
sycl::_V1::detail::RepeatValueHelper
static constexpr std::array< T, sizeof...(Is)> RepeatValueHelper(const T &Arg, std::index_sequence< Is... >)
Definition: common.hpp:512
sycl::_V1::detail::NDLoop::iterate
static __SYCL_ALWAYS_INLINE void iterate(const LoopIndexTy< NDims > &LowerBound, const LoopBoundTy< NDims > &Stride, const LoopBoundTy< NDims > &UpperBound, FuncTy f)
Generates ND loop nest with LowerBound .
Definition: common.hpp:409
sycl::_V1::detail::LastKSId
constexpr KernelSetId LastKSId
Definition: common.hpp:447
sycl::_V1::detail::add_pointer_t
typename std::add_pointer< T >::type add_pointer_t
Definition: stl_type_traits.hpp:37
sycl::_V1::detail::get
Definition: tuple.hpp:59
pi_int32
int32_t pi_int32
Definition: pi.h:128
sycl::_V1::detail::getSyclObjImpl
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
Definition: common.hpp:300
sycl::_V1::detail::ConcatArrays
constexpr std::array< T, N1+N2 > ConcatArrays(const std::array< T, N1 > &A1, const std::array< T, N2 > &A2)
Definition: common.hpp:478