From 43576926bd1b9c2f757d7ee21b8c741fc64a1642 Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Sat, 15 Aug 2026 18:29:14 +0200 Subject: [PATCH 1/2] Fix nvexec scheduler equality across stream priorities --- include/nvexec/multi_gpu_context.cuh | 2 +- include/nvexec/stream_context.cuh | 2 +- test/nvexec/CMakeLists.txt | 1 + test/nvexec/scheduler.cpp | 45 ++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 test/nvexec/scheduler.cpp diff --git a/include/nvexec/multi_gpu_context.cuh b/include/nvexec/multi_gpu_context.cuh index 704c83f3b..77a452245 100644 --- a/include/nvexec/multi_gpu_context.cuh +++ b/include/nvexec/multi_gpu_context.cuh @@ -38,7 +38,7 @@ namespace nv::execution auto operator==(multi_gpu_stream_scheduler const & other) const noexcept -> bool { - return ctx_.hub_ == other.ctx_.hub_; + return ctx_.hub_ == other.ctx_.hub_ && ctx_.priority_ == other.ctx_.priority_; } [[nodiscard]] diff --git a/include/nvexec/stream_context.cuh b/include/nvexec/stream_context.cuh index f5128f73f..5d5b60342 100644 --- a/include/nvexec/stream_context.cuh +++ b/include/nvexec/stream_context.cuh @@ -75,7 +75,7 @@ namespace nv::execution auto operator==(stream_scheduler const & other) const noexcept -> bool { - return ctx_.hub_ == other.ctx_.hub_; + return ctx_.hub_ == other.ctx_.hub_ && ctx_.priority_ == other.ctx_.priority_; } STDEXEC_ATTRIBUTE(nodiscard, host, device) auto schedule() const noexcept diff --git a/test/nvexec/CMakeLists.txt b/test/nvexec/CMakeLists.txt index 2d5b758f7..bad93eb0b 100644 --- a/test/nvexec/CMakeLists.txt +++ b/test/nvexec/CMakeLists.txt @@ -25,6 +25,7 @@ set(nvexec_test_sources split.cpp upon_stopped.cpp transfer.cpp + scheduler.cpp launch.cpp let_error.cpp let_stopped.cpp diff --git a/test/nvexec/scheduler.cpp b/test/nvexec/scheduler.cpp new file mode 100644 index 000000000..0665cbfef --- /dev/null +++ b/test/nvexec/scheduler.cpp @@ -0,0 +1,45 @@ +#include + +#include "nvexec/multi_gpu_context.cuh" +#include "nvexec/stream_context.cuh" + +namespace +{ + TEST_CASE("nvexec stream scheduler equality includes priority", "[cuda][stream][scheduler]") + { + nvexec::stream_context stream_ctx{}; + + auto high = stream_ctx.get_scheduler(nvexec::stream_priority::high); + auto normal = stream_ctx.get_scheduler(nvexec::stream_priority::normal); + auto low = stream_ctx.get_scheduler(nvexec::stream_priority::low); + + CHECK(high == stream_ctx.get_scheduler(nvexec::stream_priority::high)); + CHECK(normal == stream_ctx.get_scheduler(nvexec::stream_priority::normal)); + CHECK(low == stream_ctx.get_scheduler(nvexec::stream_priority::low)); + CHECK_FALSE(high == normal); + CHECK_FALSE(normal == low); + CHECK_FALSE(high == low); + + nvexec::stream_context other_stream_ctx{}; + CHECK_FALSE(high == other_stream_ctx.get_scheduler(nvexec::stream_priority::high)); + } + + TEST_CASE("nvexec multi-GPU scheduler equality includes priority", "[cuda][stream][scheduler]") + { + nvexec::multi_gpu_stream_context stream_ctx{}; + + auto high = stream_ctx.get_scheduler(nvexec::stream_priority::high); + auto normal = stream_ctx.get_scheduler(nvexec::stream_priority::normal); + auto low = stream_ctx.get_scheduler(nvexec::stream_priority::low); + + CHECK(high == stream_ctx.get_scheduler(nvexec::stream_priority::high)); + CHECK(normal == stream_ctx.get_scheduler(nvexec::stream_priority::normal)); + CHECK(low == stream_ctx.get_scheduler(nvexec::stream_priority::low)); + CHECK_FALSE(high == normal); + CHECK_FALSE(normal == low); + CHECK_FALSE(high == low); + + nvexec::multi_gpu_stream_context other_stream_ctx{}; + CHECK_FALSE(high == other_stream_ctx.get_scheduler(nvexec::stream_priority::high)); + } +} // namespace From 6cf193a59d6071fa342c77300687e43998e539df Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Sat, 15 Aug 2026 18:53:12 +0200 Subject: [PATCH 2/2] Avoid second multi-GPU context in scheduler test --- test/nvexec/scheduler.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/nvexec/scheduler.cpp b/test/nvexec/scheduler.cpp index 0665cbfef..5c6f251e0 100644 --- a/test/nvexec/scheduler.cpp +++ b/test/nvexec/scheduler.cpp @@ -38,8 +38,5 @@ namespace CHECK_FALSE(high == normal); CHECK_FALSE(normal == low); CHECK_FALSE(high == low); - - nvexec::multi_gpu_stream_context other_stream_ctx{}; - CHECK_FALSE(high == other_stream_ctx.get_scheduler(nvexec::stream_priority::high)); } } // namespace