[FEA] Implement UDF binary-operation with `transform`
- 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.**
The generic UDF overload of `cudf::binary_operation` has its own JIT kernel, type reflection,
launch path, and PTX-parser integration. Its operation is a strict subset of `cudf::transform`: it
accepts two inputs, invokes one row-wise UDF, and produces one output.
Maintaining a separate implementation duplicates JIT infrastructure and means improvements made to
`transform`—such as richer UDF representations, LTO IR support, shared error handling, and modular
fragments—do not automatically benefit generic binary operations.
**Describe the solution you'd like**
Implement the generic `binary_operation` UDF path as a thin adapter over `cudf::transform`:
- Convert the left and right operands into two transform inputs.
- Describe the requested output type as a single transform output.
- Preserve the public API's null propagation, input validation, output type, stream ordering, memory
resource use, and exception behavior.
- Reuse transform's CUDA, PTX, and LTO IR dispatch paths as applicable.
The public `binary_operation` overload can remain as a convenience API; only its internal JIT
implementation needs to delegate to `transform`.
**Describe alternatives you've considered**
- Keep the standalone binary-operation JIT implementation. This avoids an immediate migration but
continues to duplicate dispatch, compilation, and testing infrastructure.
- Remove the generic UDF overload entirely. This would simplify maintenance but introduce an
unnecessary breaking API change for callers that can be supported through `transform`.
- Share only selected helpers between the implementations. This reduces some duplication but
retains two kernels and two feature-evolution paths.
**Additional context**
The current implementation is in
[`cpp/src/binaryop/binaryop.cpp`](https://github.com/rapidsai/cudf/blob/main/cpp/src/binaryop/binaryop.cpp)
and launches the dedicated kernel in `cpp/src/binaryop/jit/kernel.cu`.
Contributor guide
Research direction
Start by reading cpp/src/binaryop/binaryop.cpp and the dedicated kernel in cpp/src/binaryop/jit/kernel.cu, then trace the existing transform implementation and dispatch paths. Done means the generic binary_operation UDF path delegates through transform while preserving null propagation, validation, output type, stream ordering, memory-resource use, and exception behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100