Skip to content

Commit 84d6224

Browse files
committed
[SYCL] Declare __devicelib_assert_read only when fallback assert is enabled
Try to reland PR: intel#5698 Author: Sergei Kanaev, s-kanaev
1 parent f70ad5b commit 84d6224

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

sycl/include/sycl/detail/assert_happened.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <cstdint> // for uint64_t, int32_t
1212

13-
#ifdef __SYCL_DEVICE_ONLY__
13+
#if defined(__SYCL_DEVICE_ONLY__) && __SYCL_USE_FALLBACK_ASSERT
1414
// Reads Flag of AssertHappened on device
1515
__DPCPP_SYCL_EXTERNAL __attribute__((weak)) extern "C" void
1616
__devicelib_assert_read(void *);

sycl/include/sycl/detail/defines_elementary.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@
8181
static_assert(__cplusplus >= 201703L,
8282
"DPCPP does not support C++ version earlier than C++17.");
8383

84+
// Helper macro to identify if fallback assert is needed
85+
#if defined(SYCL_FALLBACK_ASSERT)
86+
#define __SYCL_USE_FALLBACK_ASSERT SYCL_FALLBACK_ASSERT
87+
#else
88+
#define __SYCL_USE_FALLBACK_ASSERT 0
89+
#endif
90+
8491
#if defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__)
8592
// SYCL library is designed such a way that STL objects cross DLL boundary,
8693
// which is guaranteed to work properly only when the application uses the same

sycl/include/sycl/queue.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@
6565
#define _KERNELFUNCPARAM(a) const KernelType &a
6666
#endif
6767

68-
// Helper macro to identify if fallback assert is needed
69-
// FIXME remove __NVPTX__ condition once devicelib supports CUDA
70-
#if defined(SYCL_FALLBACK_ASSERT)
71-
#define __SYCL_USE_FALLBACK_ASSERT SYCL_FALLBACK_ASSERT
72-
#else
73-
#define __SYCL_USE_FALLBACK_ASSERT 0
74-
#endif
75-
7668
namespace sycl {
7769
inline namespace _V1 {
7870

@@ -3011,4 +3003,3 @@ event submitAssertCapture(queue &Self, event &Event, queue *SecondaryQueue,
30113003
} // namespace sycl
30123004
#endif // __SYCL_USE_FALLBACK_ASSERT
30133005

3014-
#undef __SYCL_USE_FALLBACK_ASSERT

0 commit comments

Comments
 (0)