NVIDIA / NVIDIA/cudf

[FEA] Consider reusable RAII helper for noinline device functors

Open
#23,667 1 comment 0 reactions 0 assignees View on GitHub
feature request libcudf Performance
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.**

In rapidsai/cudf#23448, @bdice suggested wrapping the manual noinline device functor pattern in an RAII helper. That pattern can reduce compile time by keeping a large callable out of the outer kernel’s template expansion, but the manual version requires each call site to manage host staging, device storage, async copy, device reference, and lifetime rules.

**Describe the solution you'd like**

If this pattern appears again, consider adding an internal helper such as `cudf::detail::noinline_device_functor`.

It would own the copied callable and expose a pointer-sized device reference with a non-inlined `operator()`. Good candidate uses would be kernels that currently pass large row comparators or other heavy callables through nested template code only to avoid inlining them.

**Describe alternatives you've considered**

Keep the helper local while there is only one use. That avoids adding a common utility before the pattern clearly repeats.

**Additional context**

Original discussion: https://github.com/NVIDIA/cudf/pull/23448#discussion_r3678970461

Prototype from @bdice: https://gist.github.com/bdice/b64a753458966e237b83418b0369f93b

Contributor guide

Open the contributing guide

Research direction

Start with the linked cuDF pull request discussion and the prototype gist to understand the manual noinline device-functor pattern, including host staging, device storage, asynchronous copying, and lifetime rules. Done means deciding whether the pattern has repeated enough to justify an internal cudf::detail::noinline_device_functor helper and identifying suitable existing call sites.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.