Skip to content

Commit 2aaae5c

Browse files
Preserve NVTX names for lvalue senders (#2204)
* Preserve NVTX names for lvalue senders * Format NVTX regression test
1 parent 758f41f commit 2aaae5c

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

include/nvexec/nvtx.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ namespace nv::execution
110110
static_cast<Self&&>(self).sndr_,
111111
static_cast<Receiver&&>(rcvr),
112112
[&](_strm::opstate_base<Receiver>& stream_provider) -> receiver_t<Receiver>
113-
{ return receiver_t<Receiver>(stream_provider, std::move(self.name_)); });
113+
{ return receiver_t<Receiver>(stream_provider, static_cast<Self&&>(self).name_); });
114114
}
115115
STDEXEC_EXPLICIT_THIS_END(connect)
116116

test/nvexec/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set(nvexec_test_sources
3232
let_value.cpp
3333
test_main.cpp
3434
then.cpp
35+
nvtx.cpp
3536
reduce.cpp
3637
repeat_n.cpp
3738
split.cpp

test/nvexec/nvtx.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <nvexec/nvtx.cuh>
2+
#include <nvexec/stream_context.cuh>
3+
#include <stdexec/execution.hpp>
4+
#include <test_common/catch2.hpp>
5+
6+
namespace ex = STDEXEC;
7+
8+
namespace
9+
{
10+
TEST_CASE("nvexec nvtx preserves names for lvalue senders", "[cuda][stream][nvtx]")
11+
{
12+
nvexec::stream_context stream_ctx{};
13+
auto snd = ex::schedule(stream_ctx.get_scheduler()) | nvexec::nvtx::push("test");
14+
15+
ex::sync_wait(snd);
16+
17+
CHECK(snd.name_ == "test");
18+
}
19+
} // namespace

0 commit comments

Comments
 (0)