Skip to content

Commit c1b9f17

Browse files
gonidelisbernhardmgruber
authored andcommitted
Reapply Bernhard's overwritten changes
1 parent 0b46e22 commit c1b9f17

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

cub/test/catch2_test_device_for_each_in_extents_api.cu

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
******************************************************************************/
2727
#include "insert_nested_NVTX_range_guard.h"
28-
// above header needs to be included first
2928

3029
#include <cub/config.cuh>
3130

cub/test/insert_nested_NVTX_range_guard.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@
88

99
#include <catch2/catch_test_macros.hpp>
1010

11-
#if defined(__cpp_inline_variables)
1211
inline thread_local bool entered = false;
1312

1413
struct NestedNVTXRangeGuard
1514
{
16-
NestedNVTXRangeGuard(const char* name)
15+
// complain only about CUB nested NVTX ranges, not Thrust
16+
bool inside_cub_range;
17+
18+
explicit NestedNVTXRangeGuard(const char* name)
19+
: inside_cub_range(strstr(name, "cub::") == name)
1720
{
1821
UNSCOPED_INFO("Entering NVTX range " << name);
19-
// complain only about CUB nested NVTX ranges, not Thrust
20-
if (strstr(name, "cub::") == name)
22+
if (inside_cub_range)
2123
{
2224
if (entered)
2325
{
@@ -29,12 +31,14 @@ struct NestedNVTXRangeGuard
2931

3032
~NestedNVTXRangeGuard()
3133
{
32-
entered = false;
34+
if (inside_cub_range)
35+
{
36+
entered = false;
37+
}
3338
UNSCOPED_INFO("Leaving NVTX range");
3439
}
3540
};
3641

37-
# define _CCCL_BEFORE_NVTX_RANGE_SCOPE(name) \
38-
::cuda::std::optional<::NestedNVTXRangeGuard> __cub_nvtx3_reentrency_guard; \
39-
NV_IF_TARGET(NV_IS_HOST, __cub_nvtx3_reentrency_guard.emplace(name););
40-
#endif // defined(__cpp_inline_variables)
42+
#define _CCCL_BEFORE_NVTX_RANGE_SCOPE(name) \
43+
::cuda::std::optional<::NestedNVTXRangeGuard> __cub_nvtx3_reentrency_guard; \
44+
NV_IF_TARGET(NV_IS_HOST, __cub_nvtx3_reentrency_guard.emplace(name););

0 commit comments

Comments
 (0)