Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: STF constructs such as parallel_for do not accept lvalue (extended) lambda functions #3473

Open
1 task done
caugonnet opened this issue Jan 22, 2025 · 0 comments
Open
1 task done
Assignees
Labels
bug Something isn't working right. stf Sequential Task Flow programming model

Comments

@caugonnet
Copy link
Contributor

Is this a duplicate?

Type of Bug

Compile-time Error

Component

CUDA Experimental (cudax)

Describe the bug

While the usual idiom is to pass lambda function as rvalues like this

ctx.parallel_for(shape, deps...)->*[](size_t i, auto a, auto b) {
    ...
};

We may want to pass an lvalue instead :

auto fn = [](size_t i, auto a, auto b) {
    ...
};
ctx.parallel_for(shape, deps...)->*fn;

But STF currently makes the assumption that we have an rvalue and does invalid operations such as moving instead of forwarding. The mechanisms used to differentiate host/device/host device lambdas are also not working as expected, resulting in compilation errors, or runtime bugs as we fail to call the appropriate parallel_for implementation.

How to Reproduce

auto fn = [](size_t i, auto a, auto b) {
    ...
};
ctx.parallel_for(shape, deps...)->*fn;

Expected behavior

rvalues and lvalues should behave the same.

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

@caugonnet caugonnet added the bug Something isn't working right. label Jan 22, 2025
@github-project-automation github-project-automation bot moved this to Todo in CCCL Jan 22, 2025
@caugonnet caugonnet added the stf Sequential Task Flow programming model label Jan 22, 2025
@caugonnet caugonnet self-assigned this Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right. stf Sequential Task Flow programming model
Projects
Status: Todo
Development

No branches or pull requests

1 participant