Skip to content

[FEA] libcudf APIs accepting std::vector<T> const& should instead accept a span #23875

Description

@wence-

Is your feature request related to a problem? Please describe.

Consider, for example, cudf::merge

std::unique_ptr<cudf::table> merge(
   std::vector<table_view> const& tables_to_merge,
   std::vector<cudf::size_type> const& key_cols,
   std::vector<cudf::order> const& column_order,
   std::vector<cudf::null_order> const& null_precedence = {},
   cuda::stream_ref stream = cudf::get_default_stream(),
   rmm::device_async_resource_ref mr  = cudf::get_current_device_resource_ref());

Suppose that I have a perfectly decent array of values for the key_cols argument, perhaps a {cudf::size_type *, std::size_t} pair. I would have this if, for example, I am in a compiled language and trying to interface with the libcudf API: I will do so via a C ABI-shim.

The current libcudf APIs require me to materialise, by copy, a std::vector<cudf::size_type> from my span-like object.

Describe the solution you'd like

A putative signature:

std::unique_ptr<cudf::table> merge(
   std::span<table_view const> tables_to_merge,
   std::span<cudf::size_type const> key_cols,
   std::span<cudf::order const> column_order,
   std::span<cudf::null_order const> null_precedence = {},
   cuda::stream_ref stream = cudf::get_default_stream(),
   rmm::device_async_resource_ref mr  = cudf::get_current_device_resource_ref());

That way, if I have a std::vector I'm good, and equally if I have a T const *, size pair I'm also good.

Describe alternatives you've considered

Just make a local copy.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions