From 750f97e5551d669e4fc852d5fe1f90c336ebc8fd Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Wed, 10 Jun 2026 23:03:31 +0200 Subject: [PATCH 1/3] Destroy RTCX cache before teardown --- cpp/src/runtime/context.cpp | 7 ++++- cpp/tests/utilities_tests/context_tests.cpp | 33 +++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/cpp/src/runtime/context.cpp b/cpp/src/runtime/context.cpp index 2a15321862c0..7b4fa45690ec 100644 --- a/cpp/src/runtime/context.cpp +++ b/cpp/src/runtime/context.cpp @@ -55,7 +55,12 @@ void context::ensure_jit_cache_initialized() }); } -context::~context() { rtcx::teardown(); } +context::~context() +{ + _jit_bundle.reset(); + _rtcx_cache.reset(); + rtcx::teardown(); +} rtcx::cache_t& context::rtcx_cache() { diff --git a/cpp/tests/utilities_tests/context_tests.cpp b/cpp/tests/utilities_tests/context_tests.cpp index 32ff707e3beb..439cca0d5430 100644 --- a/cpp/tests/utilities_tests/context_tests.cpp +++ b/cpp/tests/utilities_tests/context_tests.cpp @@ -4,8 +4,13 @@ */ #include +#include +#include +#include #include +#include +#include #include @@ -19,6 +24,23 @@ struct ContextTest : public cudf::test::BaseFixture { } }; +namespace { + +void run_jit_compute_column() +{ + auto c_0 = cudf::test::fixed_width_column_wrapper{3, 20, 1, 50}; + auto c_1 = cudf::test::fixed_width_column_wrapper{10, 7, 20, 0}; + auto table = cudf::table_view{{c_0, c_1}}; + auto col_ref_0 = cudf::ast::column_reference(0); + auto col_ref_1 = cudf::ast::column_reference(1); + auto expression = cudf::ast::operation(cudf::ast::ast_operator::ADD, col_ref_0, col_ref_1); + + auto result = cudf::compute_column_jit(table, expression); + EXPECT_EQ(result->size(), cudf::size_type{4}); +} + +} // namespace + TEST_F(ContextTest, MultipleInitializeCalls) { cudf::initialize(cudf::init_flags::INIT_JIT_CACHE); @@ -35,6 +57,17 @@ TEST_F(ContextTest, InitializeAfterTeardown) EXPECT_NO_THROW(cudf::initialize(cudf::init_flags::INIT_JIT_CACHE)); } +TEST_F(ContextTest, TeardownAfterJitCacheUse) +{ + cudf::initialize(cudf::init_flags::INIT_JIT_CACHE); + ASSERT_NO_THROW(run_jit_compute_column()); + EXPECT_NO_THROW(cudf::teardown()); + + cudf::initialize(cudf::init_flags::INIT_JIT_CACHE); + ASSERT_NO_THROW(run_jit_compute_column()); + EXPECT_NO_THROW(cudf::teardown()); +} + TEST_F(ContextTest, TeardownWithoutInitialize) { EXPECT_NO_THROW(cudf::teardown()); } TEST_F(ContextTest, MultipleTeardownCalls) From 7b8192d79498bce19e8aedb42a2b6a44acb958db Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Tue, 16 Jun 2026 21:42:36 +0200 Subject: [PATCH 2/3] Address context test review feedback --- cpp/tests/utilities_tests/context_tests.cpp | 33 +++++++++------------ 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/cpp/tests/utilities_tests/context_tests.cpp b/cpp/tests/utilities_tests/context_tests.cpp index 439cca0d5430..9ac504a65585 100644 --- a/cpp/tests/utilities_tests/context_tests.cpp +++ b/cpp/tests/utilities_tests/context_tests.cpp @@ -24,23 +24,6 @@ struct ContextTest : public cudf::test::BaseFixture { } }; -namespace { - -void run_jit_compute_column() -{ - auto c_0 = cudf::test::fixed_width_column_wrapper{3, 20, 1, 50}; - auto c_1 = cudf::test::fixed_width_column_wrapper{10, 7, 20, 0}; - auto table = cudf::table_view{{c_0, c_1}}; - auto col_ref_0 = cudf::ast::column_reference(0); - auto col_ref_1 = cudf::ast::column_reference(1); - auto expression = cudf::ast::operation(cudf::ast::ast_operator::ADD, col_ref_0, col_ref_1); - - auto result = cudf::compute_column_jit(table, expression); - EXPECT_EQ(result->size(), cudf::size_type{4}); -} - -} // namespace - TEST_F(ContextTest, MultipleInitializeCalls) { cudf::initialize(cudf::init_flags::INIT_JIT_CACHE); @@ -59,12 +42,24 @@ TEST_F(ContextTest, InitializeAfterTeardown) TEST_F(ContextTest, TeardownAfterJitCacheUse) { + auto compute_column = [] { + auto c_0 = cudf::test::fixed_width_column_wrapper{3, 20, 1, 50}; + auto c_1 = cudf::test::fixed_width_column_wrapper{10, 7, 20, 0}; + auto table = cudf::table_view{{c_0, c_1}}; + auto col_ref_0 = cudf::ast::column_reference(0); + auto col_ref_1 = cudf::ast::column_reference(1); + auto expression = cudf::ast::operation(cudf::ast::ast_operator::ADD, col_ref_0, col_ref_1); + + auto result = cudf::compute_column_jit(table, expression); + EXPECT_EQ(result->size(), cudf::size_type{4}); + }; + cudf::initialize(cudf::init_flags::INIT_JIT_CACHE); - ASSERT_NO_THROW(run_jit_compute_column()); + ASSERT_NO_THROW(compute_column()); EXPECT_NO_THROW(cudf::teardown()); cudf::initialize(cudf::init_flags::INIT_JIT_CACHE); - ASSERT_NO_THROW(run_jit_compute_column()); + ASSERT_NO_THROW(compute_column()); EXPECT_NO_THROW(cudf::teardown()); } From a96996dfed48c56f19580a4619001253bc32abc5 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Tue, 16 Jun 2026 16:51:38 -0700 Subject: [PATCH 3/3] Fix style: update copyright notices and clang-format CommentPragmas --- .clang-format | 2 +- cpp/src/runtime/context.cpp | 2 +- cpp/tests/utilities_tests/context_tests.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.clang-format b/.clang-format index 2e15249f6d47..bd8979396510 100644 --- a/.clang-format +++ b/.clang-format @@ -56,7 +56,7 @@ BreakConstructorInitializers: BeforeColon BreakInheritanceList: BeforeColon BreakStringLiterals: true ColumnLimit: 100 -CommentPragmas: '^ IWYU pragma:' +CommentPragmas: '(IWYU pragma:|SPDX-)' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true # Kept the below 2 to be the same as `IndentWidth` to keep everything uniform diff --git a/cpp/src/runtime/context.cpp b/cpp/src/runtime/context.cpp index 7b4fa45690ec..be7be0cb446c 100644 --- a/cpp/src/runtime/context.cpp +++ b/cpp/src/runtime/context.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ diff --git a/cpp/tests/utilities_tests/context_tests.cpp b/cpp/tests/utilities_tests/context_tests.cpp index 9ac504a65585..8c66e337dbf5 100644 --- a/cpp/tests/utilities_tests/context_tests.cpp +++ b/cpp/tests/utilities_tests/context_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */