From 885bff72bc46854524af74a2b05a843d2ce5e8ff Mon Sep 17 00:00:00 2001 From: Maarten Arnst Date: Mon, 15 Jun 2026 14:17:41 +0200 Subject: [PATCH] many but not all clang fixes Signed-off-by: Maarten Arnst Signed-off-by: romintomasetti --- benchmarks/graph/benchmark_straight_line.cpp | 2 +- tests/exec/adaptors/test_split.cpp | 2 +- tests/graph/complex_dag/test_stdexec.cpp | 2 +- tests/graph/runtime/test_stdexec.cpp | 2 +- tests/graph/while/test_while.cpp | 2 +- tests/kokkos_ext/execution_space/test_fork_join.cpp | 2 +- tests/kokkos_ext/execution_space/test_inter_op.cpp | 8 ++++---- tests/kokkos_ext/execution_space/test_split.cpp | 2 +- tests/kokkos_ext/graph/test_inter_op.cpp | 6 +++--- tests/native/test_conditional_if.cpp | 1 + tests/native/test_conditional_while.cpp | 1 + tests/native/test_diamond.cpp | 1 + tests/native/test_memcpy_node.cpp | 1 + tests/native/test_subgraph.cpp | 5 ++++- tests/stdexec/test_check_scheduler.cpp | 8 ++++---- tests/stdexec/test_value_receiver.cpp | 2 +- 16 files changed, 27 insertions(+), 20 deletions(-) diff --git a/benchmarks/graph/benchmark_straight_line.cpp b/benchmarks/graph/benchmark_straight_line.cpp index ae0db1da..e2497d89 100644 --- a/benchmarks/graph/benchmark_straight_line.cpp +++ b/benchmarks/graph/benchmark_straight_line.cpp @@ -55,7 +55,7 @@ class StraightLineBenchmark : public benchmarks::BenchmarkBase public: //! We need to create @c Kokkos objects in the @ref SetUp, not using the constructor or in-class default member initializers. void SetUp(const ::benchmark::State&) override { - this->exec = Kokkos::Experimental::partition_space(execution_space{}, 1)[0]; + this->exec = Kokkos::Experimental::partition_space(execution_space{}, 1).at(0); this->data = view_t(Kokkos::view_alloc(*exec)); } diff --git a/tests/exec/adaptors/test_split.cpp b/tests/exec/adaptors/test_split.cpp index 430cc8da..24725099 100644 --- a/tests/exec/adaptors/test_split.cpp +++ b/tests/exec/adaptors/test_split.cpp @@ -31,7 +31,7 @@ namespace tests::stdexec::adaptors { //! @test Simple test for @c exec::split. TEST(stdexec, split) { - exec::static_thread_pool pool{2}; + exec::static_thread_pool pool{2}; // NOLINT(misc-const-correctness) ::stdexec::scheduler auto scheduler = pool.get_scheduler(); diff --git a/tests/graph/complex_dag/test_stdexec.cpp b/tests/graph/complex_dag/test_stdexec.cpp index b300d704..6a0ced7c 100644 --- a/tests/graph/complex_dag/test_stdexec.cpp +++ b/tests/graph/complex_dag/test_stdexec.cpp @@ -43,7 +43,7 @@ TEST(graph, complex_dag_stdexec) using view_t = Kokkos::View; //! Get some execution context. - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) //! Initialize the data. const view_t data(Kokkos::view_alloc("data")); diff --git a/tests/graph/runtime/test_stdexec.cpp b/tests/graph/runtime/test_stdexec.cpp index 5ceca723..d14c41db 100644 --- a/tests/graph/runtime/test_stdexec.cpp +++ b/tests/graph/runtime/test_stdexec.cpp @@ -74,7 +74,7 @@ TEST_P(GraphTest, runtime_stdexec) const auto add_C = this->GetParam().at(1); //! Get some execution context. - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) //! Initialize the data. const view_t data(Kokkos::view_alloc("data")); diff --git a/tests/graph/while/test_while.cpp b/tests/graph/while/test_while.cpp index a7893afc..78825582 100644 --- a/tests/graph/while/test_while.cpp +++ b/tests/graph/while/test_while.cpp @@ -81,7 +81,7 @@ class WhileTest : public ::testing::Test public: void SetUp() override { - this->exec = Kokkos::Experimental::partition_space(Kokkos::Cuda{}, 1)[0]; + this->exec = Kokkos::Experimental::partition_space(Kokkos::Cuda{}, 1).at(0); this->data = data_t(Kokkos::view_alloc(*exec, "data"), size); } diff --git a/tests/kokkos_ext/execution_space/test_fork_join.cpp b/tests/kokkos_ext/execution_space/test_fork_join.cpp index eacfe497..8a35aa73 100644 --- a/tests/kokkos_ext/execution_space/test_fork_join.cpp +++ b/tests/kokkos_ext/execution_space/test_fork_join.cpp @@ -51,7 +51,7 @@ class ForkJoinTest TEST_F(ForkJoinTest, diamond) { const view_s_t data(Kokkos::view_alloc("data - shared space")); - ::exec::static_thread_pool pool{4}; + ::exec::static_thread_pool pool{4}; // NOLINT(misc-const-correctness) const context_t esc{exec}; auto chain = diff --git a/tests/kokkos_ext/execution_space/test_inter_op.cpp b/tests/kokkos_ext/execution_space/test_inter_op.cpp index a5713ce0..ad4dd63e 100644 --- a/tests/kokkos_ext/execution_space/test_inter_op.cpp +++ b/tests/kokkos_ext/execution_space/test_inter_op.cpp @@ -149,7 +149,7 @@ TEST_F(InterOpTest, transition_to_static_thread_pool) { const context_t esc{exec}; - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) SHOW_EXEC_SPACE_ID(exec) @@ -182,7 +182,7 @@ TEST_F(InterOpTest, transition_from_static_thread_pool) { const context_t esc{exec}; - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) SHOW_EXEC_SPACE_ID(exec) @@ -215,7 +215,7 @@ TEST_F(InterOpTest, transition_from_static_thread_pool_and_back) { const context_t esc{exec}; - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) SHOW_EXEC_SPACE_ID(exec) @@ -251,7 +251,7 @@ TEST_F(InterOpTest, transition_to_static_thread_pool_and_back) { const context_t esc{exec}; - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) SHOW_EXEC_SPACE_ID(exec) diff --git a/tests/kokkos_ext/execution_space/test_split.cpp b/tests/kokkos_ext/execution_space/test_split.cpp index 75674a79..e0aa5bfa 100644 --- a/tests/kokkos_ext/execution_space/test_split.cpp +++ b/tests/kokkos_ext/execution_space/test_split.cpp @@ -62,7 +62,7 @@ TEST_F(SplitTest, split_and_sync_wait) { TEST_F(SplitTest, within) { const view_s_t data(Kokkos::view_alloc(exec, "data - shared space")); - ::exec::static_thread_pool pool{4}; + ::exec::static_thread_pool pool{4}; // NOLINT(misc-const-correctness) const context_t esc{exec}; ::stdexec::sender auto fork = ::stdexec::schedule(pool.get_scheduler()) | ::exec::split(); diff --git a/tests/kokkos_ext/graph/test_inter_op.cpp b/tests/kokkos_ext/graph/test_inter_op.cpp index 14dfbe17..399897f3 100644 --- a/tests/kokkos_ext/graph/test_inter_op.cpp +++ b/tests/kokkos_ext/graph/test_inter_op.cpp @@ -153,7 +153,7 @@ TEST_F(InterOpTest, transition_to_static_thread_pool) { const context_t esc{exec}; SHOW_EXEC_SPACE_ID(exec) - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) auto chain = ::stdexec::schedule(esc.get_scheduler()) | ::stdexec::then( @@ -187,7 +187,7 @@ TEST_F(InterOpTest, transition_from_static_thread_pool) { const context_t esc{exec}; SHOW_EXEC_SPACE_ID(exec) - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) auto chain = ::stdexec::schedule(pool.get_scheduler()) | ::stdexec::then( @@ -221,7 +221,7 @@ TEST_F(InterOpTest, transition_from_static_thread_pool_and_back) { const context_t esc{exec}; SHOW_EXEC_SPACE_ID(exec) - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) auto chain = ::stdexec::schedule(pool.get_scheduler()) | ::stdexec::then( diff --git a/tests/native/test_conditional_if.cpp b/tests/native/test_conditional_if.cpp index ae2244d6..f5f1ebfa 100644 --- a/tests/native/test_conditional_if.cpp +++ b/tests/native/test_conditional_if.cpp @@ -77,6 +77,7 @@ TEST_P(cuda, conditional_if) graph_exec.submit(stream); const auto mirror = data.get_host_copy(stream); + stream.fence(); ASSERT_EQ(mirror.at(0), this->GetParam() ? 1 : 0); diff --git a/tests/native/test_conditional_while.cpp b/tests/native/test_conditional_while.cpp index 57219901..97872c01 100644 --- a/tests/native/test_conditional_while.cpp +++ b/tests/native/test_conditional_while.cpp @@ -85,6 +85,7 @@ TEST(cuda, conditional_while) graph_exec.submit(stream); const auto mirror = data.get_host_copy(stream); + stream.fence(); EXPECT_EQ(mirror.at(0), 42); diff --git a/tests/native/test_diamond.cpp b/tests/native/test_diamond.cpp index 6d137d08..a798b852 100644 --- a/tests/native/test_diamond.cpp +++ b/tests/native/test_diamond.cpp @@ -55,6 +55,7 @@ TEST(cuda, diamond_graph) graph_exec.submit(stream); const auto mirror = data.get_host_copy(stream); + stream.fence(); ASSERT_THAT(mirror, ::testing::ElementsAre(4)); diff --git a/tests/native/test_memcpy_node.cpp b/tests/native/test_memcpy_node.cpp index 311eb130..996240e9 100644 --- a/tests/native/test_memcpy_node.cpp +++ b/tests/native/test_memcpy_node.cpp @@ -74,6 +74,7 @@ TEST(cuda, memcpy_node) //! Check the values in @c dst and @c src are identical (and as expected). const auto src_h = src.get_host_copy(stream); const auto dst_h = dst.get_host_copy(stream); + stream.fence(); std::vector expected(size); std::iota(expected.begin(), expected.end(), 0); diff --git a/tests/native/test_subgraph.cpp b/tests/native/test_subgraph.cpp index 9fc3017e..f013b39a 100644 --- a/tests/native/test_subgraph.cpp +++ b/tests/native/test_subgraph.cpp @@ -74,7 +74,10 @@ TEST(cuda, subgraph) graph_exec.submit(stream); //! Check results. - ASSERT_EQ(data.get_host_copy(stream), (std::vector{5, 5, 4})); + const auto mirror = data.get_host_copy(stream); + stream.fence(); + + ASSERT_EQ(mirror, (std::vector{5, 5, 4})); } } // namespace tests::cuda diff --git a/tests/stdexec/test_check_scheduler.cpp b/tests/stdexec/test_check_scheduler.cpp index b359cfe0..1e96d742 100644 --- a/tests/stdexec/test_check_scheduler.cpp +++ b/tests/stdexec/test_check_scheduler.cpp @@ -36,7 +36,7 @@ TEST(check_scheduler, default) { //! @test @c exec::static_thread_pool scheduler. TEST(check_scheduler, static_thread_pool) { - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) auto chain = ::stdexec::schedule(pool.get_scheduler()) | check_scheduler() | THEN_SHOW_ID; @@ -50,7 +50,7 @@ TEST(check_scheduler, static_thread_pool) { * See also https://github.com/NVIDIA/stdexec/issues/1736#issuecomment-3720622409. */ TEST(check_scheduler, split_when_all_no_forward) { - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) auto fork = ::stdexec::schedule(pool.get_scheduler()) | check_scheduler() | THEN_SHOW_ID | ::exec::split(); @@ -68,7 +68,7 @@ TEST(check_scheduler, split_when_all_no_forward) { * See also https://github.com/NVIDIA/stdexec/issues/1736#issuecomment-3720622409. */ TEST(check_scheduler, split_transfer_when_all_no_forward) { - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) auto fork = ::stdexec::schedule(pool.get_scheduler()) | check_scheduler() | THEN_SHOW_ID | ::exec::split(); @@ -83,7 +83,7 @@ TEST(check_scheduler, split_transfer_when_all_no_forward) { //! @test Multiple splits. TEST(check_scheduler, multiple_splits) { - ::exec::static_thread_pool pool{1}; + ::exec::static_thread_pool pool{1}; // NOLINT(misc-const-correctness) auto fork_A = ::stdexec::schedule(pool.get_scheduler()) | check_scheduler() | THEN_SHOW_ID | ::exec::split(); diff --git a/tests/stdexec/test_value_receiver.cpp b/tests/stdexec/test_value_receiver.cpp index deef90e2..cb41cfc7 100644 --- a/tests/stdexec/test_value_receiver.cpp +++ b/tests/stdexec/test_value_receiver.cpp @@ -27,7 +27,7 @@ namespace tests::stdexec { TEST(ValueReceiver, int) { ::stdexec::sender auto sndr = ::stdexec::just(int{42}) | ::stdexec::continues_on(::stdexec::inline_scheduler{}); - int placeholder = 0; + int placeholder = 0; // NOLINT(misc-const-correctness) auto opstate = ::stdexec::connect(sndr, ValueReceiver{.value = std::addressof(placeholder)});