libSCALE  0.2.0
A modern C++ CUDA API
Assertions

Enhanced CUDA assertions, including: More...

Macros

#define SP_GPUExcept(CONDITION, EX_TYPE, WHAT)
 Throw an exception on the CPU, and release-assert on the GPU. More...
 
#define SP_RelAssert(COND, ...)   SP_AssertImpl(COND, __VA_ARGS__, "")
 An assert that is always enabled. More...
 
#define SP_Assert(COND, ...)
 An assert that respects the assertion toggle (which defaults-on in debug mode, and off otherwise) More...
 
#define SP_DeviceUnreachable()   __builtin_unreachable()
 Macro for marking branches unreachable to guide optimisation, yielding an assert in debug builds. More...
 
#define SP_Unreachable()   __builtin_unreachable()
 Macro for marking branches unreachable to guide optimisation, yielding an assert in debug builds. More...
 

Detailed Description

Enhanced CUDA assertions, including:

Macro Definition Documentation

◆ SP_Assert

#define SP_Assert (   COND,
  ... 
)

An assert that respects the assertion toggle (which defaults-on in debug mode, and off otherwise)

◆ SP_DeviceUnreachable

#define SP_DeviceUnreachable ( )    __builtin_unreachable()

Macro for marking branches unreachable to guide optimisation, yielding an assert in debug builds.

◆ SP_GPUExcept

#define SP_GPUExcept (   CONDITION,
  EX_TYPE,
  WHAT 
)
Value:
do { \
if constexpr (OnDevice) { \
SP_RelAssert(!(CONDITION), WHAT) \
} else { \
if (CONDITION) { \
throw EX_TYPE(WHAT); \
} \
} \
while (false)

Throw an exception on the CPU, and release-assert on the GPU.

◆ SP_RelAssert

#define SP_RelAssert (   COND,
  ... 
)    SP_AssertImpl(COND, __VA_ARGS__, "")

An assert that is always enabled.

◆ SP_Unreachable

#define SP_Unreachable ( )    __builtin_unreachable()

Macro for marking branches unreachable to guide optimisation, yielding an assert in debug builds.