Skip to content
22 changes: 12 additions & 10 deletions sycl/doc/PreprocessorMacros.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@ This file describes macros that have effect on SYCL compiler and run-time.

Disables a message which warns about unsupported C++ version.

- **SYCL_DISABLE_FALLBACK_ASSERT**

Defining this macro eliminates some overhead that is associated with
submitting kernels that call `assert()`. When this macro is defined, the logic
for detecting assertion failures in kernels is disabled, so a failed assert
will not cause a message to be printed and will not cause the program to
abort. However, this macro only affects kernels that are submitted to devices
that do **not** have native support for `assert()` because devices with native
support do not impose any extra overhead. One can check to see if a device has
native support for `assert()` via `aspect::ext_oneapi_native_assert`.
- **SYCL_ENABLE_FALLBACK_ASSERT**

Defining this macro enables the fallback assert feature even on devices
without native support. Be aware that this will add some overhead that is
associated with submitting kernels that call `assert()`. When this macro is
not defined, the logic for detecting assertion failures in kernels is
disabled, so a failed assert will not cause a message to be printed and will
not cause the program to abort. Some devices have native support for
assertions. The logic for detecting assertion failures is always enabled on
these devices regardless of whether this macro is defined because that logic
does not add any extra overhead. One can check to see if a device has native
support for `assert()` via `aspect::ext_oneapi_native_assert`.

## Version macros

Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

// Helper macro to identify if fallback assert is needed
// FIXME remove __NVPTX__ condition once devicelib supports CUDA
#if !defined(SYCL_DISABLE_FALLBACK_ASSERT)
#if defined(SYCL_ENABLE_FALLBACK_ASSERT)
#define __SYCL_USE_FALLBACK_ASSERT 1
#else
#define __SYCL_USE_FALLBACK_ASSERT 0
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/check_device_code/kernel_arguments_as.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//
// Check the address space of the pointer in accessor class.
//
// CHECK: %struct.AccWrapper = type { %"class.cl::sycl::accessor.1" }
// CHECK: %"class.cl::sycl::accessor.1" = type { %"class{{.*}}AccessorImplDevice", %[[UNION:.*]] }
// CHECK: %struct.AccWrapper = type { %"class.cl::sycl::accessor[[NUMBER_SUFFIX:\.?[0-9]*]]" }
// CHECK: %"class.cl::sycl::accessor[[NUMBER_SUFFIX]]" = type { %"class{{.*}}AccessorImplDevice", %[[UNION:.*]] }
// CHECK-DISABLE: %[[UNION]] = type { i32 addrspace(1)* }
// CHECK-ENABLE: %[[UNION]] = type { i32 addrspace(5)* }
// CHECK: %struct.AccWrapper.{{[0-9]+}} = type { %"class.cl::sycl::accessor.[[NUM:[0-9]+]]" }
Expand Down
1 change: 1 addition & 0 deletions sycl/unittests/assert/assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* pipe.
*/

#define SYCL_ENABLE_FALLBACK_ASSERT 1
// Enable use of interop kernel c-tor
#define __SYCL_INTERNAL_API
#include <CL/sycl.hpp>
Expand Down