DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
common.hpp File Reference
#include <CL/sycl/detail/cl.h>
#include <CL/sycl/detail/defines.hpp>
#include <CL/sycl/detail/defines_elementary.hpp>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/detail/stl_type_traits.hpp>
#include <cstdint>
#include <string>
#include <iostream>
#include <CL/sycl/exception.hpp>
Include dependency graph for common.hpp:

Go to the source code of this file.

Classes

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

Namespaces

 cl
 We provide new interfaces for matrix muliply in this patch:
 
 cl::sycl
 
 cl::sycl::detail
 

Macros

#define __CODELOC_FILE_NAME   nullptr
 
#define __CODELOC_FUNCTION   nullptr
 
#define __CODELOC_LINE   0
 
#define __CODELOC_COLUMN   0
 
#define __SYCL_ASSERT(x)   assert(x)
 
#define __SYCL_OCL_ERROR_REPORT
 
#define __SYCL_REPORT_OCL_ERR_TO_STREAM(expr)
 
#define __SYCL_REPORT_OCL_ERR_TO_EXC(expr, exc)
 
#define __SYCL_REPORT_OCL_ERR_TO_EXC_THROW(code, exc)   __SYCL_REPORT_OCL_ERR_TO_EXC(code, exc)
 
#define __SYCL_REPORT_OCL_ERR_TO_EXC_BASE(code)   __SYCL_REPORT_OCL_ERR_TO_EXC(code, cl::sycl::runtime_error)
 
#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_OCL_ERR_TO_EXC_BASE(X)
 
#define __SYCL_CHECK_OCL_CODE_THROW(X, EXC)   __SYCL_REPORT_OCL_ERR_TO_EXC_THROW(X, EXC)
 
#define __SYCL_CHECK_OCL_CODE_NO_EXC(X)   __SYCL_REPORT_OCL_ERR_TO_STREAM(X)
 
#define __SYCL_CHECK_CODE_THROW_VIA_ERRC(X, ERRC)   __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC(X, ERRC)
 

Typedefs

using cl::sycl::detail::KernelSetId = size_t
 

Functions

const charcl::sycl::detail::stringifyErrorCode (cl_int error)
 
static std::string cl::sycl::detail::codeToString (cl_int code)
 
template<class Obj >
decltype(Obj::impl) cl::sycl::detail::getSyclObjImpl (const Obj &SyclObject)
 
template<class T >
detail::add_pointer_t< typename decltype(T::impl)::element_type > cl::sycl::detail::getRawSyclObjImpl (const T &SyclObject)
 
template<class T >
T cl::sycl::detail::createSyclObjFromImpl (decltype(T::impl) ImplObj)
 
constexpr size_t cl::sycl::detail::getNextPowerOfTwoHelper (size_t Var, size_t Offset)
 
constexpr size_t cl::sycl::detail::getNextPowerOfTwo (size_t Var)
 
template<int Dims, template< int > class T, template< int > class U>
size_t cl::sycl::detail::getLinearIndex (const T< Dims > &Index, const U< Dims > &Range)
 

Variables

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

Macro Definition Documentation

◆ __CODELOC_COLUMN

#define __CODELOC_COLUMN   0

Definition at line 49 of file common.hpp.

◆ __CODELOC_FILE_NAME

#define __CODELOC_FILE_NAME   nullptr

Definition at line 31 of file common.hpp.

◆ __CODELOC_FUNCTION

#define __CODELOC_FUNCTION   nullptr

Definition at line 37 of file common.hpp.

◆ __CODELOC_LINE

#define __CODELOC_LINE   0

Definition at line 43 of file common.hpp.

◆ __SYCL_ASSERT

#define __SYCL_ASSERT (   x)    assert(x)

Definition at line 109 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 178 of file common.hpp.

◆ __SYCL_CHECK_OCL_CODE

#define __SYCL_CHECK_OCL_CODE (   X)    __SYCL_REPORT_OCL_ERR_TO_EXC_BASE(X)

Definition at line 173 of file common.hpp.

◆ __SYCL_CHECK_OCL_CODE_NO_EXC

#define __SYCL_CHECK_OCL_CODE_NO_EXC (   X)    __SYCL_REPORT_OCL_ERR_TO_STREAM(X)

Definition at line 176 of file common.hpp.

◆ __SYCL_CHECK_OCL_CODE_THROW

#define __SYCL_CHECK_OCL_CODE_THROW (   X,
  EXC 
)    __SYCL_REPORT_OCL_ERR_TO_EXC_THROW(X, EXC)

Definition at line 174 of file common.hpp.

◆ __SYCL_OCL_ERROR_REPORT

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

Definition at line 112 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 161 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 != CL_SUCCESS) { \
throw sycl::exception(sycl::make_error_code(errc), \
} \
}

Definition at line 152 of file common.hpp.

◆ __SYCL_REPORT_OCL_ERR_TO_EXC

#define __SYCL_REPORT_OCL_ERR_TO_EXC (   expr,
  exc 
)
Value:
{ \
auto code = expr; \
if (code != CL_SUCCESS) { \
code); \
} \
}

Definition at line 134 of file common.hpp.

◆ __SYCL_REPORT_OCL_ERR_TO_EXC_BASE

#define __SYCL_REPORT_OCL_ERR_TO_EXC_BASE (   code)    __SYCL_REPORT_OCL_ERR_TO_EXC(code, cl::sycl::runtime_error)

Definition at line 145 of file common.hpp.

◆ __SYCL_REPORT_OCL_ERR_TO_EXC_THROW

#define __SYCL_REPORT_OCL_ERR_TO_EXC_THROW (   code,
  exc 
)    __SYCL_REPORT_OCL_ERR_TO_EXC(code, exc)

Definition at line 143 of file common.hpp.

◆ __SYCL_REPORT_OCL_ERR_TO_STREAM

#define __SYCL_REPORT_OCL_ERR_TO_STREAM (   expr)
Value:
{ \
auto code = expr; \
if (code != CL_SUCCESS) { \
std::cerr << __SYCL_OCL_ERROR_REPORT \
<< cl::sycl::detail::codeToString(code) << std::endl; \
} \
}

Definition at line 121 of file common.hpp.

cl::sycl::errc
errc
Definition: exception.hpp:27
cl::sycl::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:121
cl::sycl::detail::codeToString
static std::string codeToString(cl_int code)
Definition: common.hpp:96
__SYCL_OCL_ERROR_REPORT
#define __SYCL_OCL_ERROR_REPORT
Definition: common.hpp:112