Skip to content

Commit c3e6cc2

Browse files
author
sergei
authored
[SYCL] Disable fallback assert by default (#4694)
Due excessive amount of issues submitted against fallback assert implementation the fallback assert is now disabled by default until fixed.
1 parent 03f3010 commit c3e6cc2

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

sycl/doc/PreprocessorMacros.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,19 @@ This file describes macros that have effect on SYCL compiler and run-time.
3838

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

41-
- **SYCL_DISABLE_FALLBACK_ASSERT**
42-
43-
Defining this macro eliminates some overhead that is associated with
44-
submitting kernels that call `assert()`. When this macro is defined, the logic
45-
for detecting assertion failures in kernels is disabled, so a failed assert
46-
will not cause a message to be printed and will not cause the program to
47-
abort. However, this macro only affects kernels that are submitted to devices
48-
that do **not** have native support for `assert()` because devices with native
49-
support do not impose any extra overhead. One can check to see if a device has
50-
native support for `assert()` via `aspect::ext_oneapi_native_assert`.
41+
- **SYCL_FALLBACK_ASSERT**
42+
43+
Defining as non-zero enables the fallback assert feature even on devices
44+
without native support. Be aware that this will add some overhead that is
45+
associated with submitting kernels that call `assert()`. When this macro is
46+
defined as 0 or is not defined, the logic for detecting assertion failures in kernels is
47+
disabled, so a failed assert will not cause a message to be printed and will
48+
not cause the program to abort. Some devices have native support for
49+
assertions. The logic for detecting assertion failures is always enabled on
50+
these devices regardless of whether this macro is defined because that logic
51+
does not add any extra overhead. One can check to see if a device has native
52+
support for `assert()` via `aspect::ext_oneapi_native_assert`.
53+
This macro is undefined by default.
5154

5255
- **SYCL2020_CONFORMANT_APIS**
5356
This macro is used to comply with the SYCL 2020 specification, as some of the current

sycl/include/CL/sycl/queue.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767

6868
// Helper macro to identify if fallback assert is needed
6969
// FIXME remove __NVPTX__ condition once devicelib supports CUDA
70-
#if !defined(SYCL_DISABLE_FALLBACK_ASSERT)
71-
#define __SYCL_USE_FALLBACK_ASSERT 1
70+
#if defined(SYCL_FALLBACK_ASSERT)
71+
#define __SYCL_USE_FALLBACK_ASSERT SYCL_FALLBACK_ASSERT
7272
#else
7373
#define __SYCL_USE_FALLBACK_ASSERT 0
7474
#endif

sycl/test/check_device_code/kernel_arguments_as.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
//
66
// Check the address space of the pointer in accessor class.
77
//
8-
// CHECK: %struct.AccWrapper = type { %"class.cl::sycl::accessor.1" }
9-
// CHECK: %"class.cl::sycl::accessor.1" = type { %"class{{.*}}AccessorImplDevice", %[[UNION:.*]] }
8+
// CHECK: %struct.AccWrapper = type { %"class.cl::sycl::accessor[[NUMBER_SUFFIX:\.?[0-9]*]]" }
9+
// CHECK: %"class.cl::sycl::accessor[[NUMBER_SUFFIX]]" = type { %"class{{.*}}AccessorImplDevice", %[[UNION:.*]] }
1010
// CHECK-DISABLE: %[[UNION]] = type { i32 addrspace(1)* }
1111
// CHECK-ENABLE: %[[UNION]] = type { i32 addrspace(5)* }
1212
// CHECK: %struct.AccWrapper.{{[0-9]+}} = type { %"class.cl::sycl::accessor.[[NUM:[0-9]+]]" }

sycl/unittests/assert/assert.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* pipe.
1919
*/
2020

21+
#define SYCL_FALLBACK_ASSERT 1
2122
// Enable use of interop kernel c-tor
2223
#define __SYCL_INTERNAL_API
2324
#include <CL/sycl.hpp>

0 commit comments

Comments
 (0)