[FEA] libcudf APIs accepting `std::vector<T> const&` should instead accept a span
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
**Is your feature request related to a problem? Please describe.**
Consider, for example, `cudf::merge`
```c++
std::unique_ptr merge(
std::vector const& tables_to_merge,
std::vector const& key_cols,
std::vector const& column_order,
std::vector 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` from my span-like object.
**Describe the solution you'd like**
A putative signature:
```c++
std::unique_ptr merge(
std::span tables_to_merge,
std::span key_cols,
std::span column_order,
std::span 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.
Contributor guide
Research direction
Start with the libcudf API represented by cudf::merge and identify other APIs accepting std::vector const&. Review how std::span would affect callers, including the C ABI-shim use case, then verify that affected declarations and existing vector-based calls remain compatible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100