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 2a15321862c0..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 */ @@ -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..8c66e337dbf5 100644 --- a/cpp/tests/utilities_tests/context_tests.cpp +++ b/cpp/tests/utilities_tests/context_tests.cpp @@ -1,11 +1,16 @@ /* - * 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 */ #include +#include +#include +#include #include +#include +#include #include @@ -35,6 +40,29 @@ TEST_F(ContextTest, InitializeAfterTeardown) EXPECT_NO_THROW(cudf::initialize(cudf::init_flags::INIT_JIT_CACHE)); } +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(compute_column()); + EXPECT_NO_THROW(cudf::teardown()); + + cudf::initialize(cudf::init_flags::INIT_JIT_CACHE); + ASSERT_NO_THROW(compute_column()); + EXPECT_NO_THROW(cudf::teardown()); +} + TEST_F(ContextTest, TeardownWithoutInitialize) { EXPECT_NO_THROW(cudf::teardown()); } TEST_F(ContextTest, MultipleTeardownCalls)