DPC++ Runtime
Runtime libraries for oneAPI DPC++
common.hpp File Reference
#include <sycl/detail/defines.hpp>
#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/export.hpp>
#include <sycl/detail/pi.hpp>
#include <sycl/detail/stl_type_traits.hpp>
#include <cstdint>
#include <string>
#include <sycl/detail/iostream_proxy.hpp>
#include <sycl/exception.hpp>
Include dependency graph for common.hpp:

Go to the source code of this file.

Classes

struct  sycl::_V1::detail::code_location
 
struct  sycl::_V1::detail::InitializedVal< N, T >
 
struct  sycl::_V1::detail::InitializedVal< 1, T >
 
struct  sycl::_V1::detail::InitializedVal< 2, T >
 
struct  sycl::_V1::detail::InitializedVal< 3, T >
 
struct  sycl::_V1::detail::NDLoopIterateImpl< NDims, Dim, LoopBoundTy, FuncTy, LoopIndexTy >
 Helper class for the NDLoop. More...
 
struct  sycl::_V1::detail::NDLoopIterateImpl< NDims, 0, LoopBoundTy, FuncTy, LoopIndexTy >
 
struct  sycl::_V1::detail::NDLoop< NDims >
 Generates an NDims-dimensional perfect loop nest. More...
 
struct  sycl::_V1::detail::InlineVariableHelper< T >
 

Namespaces

 sycl
 ---— Error handling, matching OpenCL plugin semantics.
 
 sycl::_V1
 
 sycl::_V1::detail
 

Macros

#define __CODELOC_FILE_NAME   nullptr
 
#define __CODELOC_FUNCTION   nullptr
 
#define __CODELOC_LINE   0
 
#define __CODELOC_COLUMN   0
 
#define _CODELOCONLYPARAM(a)    const detail::code_location a = detail::code_location::current()
 
#define _CODELOCPARAM(a)    , const detail::code_location a = detail::code_location::current()
 
#define _CODELOCPARAMDEF(a)   , const detail::code_location a
 
#define _CODELOCARG(a)
 
#define _CODELOCFW(a)   , a
 
#define __SYCL_ASSERT(x)   assert(x)
 
#define __SYCL_PI_ERROR_REPORT
 
#define __SYCL_REPORT_PI_ERR_TO_STREAM(expr)
 
#define __SYCL_REPORT_PI_ERR_TO_EXC(expr, exc, str)
 
#define __SYCL_REPORT_PI_ERR_TO_EXC_THROW(code, exc, str)    __SYCL_REPORT_PI_ERR_TO_EXC(code, exc, str)
 
#define __SYCL_REPORT_PI_ERR_TO_EXC_BASE(code)    __SYCL_REPORT_PI_ERR_TO_EXC(code, sycl::runtime_error, nullptr)
 
#define __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC(expr, errc)
 
#define __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC(code, errc)    __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC(code, errc)
 
#define __SYCL_CHECK_OCL_CODE(X)   __SYCL_REPORT_PI_ERR_TO_EXC_BASE(X)
 
#define __SYCL_CHECK_OCL_CODE_THROW(X, EXC, STR)    __SYCL_REPORT_PI_ERR_TO_EXC_THROW(X, EXC, STR)
 
#define __SYCL_CHECK_OCL_CODE_NO_EXC(X)   __SYCL_REPORT_PI_ERR_TO_STREAM(X)
 
#define __SYCL_CHECK_CODE_THROW_VIA_ERRC(X, ERRC)    __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC(X, ERRC)
 
#define __SYCL_EBO
 

Typedefs

template<typename DataT >
using sycl::_V1::detail::EnableIfOutputPointerT = std::enable_if_t< std::is_pointer< DataT >::value >
 
template<typename DataT >
using sycl::_V1::detail::EnableIfOutputIteratorT = std::enable_if_t< !std::is_pointer< DataT >::value >
 
using sycl::_V1::detail::KernelSetId = size_t
 

Functions

const char * sycl::_V1::detail::stringifyErrorCode (pi_int32 error)
 
static std::string sycl::_V1::detail::codeToString (pi_int32 code)
 
template<class Obj >
decltype(Obj::impl) sycl::_V1::detail::getSyclObjImpl (const Obj &SyclObject)
 
template<class T >
std::add_pointer_t< typename decltype(T::impl)::element_type > sycl::_V1::detail::getRawSyclObjImpl (const T &SyclObject)
 
template<class T >
sycl::_V1::detail::createSyclObjFromImpl (decltype(T::impl) ImplObj)
 
constexpr size_t sycl::_V1::detail::getNextPowerOfTwoHelper (size_t Var, size_t Offset)
 
constexpr size_t sycl::_V1::detail::getNextPowerOfTwo (size_t Var)
 
template<int Dims, template< int > class T, template< int > class U>
size_t sycl::_V1::detail::getLinearIndex (const T< Dims > &Index, const U< Dims > &Range)
 
template<int NewDim, int DefaultValue, template< int > class T, int OldDim>
static T< NewDim > sycl::_V1::detail::convertToArrayOfN (T< OldDim > OldObj)
 

Variables

constexpr KernelSetId sycl::_V1::detail::SpvFileKSId = 0
 
constexpr KernelSetId sycl::_V1::detail::LastKSId = SpvFileKSId
 

Macro Definition Documentation

◆ __CODELOC_COLUMN

#define __CODELOC_COLUMN   0

Definition at line 61 of file common.hpp.

◆ __CODELOC_FILE_NAME

#define __CODELOC_FILE_NAME   nullptr

Definition at line 43 of file common.hpp.

◆ __CODELOC_FUNCTION

#define __CODELOC_FUNCTION   nullptr

Definition at line 49 of file common.hpp.

◆ __CODELOC_LINE

#define __CODELOC_LINE   0

Definition at line 55 of file common.hpp.

◆ __SYCL_ASSERT

#define __SYCL_ASSERT (   x)    assert(x)

Definition at line 145 of file common.hpp.

◆ __SYCL_CHECK_CODE_THROW_VIA_ERRC

#define __SYCL_CHECK_CODE_THROW_VIA_ERRC (   X,
  ERRC 
)     __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC(X, ERRC)

Definition at line 220 of file common.hpp.

◆ __SYCL_CHECK_OCL_CODE

#define __SYCL_CHECK_OCL_CODE (   X)    __SYCL_REPORT_PI_ERR_TO_EXC_BASE(X)

Definition at line 215 of file common.hpp.

◆ __SYCL_CHECK_OCL_CODE_NO_EXC

#define __SYCL_CHECK_OCL_CODE_NO_EXC (   X)    __SYCL_REPORT_PI_ERR_TO_STREAM(X)

Definition at line 218 of file common.hpp.

◆ __SYCL_CHECK_OCL_CODE_THROW

#define __SYCL_CHECK_OCL_CODE_THROW (   X,
  EXC,
  STR 
)     __SYCL_REPORT_PI_ERR_TO_EXC_THROW(X, EXC, STR)

Definition at line 216 of file common.hpp.

◆ __SYCL_EBO

#define __SYCL_EBO

Definition at line 229 of file common.hpp.

◆ __SYCL_PI_ERROR_REPORT

#define __SYCL_PI_ERROR_REPORT
Value:
"Native API failed. " /*__FILE__*/ \
/* TODO: replace __FILE__ to report only relative path*/ \
/* ":" __SYCL_STRINGIFY(__LINE__) ": " */ \
"Native API returns: "

Definition at line 148 of file common.hpp.

◆ __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC

#define __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC (   code,
  errc 
)     __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC(code, errc)

Definition at line 199 of file common.hpp.

◆ __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC

#define __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC (   expr,
  errc 
)
Value:
{ \
auto code = expr; \
if (code != PI_SUCCESS) { \
throw sycl::exception(sycl::make_error_code(errc), \
} \
}
#define __SYCL_PI_ERROR_REPORT
Definition: common.hpp:148
static std::string codeToString(pi_int32 code)
Definition: common.hpp:132
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
Definition: exception.cpp:91

Definition at line 190 of file common.hpp.

◆ __SYCL_REPORT_PI_ERR_TO_EXC

#define __SYCL_REPORT_PI_ERR_TO_EXC (   expr,
  exc,
  str 
)
Value:
{ \
auto code = expr; \
if (code != PI_SUCCESS) { \
std::string err_str = \
str ? "\n" + std::string(str) + "\n" : std::string{}; \
err_str, \
code); \
} \
}

Definition at line 170 of file common.hpp.

◆ __SYCL_REPORT_PI_ERR_TO_EXC_BASE

#define __SYCL_REPORT_PI_ERR_TO_EXC_BASE (   code)     __SYCL_REPORT_PI_ERR_TO_EXC(code, sycl::runtime_error, nullptr)

Definition at line 183 of file common.hpp.

◆ __SYCL_REPORT_PI_ERR_TO_EXC_THROW

#define __SYCL_REPORT_PI_ERR_TO_EXC_THROW (   code,
  exc,
  str 
)     __SYCL_REPORT_PI_ERR_TO_EXC(code, exc, str)

Definition at line 181 of file common.hpp.

◆ __SYCL_REPORT_PI_ERR_TO_STREAM

#define __SYCL_REPORT_PI_ERR_TO_STREAM (   expr)
Value:
{ \
auto code = expr; \
if (code != PI_SUCCESS) { \
<< std::endl; \
} \
}
__SYCL_EXTERN_STREAM_ATTRS ostream cerr
Linked to standard error (unbuffered)

Definition at line 157 of file common.hpp.

◆ _CODELOCARG

#define _CODELOCARG (   a)

Definition at line 112 of file common.hpp.

◆ _CODELOCFW

#define _CODELOCFW (   a)    , a

Definition at line 113 of file common.hpp.

◆ _CODELOCONLYPARAM

#define _CODELOCONLYPARAM (   a)     const detail::code_location a = detail::code_location::current()

Definition at line 106 of file common.hpp.

◆ _CODELOCPARAM

#define _CODELOCPARAM (   a)     , const detail::code_location a = detail::code_location::current()

Definition at line 108 of file common.hpp.

◆ _CODELOCPARAMDEF

#define _CODELOCPARAMDEF (   a)    , const detail::code_location a

Definition at line 110 of file common.hpp.