Skip to content

Commit

Permalink
Change cudf::offset_type to cudf::size_type (#1315)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Lowe <[email protected]>
  • Loading branch information
jlowe authored Aug 4, 2023
1 parent 4a589e2 commit 512c9c9
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/main/cpp/src/cast_decimal_to_string.cu
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace {
template <typename DecimalType>
struct decimal_to_non_ansi_string_fn {
column_device_view d_decimals;
offset_type* d_offsets{};
size_type* d_offsets{};
char* d_chars{};

/**
Expand Down
14 changes: 7 additions & 7 deletions src/main/cpp/src/cast_string.cu
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ template <typename T>
void __global__ string_to_integer_kernel(T* out,
bitmask_type* validity,
const char* const chars,
offset_type const* offsets,
size_type const* offsets,
bitmask_type const* incoming_null_mask,
size_type num_rows,
bool ansi_mode,
Expand Down Expand Up @@ -392,7 +392,7 @@ template <typename T>
__global__ void string_to_decimal_kernel(T* out,
bitmask_type* validity,
const char* const chars,
offset_type const* offsets,
size_type const* offsets,
bitmask_type const* incoming_null_mask,
size_type num_rows,
int32_t scale,
Expand Down Expand Up @@ -612,10 +612,10 @@ void validate_ansi_column(column_view const& col,
thrust::make_counting_iterator(col.size()),
row_valid_fn{col.null_mask(), source_col.null_mask()});

offset_type string_bounds[2];
size_type string_bounds[2];
cudaMemcpyAsync(&string_bounds,
&source_col.offsets().data<offset_type>()[*first_error],
sizeof(offset_type) * 2,
&source_col.offsets().data<size_type>()[*first_error],
sizeof(size_type) * 2,
cudaMemcpyDeviceToHost,
stream.value());
stream.synchronize();
Expand Down Expand Up @@ -668,7 +668,7 @@ struct string_to_integer_impl {
data.data(),
null_mask.data(),
string_col.chars().data<char const>(),
string_col.offsets().data<offset_type>(),
string_col.offsets().data<size_type>(),
string_col.null_mask(),
string_col.size(),
ansi_mode,
Expand Down Expand Up @@ -737,7 +737,7 @@ struct string_to_decimal_impl {
data.data(),
null_mask.data(),
string_col.chars().data<char const>(),
string_col.offsets().data<offset_type>(),
string_col.offsets().data<size_type>(),
string_col.null_mask(),
string_col.size(),
dtype.scale(),
Expand Down
16 changes: 8 additions & 8 deletions src/main/cpp/src/cast_string_to_float.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -59,7 +59,7 @@ class string_to_float {
int32_t* ansi_except,
size_type* valid_count,
const char* const chars,
offset_type const* offsets,
size_type const* offsets,
uint64_t const* const ipow,
bitmask_type const* incoming_null_mask,
size_type const num_rows)
Expand Down Expand Up @@ -595,7 +595,7 @@ __global__ void string_to_float_kernel(T* out,
int32_t* ansi_except,
size_type* valid_count,
const char* const chars,
offset_type const* offsets,
size_type const* offsets,
bitmask_type const* incoming_null_mask,
size_type const num_rows)
{
Expand Down Expand Up @@ -676,7 +676,7 @@ std::unique_ptr<column> string_to_float(data_type dtype,
ansi_mode ? static_cast<ScalarType*>(ansi_count.get())->data() : nullptr,
static_cast<ScalarType*>(valid_count.get())->data(),
string_col.chars().begin<char>(),
string_col.offsets().begin<offset_type>(),
string_col.offsets().begin<size_type>(),
string_col.null_mask(),
num_rows);
} else {
Expand All @@ -687,7 +687,7 @@ std::unique_ptr<column> string_to_float(data_type dtype,
ansi_mode ? static_cast<ScalarType*>(ansi_count.get())->data() : nullptr,
static_cast<ScalarType*>(valid_count.get())->data(),
string_col.chars().begin<char>(),
string_col.offsets().begin<offset_type>(),
string_col.offsets().begin<size_type>(),
string_col.null_mask(),
num_rows);
}
Expand All @@ -698,10 +698,10 @@ std::unique_ptr<column> string_to_float(data_type dtype,
auto const val = static_cast<ScalarType*>(ansi_count.get())->value(stream);
if (val >= 0) {
auto const error_row = num_rows - val;
offset_type string_bounds[2];
size_type string_bounds[2];
cudaMemcpyAsync(&string_bounds,
&string_col.offsets().data<offset_type>()[error_row],
sizeof(offset_type) * 2,
&string_col.offsets().data<size_type>()[error_row],
sizeof(size_type) * 2,
cudaMemcpyDeviceToHost,
stream.value());
stream.synchronize();
Expand Down
6 changes: 3 additions & 3 deletions src/main/cpp/src/map_utils.cu
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ struct substring_fn {
cudf::device_span<char const> const d_string;
cudf::device_span<thrust::pair<SymbolOffsetT, SymbolOffsetT> const> const d_ranges;

cudf::offset_type* d_offsets{};
cudf::size_type* d_offsets{};
char* d_chars{};

__device__ void operator()(cudf::size_type const idx)
Expand Down Expand Up @@ -557,7 +557,7 @@ std::unique_ptr<cudf::column> extract_keys_or_values(
}

// Compute the offsets for the final lists of Struct<String,String>.
rmm::device_uvector<cudf::offset_type> compute_list_offsets(
rmm::device_uvector<cudf::size_type> compute_list_offsets(
cudf::size_type n_lists,
rmm::device_uvector<NodeIndexT> const& parent_node_ids,
rmm::device_uvector<int8_t> const& key_or_value,
Expand Down Expand Up @@ -599,7 +599,7 @@ rmm::device_uvector<cudf::offset_type> compute_list_offsets(
print_debug(node_child_counts, "Nodes' child keys counts", ", ", stream);
#endif

auto list_offsets = rmm::device_uvector<cudf::offset_type>(n_lists + 1, stream, mr);
auto list_offsets = rmm::device_uvector<cudf::size_type>(n_lists + 1, stream, mr);
auto const copy_end = cudf::detail::copy_if_safe(
node_child_counts.begin(),
node_child_counts.end(),
Expand Down
4 changes: 2 additions & 2 deletions src/main/cpp/src/map_utils_debug.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void print_pair_debug(rmm::device_uvector<T> const& input,
}

// Print the final output map data (Spark's MapType, i.e., List<Struct<String,String>>).
void print_output_spark_map(rmm::device_uvector<cudf::offset_type> const& list_offsets,
void print_output_spark_map(rmm::device_uvector<cudf::size_type> const& list_offsets,
std::unique_ptr<cudf::column> const& extracted_keys,
std::unique_ptr<cudf::column> const& extracted_values,
rmm::cuda_stream_view stream)
Expand Down Expand Up @@ -138,7 +138,7 @@ void print_output_spark_map(rmm::device_uvector<cudf::offset_type> const& list_o
stream);

auto const h_list_offsets = cudf::detail::make_host_vector_sync(
cudf::device_span<cudf::offset_type const>{list_offsets.data(), list_offsets.size()}, stream);
cudf::device_span<cudf::size_type const>{list_offsets.data(), list_offsets.size()}, stream);
CUDF_EXPECTS(h_list_offsets.back() == extracted_keys->size(),
"Invalid list offsets computation.");

Expand Down
2 changes: 1 addition & 1 deletion src/main/cpp/src/row_conversion.cu
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ struct tile_info {
struct row_batch {
size_type num_bytes; // number of bytes in this batch
size_type row_count; // number of rows in the batch
device_uvector<offset_type> row_offsets; // offsets column of output cudf column
device_uvector<size_type> row_offsets; // offsets column of output cudf column
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/cpp/tests/bloom_filter.cu
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ TEST_F(BloomFilterTest, BuildAndProbeWithNulls)
struct bloom_filter_stride_transform {
int const stride;

cudf::offset_type __device__ operator()(cudf::size_type i) { return i * stride; }
cudf::size_type __device__ operator()(cudf::size_type i) { return i * stride; }
};

TEST_F(BloomFilterTest, ProbeMerged)
Expand Down Expand Up @@ -154,7 +154,7 @@ TEST_F(BloomFilterTest, ProbeMerged)
thrust::transform(rmm::exec_policy(cudf::get_default_stream()),
thrust::make_counting_iterator(0),
thrust::make_counting_iterator(0) + 4,
premerge_offsets->mutable_view().begin<cudf::offset_type>(),
premerge_offsets->mutable_view().begin<cudf::size_type>(),
bloom_filter_stride_transform{bloom_filter_a->view().size()});
auto premerged = cudf::make_lists_column(
3, std::move(premerge_offsets), std::move(premerge_children), 0, rmm::device_buffer{});
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/cudf
Submodule cudf updated 99 files
+4 −4 cpp/CMakeLists.txt
+1 −1 cpp/benchmarks/copying/contiguous_split.cu
+6 −6 cpp/benchmarks/lists/copying/scatter_lists.cu
+1 −1 cpp/examples/strings/custom_prealloc.cu
+2 −2 cpp/include/cudf/detail/sizes_to_offsets_iterator.cuh
+2 −2 cpp/include/cudf/io/detail/data_casting.cuh
+1 −1 cpp/include/cudf/io/detail/json.hpp
+4 −4 cpp/include/cudf/lists/detail/scatter.cuh
+2 −4 cpp/include/cudf/lists/lists_column_view.hpp
+3 −3 cpp/include/cudf/strings/strings_column_view.hpp
+1 −3 cpp/include/cudf/tdigest/tdigest_column_view.hpp
+0 −1 cpp/include/cudf/types.hpp
+2 −2 cpp/include/cudf_test/column_utilities.hpp
+1 −1 cpp/include/cudf_test/column_wrapper.hpp
+3 −3 cpp/src/copying/concatenate.cu
+7 −8 cpp/src/copying/contiguous_split.cu
+1 −1 cpp/src/groupby/groupby.cu
+2 −2 cpp/src/groupby/sort/group_collect.cu
+3 −3 cpp/src/groupby/sort/group_merge_lists.cu
+4 −4 cpp/src/io/csv/writer_impl.cu
+3 −3 cpp/src/io/json/byte_range_info.cu
+20 −22 cpp/src/io/json/json_column.cu
+5 −12 cpp/src/io/json/legacy/json_gpu.cu
+3 −9 cpp/src/io/json/legacy/json_gpu.hpp
+33 −0 cpp/src/io/json/legacy/read_json.hpp
+8 −18 cpp/src/io/json/legacy/reader_impl.cu
+8 −8 cpp/src/io/json/nested_json_gpu.cu
+10 −4 cpp/src/io/json/read_json.cu
+3 −3 cpp/src/io/json/read_json.hpp
+7 −7 cpp/src/io/json/write_json.cu
+2 −2 cpp/src/io/parquet/reader_impl_preprocess.cu
+1 −1 cpp/src/io/statistics/statistics.cuh
+5 −7 cpp/src/lists/combine/concatenate_list_elements.cu
+8 −11 cpp/src/lists/combine/concatenate_rows.cu
+6 −6 cpp/src/lists/copying/scatter_helper.cu
+11 −13 cpp/src/lists/interleave_columns.cu
+4 −4 cpp/src/lists/lists_column_factories.cu
+1 −1 cpp/src/lists/reverse.cu
+5 −5 cpp/src/lists/sequences.cu
+4 −6 cpp/src/lists/stream_compaction/apply_boolean_mask.cu
+5 −5 cpp/src/lists/utilities.cu
+8 −8 cpp/src/quantiles/tdigest/tdigest.cu
+22 −22 cpp/src/quantiles/tdigest/tdigest_aggregation.cu
+2 −2 cpp/src/rolling/detail/nth_element.cuh
+1 −1 cpp/src/rolling/detail/rolling.cuh
+2 −2 cpp/src/rolling/detail/rolling_collect_list.cu
+2 −2 cpp/src/rolling/grouped_rolling.cu
+6 −6 cpp/src/strings/capitalize.cu
+3 −3 cpp/src/strings/combine/concatenate.cu
+3 −3 cpp/src/strings/combine/join_list_elements.cu
+1 −1 cpp/src/strings/convert/convert_booleans.cu
+1 −1 cpp/src/strings/convert/convert_durations.cu
+1 −1 cpp/src/strings/convert/convert_fixed_point.cu
+2 −2 cpp/src/strings/convert/convert_hex.cu
+2 −2 cpp/src/strings/convert/convert_lists.cu
+9 −10 cpp/src/strings/convert/convert_urls.cu
+2 −2 cpp/src/strings/copying/concatenate.cu
+9 −9 cpp/src/strings/copying/shift.cu
+4 −4 cpp/src/strings/extract/extract_all.cu
+8 −8 cpp/src/strings/json/json_path.cu
+2 −2 cpp/src/strings/padding.cu
+5 −5 cpp/src/strings/repeat_strings.cu
+3 −3 cpp/src/strings/reverse.cu
+3 −3 cpp/src/strings/search/find_multiple.cu
+3 −3 cpp/src/strings/search/findall.cu
+6 −6 cpp/src/strings/split/split_re.cu
+2 −2 cpp/src/strings/strings_column_view.cpp
+10 −10 cpp/src/text/subword/bpe_tokenizer.cu
+1 −1 cpp/src/text/subword/load_merges_file.cu
+6 −6 cpp/src/transform/row_bit_count.cu
+6 −6 cpp/tests/column/factories_test.cpp
+4 −4 cpp/tests/copying/concatenate_tests.cpp
+1 −1 cpp/tests/copying/copy_if_else_nested_tests.cpp
+2 −2 cpp/tests/copying/gather_struct_tests.cpp
+10 −10 cpp/tests/copying/get_value_tests.cpp
+4 −4 cpp/tests/copying/scatter_list_scalar_tests.cpp
+2 −4 cpp/tests/copying/split_tests.cpp
+4 −4 cpp/tests/groupby/collect_list_tests.cpp
+2 −2 cpp/tests/io/json_chunked_reader.cpp
+24 −24 cpp/tests/io/json_type_cast_test.cu
+6 −6 cpp/tests/io/parquet_test.cpp
+3 −3 cpp/tests/lists/extract_tests.cpp
+2 −2 cpp/tests/quantiles/percentile_approx_test.cpp
+3 −3 cpp/tests/reductions/tdigest_tests.cu
+1 −1 cpp/tests/strings/array_tests.cpp
+3 −3 cpp/tests/strings/contains_tests.cpp
+4 −4 cpp/tests/strings/factories_test.cu
+21 −22 cpp/tests/transform/row_bit_count_test.cu
+3 −3 cpp/tests/utilities/column_utilities.cu
+3 −3 cpp/tests/utilities/tdigest_utilities.cu
+1 −1 cpp/tests/utilities_tests/column_utilities_tests.cpp
+3 −3 java/src/main/native/src/ColumnViewJni.cu
+3 −3 java/src/main/native/src/row_conversion.cu
+0 −1 python/cudf/cudf/_lib/cpp/types.pxd
+2 −2 python/cudf/cudf/_lib/pylibcudf/column.pxd
+2 −2 python/cudf/cudf/_lib/pylibcudf/column.pyx
+10 −0 python/cudf/cudf/core/column/column.py
+6 −0 python/cudf/cudf/tests/test_dataframe.py
+6 −0 python/cudf/cudf/tests/test_series.py

0 comments on commit 512c9c9

Please sign in to comment.