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
 
class  sycl::_V1::detail::tls_code_loc_t
 Data type that manages the code_location information in TLS. More...
 
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 >
 
struct  sycl::_V1::detail::ArrayCreator< DataT, FlattenF, ArgTN >
 
struct  sycl::_V1::detail::ArrayCreator< DataT, FlattenF, ArgT, ArgTN... >
 
struct  sycl::_V1::detail::ArrayCreator< DataT, FlattenF >
 

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 = detail::enable_if_t< std::is_pointer< DataT >::value >
 
template<typename DataT >
using sycl::_V1::detail::EnableIfOutputIteratorT = detail::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 >
detail::add_pointer_t< typename decltype(T::impl)::element_type > sycl::_V1::detail::getRawSyclObjImpl (const T &SyclObject)
 
template<class T >
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)
 
template<typename T , std::size_t... Is1, std::size_t... Is2>
constexpr std::array< T, sizeof...(Is1)+sizeof...(Is2)> sycl::_V1::detail::ConcatArrays (const std::array< T, sizeof...(Is1)> &A1, const std::array< T, sizeof...(Is2)> &A2, std::index_sequence< Is1... >, std::index_sequence< Is2... >)
 
template<typename T , std::size_t N1, std::size_t N2>
constexpr std::array< T, N1+N2 > sycl::_V1::detail::ConcatArrays (const std::array< T, N1 > &A1, const std::array< T, N2 > &A2)
 
template<typename T , size_t... Is>
static constexpr std::array< T, sizeof...(Is)> sycl::_V1::detail::RepeatValueHelper (const T &Arg, std::index_sequence< Is... >)
 
template<size_t N, typename T >
static constexpr std::array< T, N > sycl::_V1::detail::RepeatValue (const T &Arg)
 

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 197 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 272 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 267 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 270 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 268 of file common.hpp.

◆ __SYCL_EBO

#define __SYCL_EBO

Definition at line 281 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 200 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 251 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), \
} \
}

Definition at line 242 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 222 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 235 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 233 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; \
} \
}

Definition at line 209 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.

sycl::_V1::detail::codeToString
static std::string codeToString(pi_int32 code)
Definition: common.hpp:184
sycl::_V1::make_error_code
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
Definition: exception.cpp:92
std::cerr
__SYCL_EXTERN_STREAM_ATTRS ostream cerr
Linked to standard error (unbuffered)
sycl::_V1::errc
errc
Definition: exception.hpp:28
__SYCL_PI_ERROR_REPORT
#define __SYCL_PI_ERROR_REPORT
Definition: common.hpp:200