Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,13 @@ jobs:
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@main
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@codex/caller-cache-directories
if: fromJSON(needs.changed-files.outputs.changed_file_groups).cpp_build_inputs || fromJSON(needs.changed-files.outputs.changed_file_groups).cpp_test_files || fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp
with:
build_type: pull-request
script: ci/test_cpp.sh
cache-paths: .cache/libcudf
cache-key-prefix: libcudf-rtcx-v1
# https://github.com/NVIDIA/cudf/issues/23498
matrix_filter: map(select(.GPU != "gb300" and .GPU != "gh200"))
conda-python-build:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ jobs:
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@main
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@codex/caller-cache-directories
with:
build_type: ${{ inputs.build_type }}
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
script: ci/test_cpp.sh
sha: ${{ inputs.sha }}
cache-paths: .cache/libcudf
cache-key-prefix: libcudf-rtcx-v1
# https://github.com/NVIDIA/cudf/issues/23498
matrix_filter: map(select(.GPU != "gb300" and .GPU != "gh200"))
conda-cpp-benchmark-tests:
Expand Down
7 changes: 6 additions & 1 deletion ci/test_cpp_common.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail
Expand Down Expand Up @@ -33,6 +33,11 @@ RESULTS_DIR=${RAPIDS_TESTS_DIR:-"$(mktemp -d)"}
RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${RESULTS_DIR}/test-results"}/
mkdir -p "${RAPIDS_TESTS_DIR}"

# Keep JIT-compiled kernels in the workspace so CI can persist them across jobs.
JIT_CACHE_ROOT=${GITHUB_WORKSPACE:-${PWD}}
export LIBCUDF_KERNEL_CACHE_PATH="${LIBCUDF_KERNEL_CACHE_PATH:-${JIT_CACHE_ROOT}/.cache/libcudf}"
mkdir -p "${LIBCUDF_KERNEL_CACHE_PATH}"

rapids-print-env

rapids-logger "Check GPU usage"
Expand Down
119 changes: 80 additions & 39 deletions cpp/tests/ast/jit_expressions_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <cudf_test/column_utilities.hpp>
#include <cudf_test/column_wrapper.hpp>
#include <cudf_test/iterator_utilities.hpp>
#include <cudf_test/table_utilities.hpp>
#include <cudf_test/testing_main.hpp>
#include <cudf_test/type_lists.hpp>

Expand All @@ -22,6 +23,7 @@

#include <cuda/iterator>

#include <array>
#include <limits>
#include <vector>

Expand Down Expand Up @@ -586,48 +588,87 @@ constexpr cudf::ast::jit::op get_cast_op()
}
}

template <typename From, typename To>
void test_cast()
{
auto a = column_wrapper<From>{{0, 1, 2, 3, 4, 5}};
auto expected = column_wrapper<To>{{0, 1, 2, 3, 4, 5}};
auto table = cudf::table_view{{a}};
auto a_ref = cudf::ast::column_reference(0);
auto tree = cudf::ast::tree{};
auto result =
cudf::compute_column_jit(table, cudf::ast::jit::operation(tree, get_cast_op<To>(), {a_ref}));
CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), VERBOSITY);
}

template <typename From, typename To>
void test_from_decimal_cast()
{
auto a = decimal_column_wrapper<From>{{0, 1, 2, 3, 4, 5}, numeric::scale_type{0}};
auto expected = column_wrapper<To>{0, 1, 2, 3, 4, 5};
auto table = cudf::table_view{{a}};
auto a_ref = cudf::ast::column_reference(0);
auto tree = cudf::ast::tree{};
auto result =
cudf::compute_column_jit(table, cudf::ast::jit::operation(tree, get_cast_op<To>(), {a_ref}));
CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), VERBOSITY);
}

template <typename To>
void test_cast_to()
{
test_cast<uint8_t, To>();
test_cast<uint16_t, To>();
test_cast<uint32_t, To>();
test_cast<uint64_t, To>();
test_cast<int8_t, To>();
test_cast<int16_t, To>();
test_cast<int32_t, To>();
test_cast<int64_t, To>();
test_cast<float, To>();
test_cast<double, To>();
test_from_decimal_cast<numeric::decimal32, To>();
test_from_decimal_cast<numeric::decimal64, To>();
test_from_decimal_cast<numeric::decimal128, To>();
auto const values = std::array{0, 1, 2, 3, 4, 5};

auto u8 = column_wrapper<uint8_t>(values.begin(), values.end());
auto u16 = column_wrapper<uint16_t>(values.begin(), values.end());
auto u32 = column_wrapper<uint32_t>(values.begin(), values.end());
auto u64 = column_wrapper<uint64_t>(values.begin(), values.end());
auto i8 = column_wrapper<int8_t>(values.begin(), values.end());
auto i16 = column_wrapper<int16_t>(values.begin(), values.end());
auto i32 = column_wrapper<int32_t>(values.begin(), values.end());
auto i64 = column_wrapper<int64_t>(values.begin(), values.end());
auto f32 = column_wrapper<float>(values.begin(), values.end());
auto f64 = column_wrapper<double>(values.begin(), values.end());
auto d32 = decimal_column_wrapper<numeric::decimal32>(
values.begin(), values.end(), numeric::scale_type{0});
auto d64 = decimal_column_wrapper<numeric::decimal64>(
values.begin(), values.end(), numeric::scale_type{0});
auto d128 = decimal_column_wrapper<numeric::decimal128>(
values.begin(), values.end(), numeric::scale_type{0});
auto table = cudf::table_view{{u8, u16, u32, u64, i8, i16, i32, i64, f32, f64, d32, d64, d128}};

auto tree = cudf::ast::tree{};
auto const op = get_cast_op<To>();
auto refs = std::array{cudf::ast::column_reference(0),
cudf::ast::column_reference(1),
cudf::ast::column_reference(2),
cudf::ast::column_reference(3),
cudf::ast::column_reference(4),
cudf::ast::column_reference(5),
cudf::ast::column_reference(6),
cudf::ast::column_reference(7),
cudf::ast::column_reference(8),
cudf::ast::column_reference(9),
cudf::ast::column_reference(10),
cudf::ast::column_reference(11),
cudf::ast::column_reference(12)};
auto& cast_u8 = cudf::ast::jit::operation(tree, op, {refs[0]});
auto& cast_u16 = cudf::ast::jit::operation(tree, op, {refs[1]});
auto& cast_u32 = cudf::ast::jit::operation(tree, op, {refs[2]});
auto& cast_u64 = cudf::ast::jit::operation(tree, op, {refs[3]});
auto& cast_i8 = cudf::ast::jit::operation(tree, op, {refs[4]});
auto& cast_i16 = cudf::ast::jit::operation(tree, op, {refs[5]});
auto& cast_i32 = cudf::ast::jit::operation(tree, op, {refs[6]});
auto& cast_i64 = cudf::ast::jit::operation(tree, op, {refs[7]});
auto& cast_f32 = cudf::ast::jit::operation(tree, op, {refs[8]});
auto& cast_f64 = cudf::ast::jit::operation(tree, op, {refs[9]});
auto& cast_d32 = cudf::ast::jit::operation(tree, op, {refs[10]});
auto& cast_d64 = cudf::ast::jit::operation(tree, op, {refs[11]});
auto& cast_d128 = cudf::ast::jit::operation(tree, op, {refs[12]});
auto expressions = std::array<std::reference_wrapper<cudf::ast::expression const>, 13>{cast_u8,
cast_u16,
cast_u32,
cast_u64,
cast_i8,
cast_i16,
cast_i32,
cast_i64,
cast_f32,
cast_f64,
cast_d32,
cast_d64,
cast_d128};
auto result = cudf::compute_table_jit(table, expressions);

auto expected = column_wrapper<To>(values.begin(), values.end());
auto expected_table = cudf::table_view{{expected,
expected,
expected,
expected,
expected,
expected,
expected,
expected,
expected,
expected,
expected,
expected,
expected}};
CUDF_TEST_EXPECT_TABLES_EQUAL(expected_table, result->view());
}

TEST_F(JITExpressionTest, Cast)
Expand Down
29 changes: 19 additions & 10 deletions cpp/tests/io/comp/comp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include <src/io/comp/nvcomp_adapter.hpp>

#include <algorithm>
#include <array>
#include <vector>

using cudf::device_span;
Expand Down Expand Up @@ -420,16 +422,23 @@ void roundtrip_test(cudf::io::compression_type compression)
// Keep adding to the test data
expected.insert(expected.end(), num_string.begin(), num_string.end());
}
if (cudf::io::detail::compress_max_allowed_chunk_size(compression)
.value_or(std::numeric_limits<size_t>::max()) < expected.size()) {
// Skip if the data is too large for the compressor
return;
}
}

// Exercise representative small, medium, and large inputs. The largest input preserves the
// previous test's maximum coverage without repeating the same round trip at every size in
// between.
auto const test_sizes = std::array{size_t{1 << 10}, size_t{1 << 20}, expected.size()};
auto const max_input_size = cudf::io::detail::compress_max_allowed_chunk_size(compression)
.value_or(std::numeric_limits<size_t>::max());
for (auto const test_size : test_sizes) {
if (test_size > max_input_size) { continue; }

auto const test_input = cudf::host_span<uint8_t const>{expected.data(), test_size};

auto d_comp = rmm::device_uvector<uint8_t>(
cudf::io::detail::max_compressed_size(compression, expected.size()), stream, mr);
cudf::io::detail::max_compressed_size(compression, test_input.size()), stream, mr);
{
auto const d_orig = cudf::detail::make_device_uvector_async(expected, stream, mr);
auto const d_orig = cudf::detail::make_device_uvector_async(test_input, stream, mr);
auto hd_srcs = cudf::detail::hostdevice_vector<device_span<uint8_t const>>(1, stream);
hd_srcs[0] = d_orig;
hd_srcs.host_to_device_async(stream);
Expand All @@ -448,7 +457,7 @@ void roundtrip_test(cudf::io::compression_type compression)
d_comp.resize(hd_stats[0].bytes_written, stream);
}

auto d_got = rmm::device_uvector<uint8_t>(expected.size(), stream);
auto d_got = rmm::device_uvector<uint8_t>(test_input.size(), stream);
{
auto hd_srcs = cudf::detail::hostdevice_vector<device_span<uint8_t const>>(1, stream);
hd_srcs[0] = d_comp;
Expand All @@ -463,14 +472,14 @@ void roundtrip_test(cudf::io::compression_type compression)
hd_stats.host_to_device_async(stream);

cudf::io::detail::decompress(
compression, hd_srcs, hd_dsts, hd_stats, expected.size(), expected.size(), stream);
compression, hd_srcs, hd_dsts, hd_stats, test_input.size(), test_input.size(), stream);
hd_stats.device_to_host(stream);
ASSERT_EQ(hd_stats[0].status, codec_status::SUCCESS);
}

auto const got = cudf::detail::make_std_vector(d_got, stream);

EXPECT_EQ(expected, got);
EXPECT_TRUE(std::equal(test_input.begin(), test_input.end(), got.begin(), got.end()));
}
}

Expand Down
4 changes: 3 additions & 1 deletion cpp/tests/io/cudftable_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,9 @@ TEST_F(CudftableTest, LongStringColumns)

TEST_F(CudftableTest, ManyColumns)
{
constexpr int num_cols = 12'345;
// Exercise large packed metadata without creating enough tiny device allocations to
// dominate the test when it runs concurrently with other C++ test binaries.
constexpr int num_cols = 1'234;
std::vector<cudf::column_view> columns;
for (int i = 0; i < num_cols; ++i) {
cudf::test::fixed_width_column_wrapper<int32_t> col({i % 10, (i + 1) % 10, (i + 2) % 10});
Expand Down
32 changes: 22 additions & 10 deletions cpp/tests/io/orc_chunked_reader_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,8 @@ void input_limit_test_read(int test_location,
cudf::table_view const& input,
output_limit output_limit_bytes,
input_limit input_limit_bytes,
int const* expected_chunk_counts)
int const* expected_chunk_counts,
bool require_multiple_chunks = false)
{
CUDF_EXPECTS(test_files.size() == input_limit_expected_file_count,
"Unexpected count of test filenames.");
Expand All @@ -1142,6 +1143,7 @@ void input_limit_test_read(int test_location,
// EXPECT_EQ(expected_chunk_counts[idx], num_chunks);
// TODO: equal
CUDF_TEST_EXPECT_TABLES_EQUIVALENT(*result, input);
if (require_multiple_chunks) { EXPECT_GT(num_chunks, 1); }
}
}

Expand Down Expand Up @@ -1242,7 +1244,7 @@ TEST_F(OrcChunkedReaderInputLimitTest, ListType)
// this test runs over 3 hours when racecheck is used
if (getenv("LIBCUDF_RACECHECK_ENABLED")) { GTEST_SKIP(); }

int constexpr num_rows = 50'000'000;
int constexpr num_rows = 25'000'000;
int constexpr list_size = 4;

auto const stream = cudf::get_default_stream();
Expand Down Expand Up @@ -1274,13 +1276,18 @@ TEST_F(OrcChunkedReaderInputLimitTest, ListType)

// Although we set `stripe_size_rows` to be very large, the writer only write
// 250k rows (top level) per stripe due to having nested type.
// Thus, we have 200 stripes in total.
// Thus, we have 100 stripes in total.
input_limit_test_write(test_files, input, cudf::io::default_stripe_size_rows);

{
int constexpr expected[] = {3, 40, 3};
input_limit_test_read(
__LINE__, test_files, input, output_limit{0UL}, input_limit{5 * 1024 * 1024UL}, expected);
input_limit_test_read(__LINE__,
test_files,
input,
output_limit{0UL},
input_limit{5 * 1024 * 1024UL},
expected,
true);
}

{
Expand All @@ -1299,7 +1306,7 @@ TEST_F(OrcChunkedReaderInputLimitTest, MixedColumnsHavingList)
// this test runs over 3 hours when racecheck is used
if (getenv("LIBCUDF_RACECHECK_ENABLED")) { GTEST_SKIP(); }

int constexpr num_rows = 50'000'000;
int constexpr num_rows = 25'000'000;
int constexpr list_size = 4;
int constexpr str_size = 3;

Expand Down Expand Up @@ -1360,13 +1367,18 @@ TEST_F(OrcChunkedReaderInputLimitTest, MixedColumnsHavingList)

// Although we set `stripe_size_rows` to be very large, the writer only write
// 250k rows (top level) per stripe due to having nested type.
// Thus, we have 200 stripes in total.
// Thus, we have 100 stripes in total.
input_limit_test_write(test_files, input, cudf::io::default_stripe_size_rows);

{
int constexpr expected[] = {13, 8, 6};
input_limit_test_read(
__LINE__, test_files, input, output_limit{0UL}, input_limit{128 * 1024 * 1024UL}, expected);
input_limit_test_read(__LINE__,
test_files,
input,
output_limit{0UL},
input_limit{128 * 1024 * 1024UL},
expected,
true);
}

{
Expand Down Expand Up @@ -1461,7 +1473,7 @@ TEST_F(OrcChunkedReaderInputLimitTest, SizeTypeRowsOverflow)

int64_t constexpr num_rows = 500'000'000l;
int constexpr rows_per_stripe = 1'000'000;
int constexpr num_reps = 10;
int constexpr num_reps = 5;
int64_t constexpr total_rows = num_rows * num_reps;
static_assert(total_rows > std::numeric_limits<cudf::size_type>::max());

Expand Down
Loading
Loading