diff --git a/cpp/examples/parquet_inspect/parquet_inspect_utils.cpp b/cpp/examples/parquet_inspect/parquet_inspect_utils.cpp index e8c846aaca02..0697b4929ceb 100644 --- a/cpp/examples/parquet_inspect/parquet_inspect_utils.cpp +++ b/cpp/examples/parquet_inspect/parquet_inspect_utils.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 */ @@ -121,6 +121,7 @@ auto make_index_column(cudf::size_type num_rows, rmm::cuda_stream_view stream) std::vector data(num_rows); std::iota(data.begin(), data.end(), 0); auto buffer = rmm::device_buffer(data.data(), num_rows * sizeof(int64_t), stream); + stream.synchronize(); return std::make_unique(cudf::data_type{cudf::type_to_id()}, num_rows, std::move(buffer), @@ -141,6 +142,7 @@ template auto make_column(cudf::host_span host_data, rmm::cuda_stream_view stream) { auto device_buffer = rmm::device_buffer(host_data.data(), host_data.size() * sizeof(T), stream); + stream.synchronize(); return std::make_unique(cudf::data_type{cudf::type_to_id()}, host_data.size(), std::move(device_buffer), @@ -174,6 +176,7 @@ auto make_page_data_list_column(cudf::host_span data, auto page_data_buffer = rmm::device_buffer(data.data(), num_pages_this_column * sizeof(int64_t), stream); + stream.synchronize(); auto page_data_column = std::make_unique(cudf::data_type{cudf::type_to_id()}, @@ -285,6 +288,7 @@ void write_rowgroup_metadata(cudf::io::parquet::FileMetaData const& metadata, auto byte_offsets_buffer = rmm::device_buffer(row_group_byte_offsets.data(), num_row_groups * sizeof(int64_t), stream); + stream.synchronize(); columns.emplace_back(std::make_unique(cudf::data_type{cudf::type_to_id()}, num_row_groups, std::move(row_offsets_buffer), diff --git a/cpp/include/cudf/scalar/scalar.hpp b/cpp/include/cudf/scalar/scalar.hpp index b12212c7039f..c822c6e934de 100644 --- a/cpp/include/cudf/scalar/scalar.hpp +++ b/cpp/include/cudf/scalar/scalar.hpp @@ -190,7 +190,7 @@ class fixed_width_scalar : public scalar { [[nodiscard]] T const* data() const; protected: - rmm::device_scalar _data; ///< device memory containing the value + cudf::detail::device_scalar _data; ///< device memory containing the value /** * @brief Construct a new fixed width scalar object. @@ -402,7 +402,7 @@ class fixed_point_scalar : public scalar { [[nodiscard]] rep_type const* data() const; protected: - rmm::device_scalar _data; ///< device memory containing the value + cudf::detail::device_scalar _data; ///< device memory containing the value }; /** diff --git a/cpp/libcudf_streaming/tests/streaming/test_channel_metadata.cpp b/cpp/libcudf_streaming/tests/streaming/test_channel_metadata.cpp index 881cfd488b6b..ef2c88f94037 100644 --- a/cpp/libcudf_streaming/tests/streaming/test_channel_metadata.cpp +++ b/cpp/libcudf_streaming/tests/streaming/test_channel_metadata.cpp @@ -167,6 +167,7 @@ class StreamingChannelMetadataGPU : public ::testing::Test { std::shared_ptr make_chunk(std::vector vals) { rmm::device_buffer buf(vals.data(), vals.size() * sizeof(int32_t), stream); + stream.synchronize(); auto col = std::make_unique(cudf::data_type{cudf::type_id::INT32}, static_cast(vals.size()), std::move(buf), diff --git a/cpp/src/copying/concatenate.cu b/cpp/src/copying/concatenate.cu index 52721b4f787b..4aa55cbcf6a0 100644 --- a/cpp/src/copying/concatenate.cu +++ b/cpp/src/copying/concatenate.cu @@ -89,6 +89,7 @@ auto create_device_views(host_span views, cuda::stream_ref st auto d_offsets = make_device_uvector_async(offsets, stream, cudf::get_current_device_resource_ref()); auto const output_size = offsets.back(); + stream.sync(); return std::make_tuple( std::move(device_view_owners), std::move(d_views), std::move(d_offsets), output_size); diff --git a/cpp/src/copying/contiguous_split.cu b/cpp/src/copying/contiguous_split.cu index 27c71b628b7c..0e74026f3da6 100644 --- a/cpp/src/copying/contiguous_split.cu +++ b/cpp/src/copying/contiguous_split.cu @@ -1657,6 +1657,7 @@ std::unique_ptr chunk_iteration_state::create( d_batched_dst_buf_info[i].dst_offset -= *prior_iteration_size; }); } + stream.sync(); return std::make_unique(std::move(d_batched_dst_buf_info), std::move(d_batch_offsets), std::move(num_batches_per_iteration), diff --git a/cpp/src/groupby/sort/sort_helper.cu b/cpp/src/groupby/sort/sort_helper.cu index e664702dc6d7..7385c9762488 100644 --- a/cpp/src/groupby/sort/sort_helper.cu +++ b/cpp/src/groupby/sort/sort_helper.cu @@ -136,6 +136,7 @@ sort_groupby_helper::index_vector const& sort_groupby_helper::group_offsets(cuda group_offsets->set_element_async(num_groups, size, stream); group_offsets->resize(num_groups + 1, stream); + stream.sync(); _group_offsets = std::move(group_offsets); return *_group_offsets; diff --git a/cpp/src/groupby/streaming_groupby/common.cuh b/cpp/src/groupby/streaming_groupby/common.cuh index 259a655e86ac..973dddde2c91 100644 --- a/cpp/src/groupby/streaming_groupby/common.cuh +++ b/cpp/src/groupby/streaming_groupby/common.cuh @@ -239,7 +239,7 @@ auto build_cross_comparators( h_eqs.push_back(adapter.comparator); } - return cudf::detail::make_device_uvector_async(h_eqs, stream, temp_mr); + return cudf::detail::make_device_uvector(h_eqs, stream, temp_mr); } /// The impl struct for streaming_groupby. Defined in impl.cu. diff --git a/cpp/src/interop/from_arrow_device.cu b/cpp/src/interop/from_arrow_device.cu index aed25a2c5496..9e924b616ffb 100644 --- a/cpp/src/interop/from_arrow_device.cu +++ b/cpp/src/interop/from_arrow_device.cu @@ -197,6 +197,7 @@ dispatch_tuple_t dispatch_from_arrow_device::operator()( auto out_col = cudf::strings::detail::make_strings_column(d_indices.begin(), d_indices.end(), stream, mr); owned.emplace_back(std::move(out_col)); + stream.synchronize(); return std::make_tuple(owned.front()->view(), std::move(owned)); } diff --git a/cpp/src/interop/from_arrow_host.cu b/cpp/src/interop/from_arrow_host.cu index 8f6cdf4483e2..845aa015f15e 100644 --- a/cpp/src/interop/from_arrow_host.cu +++ b/cpp/src/interop/from_arrow_host.cu @@ -445,6 +445,7 @@ std::tuple, int64_t, int64_t> get_offsets_column( offsets_array.offset = 0; // already accounted for by the above transform auto result = dispatch_copy_from_arrow_host{stream, mr}.template operator()( schema, &offsets_array, data_type(type_id::INT32), true); + stream.synchronize(); return std::tuple{std::move(result), offset, length}; } @@ -489,6 +490,7 @@ std::unique_ptr from_arrow_host(ArrowSchema const* schema, std::overflow_error); return std::make_unique
(std::move(columns), static_cast(input->array.length)); } + stream.synchronize(); return std::make_unique
(std::move(columns)); } @@ -507,8 +509,10 @@ std::unique_ptr from_arrow_host_column(ArrowSchema const* schema, ArrowSchemaView view; NANOARROW_THROW_NOT_OK(ArrowSchemaViewInit(&view, schema, nullptr)); - auto type = arrow_to_cudf_type(&view); - return get_column_copy(&view, &input->array, type, false, stream, mr); + auto type = arrow_to_cudf_type(&view); + auto result = get_column_copy(&view, &input->array, type, false, stream, mr); + stream.synchronize(); + return result; } std::unique_ptr get_column_from_host_copy(ArrowSchemaView const* schema, diff --git a/cpp/src/interop/from_arrow_host_strings.cu b/cpp/src/interop/from_arrow_host_strings.cu index 54f957d5522d..d9dc6c5d19d0 100644 --- a/cpp/src/interop/from_arrow_host_strings.cu +++ b/cpp/src/interop/from_arrow_host_strings.cu @@ -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 */ @@ -113,6 +113,7 @@ std::unique_ptr from_arrow_stringview(ArrowSchemaView const* schema, return {data, size}; }); + stream.synchronize(); return cudf::strings::detail::make_strings_column(d_indices.begin(), d_indices.end(), stream, mr); } diff --git a/cpp/src/io/orc/stripe_enc.cu b/cpp/src/io/orc/stripe_enc.cu index f1970774c8ac..7ea3b8de315d 100644 --- a/cpp/src/io/orc/stripe_enc.cu +++ b/cpp/src/io/orc/stripe_enc.cu @@ -1425,7 +1425,7 @@ void decimal_sizes_to_offsets(device_2dspan rg_bounds, auto const num_blocks = elem_sizes.size() * rg_bounds.size().first; decimal_sizes_to_offsets_kernel <<>>(rg_bounds, d_sizes); - CUDF_CUDA_TRY(cudaGetLastError()); + stream.sync(); } } // namespace cudf::io::orc::detail diff --git a/cpp/src/io/orc/writer_impl.cu b/cpp/src/io/orc/writer_impl.cu index 63f40bc84086..dc864799f277 100644 --- a/cpp/src/io/orc/writer_impl.cu +++ b/cpp/src/io/orc/writer_impl.cu @@ -1513,6 +1513,7 @@ encoded_footer_statistics finish_statistic_blobs(Footer const& footer, file_blobs[i].assign(stat_begin, stat_end); } + stream.sync(); return {{}, std::move(file_blobs)}; } @@ -1595,6 +1596,7 @@ encoded_footer_statistics finish_statistic_blobs(Footer const& footer, file_blobs[i].assign(stat_begin, stat_end); } + stream.sync(); return {std::move(stripe_blobs), std::move(file_blobs)}; } @@ -2040,6 +2042,7 @@ orc_table_view make_orc_table_view(table_view const& table, }, stream); + stream.sync(); return {std::move(orc_columns), std::move(d_orc_columns), str_col_indexes, diff --git a/cpp/src/io/parquet/experimental/deletion_vectors_helpers.cu b/cpp/src/io/parquet/experimental/deletion_vectors_helpers.cu index 4a94be6193c4..4a061ad22d86 100644 --- a/cpp/src/io/parquet/experimental/deletion_vectors_helpers.cu +++ b/cpp/src/io/parquet/experimental/deletion_vectors_helpers.cu @@ -132,6 +132,7 @@ std::unique_ptr compute_row_index_column( row_indices_iter, row_indices_iter); + stream.sync(); return std::make_unique(cudf::data_type{cudf::type_id::UINT64}, num_rows, std::move(row_indices), diff --git a/cpp/src/io/parquet/experimental/dictionary_page_filter.cu b/cpp/src/io/parquet/experimental/dictionary_page_filter.cu index 774176592e0b..933dcd67a383 100644 --- a/cpp/src/io/parquet/experimental/dictionary_page_filter.cu +++ b/cpp/src/io/parquet/experimental/dictionary_page_filter.cu @@ -1162,6 +1162,7 @@ struct dictionary_caster { physical_type); CUDF_CUDA_TRY(cudaGetLastError()); + stream.sync(); // Build the BOOL8 columns from the results buffers return build_columns(results_buffers, stream, mr); } diff --git a/cpp/src/io/parquet/experimental/page_index_filter.cu b/cpp/src/io/parquet/experimental/page_index_filter.cu index 61312327d8ac..1e88e996363c 100644 --- a/cpp/src/io/parquet/experimental/page_index_filter.cu +++ b/cpp/src/io/parquet/experimental/page_index_filter.cu @@ -417,6 +417,7 @@ struct page_stats_caster : public stats_caster_base { // Construct a row indices mapping based on page row offsets. auto const page_indices = compute_page_indices_async( page_row_offsets, total_rows, stream, cudf::get_current_device_resource_ref()); + stream.sync(); // For non-strings columns, directly gather the page-level column data and bitmask to the // row-level. @@ -583,6 +584,7 @@ struct page_stats_to_row_mask_converter : public page_stats_caster { stream) : cudf::detail::make_empty_host_vector(0, stream); + stream.sync(); auto [row_mask_data, row_mask_bitmask] = build_data_and_nullmask(page_mask->mutable_view(), page_mask_nullmask.data(), diff --git a/cpp/src/io/parquet/reader_impl.cpp b/cpp/src/io/parquet/reader_impl.cpp index 917b9f10f5af..bbcd6ec05f21 100644 --- a/cpp/src/io/parquet/reader_impl.cpp +++ b/cpp/src/io/parquet/reader_impl.cpp @@ -1182,6 +1182,7 @@ void reader_impl::update_output_nullmasks_for_pruned_pages(cudf::host_span preprocessed_table::create( null_precedence, stream, cudf::get_current_device_resource_ref()); auto d_depths = detail::make_device_uvector_async( verticalized_col_depths, stream, cudf::get_current_device_resource_ref()); + stream.synchronize(); if (detail::has_nested_columns(preprocessed_input)) { auto [dremel_data, d_dremel_device_view] = list_lex_preprocess(preprocessed_input, stream); diff --git a/cpp/src/scalar/scalar.cpp b/cpp/src/scalar/scalar.cpp index 0b00470c9171..9fe9befb4ea0 100644 --- a/cpp/src/scalar/scalar.cpp +++ b/cpp/src/scalar/scalar.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -16,10 +17,20 @@ #include +#include #include namespace cudf { +static rmm::device_buffer make_string_device_buffer(std::string_view string, + cuda::stream_ref stream, + rmm::device_async_resource_ref mr) +{ + auto host_data = cudf::detail::make_pinned_vector(string.size(), stream); + std::copy(string.begin(), string.end(), host_data.begin()); + return rmm::device_buffer(host_data.data(), host_data.size(), stream, mr); +} + scalar::scalar(data_type type, bool is_valid, cuda::stream_ref stream, @@ -51,7 +62,7 @@ string_scalar::string_scalar(std::string_view string, cuda::stream_ref stream, rmm::device_async_resource_ref mr) : scalar(data_type(type_id::STRING), is_valid, stream, mr), - _data(string.data(), string.size(), stream, mr) + _data(make_string_device_buffer(string, stream, mr)) { CUDF_EXPECTS( string.size() <= static_cast(std::numeric_limits::max()), @@ -145,7 +156,8 @@ fixed_point_scalar::fixed_point_scalar(rmm::device_scalar&& data, bool is_valid, cuda::stream_ref stream, rmm::device_async_resource_ref mr) - : scalar{data_type{type_to_id(), scale}, is_valid, stream, mr}, _data{std::move(data)} + : scalar{data_type{type_to_id(), scale}, is_valid, stream, mr}, + _data{data.value(stream), stream, mr} { } @@ -210,7 +222,7 @@ fixed_width_scalar::fixed_width_scalar(rmm::device_scalar&& data, bool is_valid, cuda::stream_ref stream, rmm::device_async_resource_ref mr) - : scalar(data_type(type_to_id()), is_valid, stream, mr), _data{std::move(data)} + : scalar(data_type(type_to_id()), is_valid, stream, mr), _data{data.value(stream), stream, mr} { } diff --git a/cpp/src/transform/row_bit_count.cu b/cpp/src/transform/row_bit_count.cu index 692258f3bb9d..c74a9315251e 100644 --- a/cpp/src/transform/row_bit_count.cu +++ b/cpp/src/transform/row_bit_count.cu @@ -551,8 +551,8 @@ std::unique_ptr segmented_row_bit_count(table_view const& t, {mcv.data(), static_cast(mcv.size())}, segment_length, h_info.max_branch_depth); - CUDF_CUDA_TRY(cudaGetLastError()); + stream.sync(); return output; } diff --git a/cpp/tests/io/experimental/hybrid_scan_common.cpp b/cpp/tests/io/experimental/hybrid_scan_common.cpp index cf372e845b5b..f478c09e2eac 100644 --- a/cpp/tests/io/experimental/hybrid_scan_common.cpp +++ b/cpp/tests/io/experimental/hybrid_scan_common.cpp @@ -347,6 +347,7 @@ std::pair, std::vector> create_parquet_with_s auto [null_mask, null_count] = cudf::test::detail::make_null_mask_vector(begin, end); auto d_mask = rmm::device_buffer{ null_mask.data(), cudf::bitmask_allocation_size_bytes(cudf::distance(begin, end)), stream}; + stream.sync(); return std::pair{std::move(d_mask), null_count}; }; diff --git a/cpp/tests/io/json/json_quote_normalization_test.cpp b/cpp/tests/io/json/json_quote_normalization_test.cpp index 760fa3a5e255..e5373d4b3543 100644 --- a/cpp/tests/io/json/json_quote_normalization_test.cpp +++ b/cpp/tests/io/json/json_quote_normalization_test.cpp @@ -27,6 +27,7 @@ void run_test(std::string const& host_input, { auto stream_view = cudf::test::get_default_stream(); auto device_input = rmm::device_buffer(host_input.c_str(), host_input.size(), stream_view); + stream_view.synchronize(); // Preprocessing FST cudf::io::datasource::owning_buffer device_data(std::move(device_input)); diff --git a/cpp/tests/io/parquet_deletion_vectors_test.cpp b/cpp/tests/io/parquet_deletion_vectors_test.cpp index 735d0a1ec0a3..0fa8ef84bf9b 100644 --- a/cpp/tests/io/parquet_deletion_vectors_test.cpp +++ b/cpp/tests/io/parquet_deletion_vectors_test.cpp @@ -76,7 +76,7 @@ auto build_column_from_host_data(cudf::host_span host_data, auto const num_rows = host_data.size(); rmm::device_buffer buffer{num_rows * sizeof(T), stream, mr}; - cudf::detail::cuda_memcpy_async( + cudf::detail::cuda_memcpy( cudf::device_span{static_cast(buffer.data()), num_rows}, host_data, stream); return std::make_unique( cudf::data_type{data_type}, num_rows, std::move(buffer), rmm::device_buffer{}, 0); diff --git a/cpp/tests/scalar/scalar_test.cpp b/cpp/tests/scalar/scalar_test.cpp index 044715fa468c..c7b4f2f1de02 100644 --- a/cpp/tests/scalar/scalar_test.cpp +++ b/cpp/tests/scalar/scalar_test.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ @@ -9,7 +9,64 @@ #include #include +#include #include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +namespace { + +class host_func_gate { + public: + ~host_func_gate() { release(); } + + void wait() + { + std::unique_lock lock{mutex_}; + EXPECT_TRUE(condition_.wait_for(lock, std::chrono::seconds{10}, [this] { return released_; })); + complete_.store(true); + } + + void release() + { + { + std::lock_guard lock{mutex_}; + released_ = true; + } + condition_.notify_one(); + } + + bool complete() const { return complete_.load(); } + + private: + std::mutex mutex_; + std::condition_variable condition_; + bool released_{false}; + std::atomic complete_{false}; +}; + +class lifetime_test_scalar : public cudf::numeric_scalar { + public: + using numeric_scalar::numeric_scalar; + + void set_data_async(int32_t const& value, cuda::stream_ref stream) + { + this->_data.set_value_async(value, stream); + } +}; + +} // namespace template struct TypedScalarTest : public cudf::test::BaseFixture {}; @@ -17,6 +74,8 @@ struct TypedScalarTest : public cudf::test::BaseFixture {}; template struct TypedScalarTestWithoutFixedPoint : public cudf::test::BaseFixture {}; +struct ScalarTest : public cudf::test::BaseFixture {}; + TYPED_TEST_SUITE(TypedScalarTest, cudf::test::FixedWidthTypes); TYPED_TEST_SUITE(TypedScalarTestWithoutFixedPoint, cudf::test::FixedWidthTypesWithoutFixedPoint); @@ -49,6 +108,59 @@ TYPED_TEST(TypedScalarTestWithoutFixedPoint, SetValue) EXPECT_EQ(value, s.value()); } +TEST_F(ScalarTest, AsyncSetValueOwnsHostSource) +{ + rmm::cuda_stream stream; + auto const stream_ref = cuda::stream_ref{stream.value()}; + int32_t source = 42; + lifetime_test_scalar scalar{0, true, stream_ref}; + host_func_gate gate; + CUDF_CUDA_TRY(cudaLaunchHostFunc( + stream.value(), [](void* data) { static_cast(data)->wait(); }, &gate)); + + scalar.set_data_async(source, stream_ref); + source = -1; + EXPECT_FALSE(gate.complete()); + + gate.release(); + EXPECT_EQ(42, scalar.value(stream_ref)); +} + +TEST_F(ScalarTest, AsyncStringConstructionOwnsHostSource) +{ + rmm::cuda_stream stream; + auto const stream_ref = cuda::stream_ref{stream.value()}; + host_func_gate gate; + auto upstream = cudf::get_current_device_resource_ref(); + int allocations{0}; + rmm::mr::callback_memory_resource mr{ + [upstream, &gate, &allocations]( + std::size_t bytes, rmm::cuda_stream_view stream, void*) mutable { + auto* ptr = upstream.allocate(stream, bytes, cuda::mr::default_cuda_malloc_alignment); + if (allocations++ == 1) { + CUDF_CUDA_TRY(cudaLaunchHostFunc( + stream.value(), [](void* data) { static_cast(data)->wait(); }, &gate)); + } + return ptr; + }, + [upstream](void* ptr, std::size_t bytes, rmm::cuda_stream_view stream, void*) mutable { + upstream.deallocate(stream, ptr, bytes, cuda::mr::default_cuda_malloc_alignment); + }}; + std::string expected{"expected"}; + auto source = cudf::detail::make_pinned_vector(expected.size(), stream_ref); + std::copy(expected.begin(), expected.end(), source.begin()); + + cudf::string_scalar scalar{std::string_view{source.data(), source.size()}, + true, + stream_ref, + rmm::device_async_resource_ref{mr}}; + std::fill(source.begin(), source.end(), 'x'); + EXPECT_FALSE(gate.complete()); + + gate.release(); + EXPECT_EQ(expected, scalar.to_string(stream_ref)); +} + TYPED_TEST(TypedScalarTestWithoutFixedPoint, SetNull) { TypeParam value = cudf::test::make_type_param_scalar(6); diff --git a/cpp/tests/utilities/identify_stream_usage.cpp b/cpp/tests/utilities/identify_stream_usage.cpp index 00249b830346..c80650cdf22f 100644 --- a/cpp/tests/utilities/identify_stream_usage.cpp +++ b/cpp/tests/utilities/identify_stream_usage.cpp @@ -218,6 +218,10 @@ void sanitizer_subscriber::callback(Sanitizer_CallbackDomain domain, CHECK_STREAM_ARG(cudaMemcpy3DPeerAsync_ptsz, 7000, stream); CHECK_STREAM_ARG(cudaMemcpyAsync, 3020, stream); CHECK_STREAM_ARG(cudaMemcpyAsync_ptsz, 7000, stream); +#if CUDART_VERSION >= 13000 + CHECK_STREAM_ARG(cudaMemcpyBatchAsync, 13000, stream); + CHECK_STREAM_ARG(cudaMemcpyBatchAsync_ptsz, 13000, stream); +#endif CHECK_STREAM_ARG(cudaMemcpyFromSymbolAsync, 3020, stream); CHECK_STREAM_ARG(cudaMemcpyFromSymbolAsync_ptsz, 7000, stream); CHECK_STREAM_ARG(cudaMemcpyToSymbolAsync, 3020, stream); diff --git a/python/pylibcudf/pylibcudf/column.pyx b/python/pylibcudf/pylibcudf/column.pyx index f1eebd8bf07e..de715b24ce45 100644 --- a/python/pylibcudf/pylibcudf/column.pyx +++ b/python/pylibcudf/pylibcudf/column.pyx @@ -188,10 +188,12 @@ cdef gpumemoryview _copy_array_to_device(object buf, object stream: CudaStreamLi cdef size_t nbytes = len(mv) * mv.itemsize cdef Stream _stream = _get_stream(stream) - return gpumemoryview(DeviceBuffer.to_device( + cdef DeviceBuffer dbuf = DeviceBuffer.to_device( ptr, _stream - )) + ) + _stream.synchronize() + return gpumemoryview(dbuf) def _infer_list_depth_and_dtype(obj: list) -> tuple[int, type]: @@ -1034,6 +1036,7 @@ cdef class Column: ptr = data_ptr view = ( ptr)[:nbytes] dbuf = DeviceBuffer.to_device(view, _stream) + _stream.synchronize() else: dbuf = DeviceBuffer(size=0, stream=_stream) diff --git a/python/pylibcudf/tests/io/test_experimental_hybrid_scan.py b/python/pylibcudf/tests/io/test_experimental_hybrid_scan.py index 7bf3a19e1d13..1c6dc4855b85 100644 --- a/python/pylibcudf/tests/io/test_experimental_hybrid_scan.py +++ b/python/pylibcudf/tests/io/test_experimental_hybrid_scan.py @@ -348,7 +348,7 @@ def test_hybrid_scan_materialize_columns( filter_data = [ plc.gpumemoryview( rmm.DeviceBuffer.to_device( - simple_parquet_bytes[r.offset : r.offset + r.size], + memoryview(simple_parquet_bytes)[r.offset : r.offset + r.size], plc.utils._get_stream(stream), ) ) @@ -383,7 +383,7 @@ def test_hybrid_scan_materialize_columns( payload_data = [ plc.gpumemoryview( rmm.DeviceBuffer.to_device( - simple_parquet_bytes[r.offset : r.offset + r.size], + memoryview(simple_parquet_bytes)[r.offset : r.offset + r.size], plc.utils._get_stream(stream), ) ) @@ -474,7 +474,7 @@ def test_hybrid_scan_single_step_materialize( all_columns_data = [ plc.gpumemoryview( rmm.DeviceBuffer.to_device( - simple_parquet_bytes[r.offset : r.offset + r.size], + memoryview(simple_parquet_bytes)[r.offset : r.offset + r.size], plc.utils._get_stream(stream), ) ) @@ -556,7 +556,7 @@ def test_hybrid_scan_has_next_table_chunk( filter_data = [ plc.gpumemoryview( rmm.DeviceBuffer.to_device( - simple_parquet_bytes[r.offset : r.offset + r.size], + memoryview(simple_parquet_bytes)[r.offset : r.offset + r.size], plc.utils._get_stream(), ) ) @@ -626,7 +626,7 @@ def test_hybrid_scan_chunked_reading( filter_data = [ plc.gpumemoryview( rmm.DeviceBuffer.to_device( - simple_parquet_bytes[r.offset : r.offset + r.size], + memoryview(simple_parquet_bytes)[r.offset : r.offset + r.size], plc.utils._get_stream(stream), ) )