Skip to content

Commit 3737aa1

Browse files
Avoid UNSCOPED_INFO for performance
It takes too much time in Thrust-API-heavy unit tests like cub.test.device_segmented_sort_keys.lid_0
1 parent c1b9f17 commit 3737aa1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

cub/test/insert_nested_NVTX_range_guard.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <catch2/catch_test_macros.hpp>
1010

11-
inline thread_local bool entered = false;
11+
inline thread_local const char* current_nvtx_range_name = nullptr;
1212

1313
struct NestedNVTXRangeGuard
1414
{
@@ -18,24 +18,22 @@ struct NestedNVTXRangeGuard
1818
explicit NestedNVTXRangeGuard(const char* name)
1919
: inside_cub_range(strstr(name, "cub::") == name)
2020
{
21-
UNSCOPED_INFO("Entering NVTX range " << name);
2221
if (inside_cub_range)
2322
{
24-
if (entered)
23+
if (current_nvtx_range_name)
2524
{
26-
FAIL("Nested NVTX range detected");
25+
FAIL("Nested NVTX range detected. Entered " << current_nvtx_range_name << ". Now entering " << name);
2726
}
28-
entered = true;
27+
current_nvtx_range_name = name;
2928
}
3029
}
3130

3231
~NestedNVTXRangeGuard()
3332
{
3433
if (inside_cub_range)
3534
{
36-
entered = false;
35+
current_nvtx_range_name = nullptr;
3736
}
38-
UNSCOPED_INFO("Leaving NVTX range");
3937
}
4038
};
4139

0 commit comments

Comments
 (0)