Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Update cuda::std::invoke_result to emit diagnostic when attempting to query return type of extended lambda in host code #277

Closed
jrhemstad opened this issue May 13, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request.
Milestone

Comments

@jrhemstad
Copy link
Collaborator

NVIDIA/thrust#1688 made me think we should put this check directly into cuda::std::invoke_result.

#if defined(__NVCC__) && defined(__CUDACC_EXTENDED_LAMBDA__) && !defined(__CUDA_ARCH__)
    static_assert(!__nv_is_extended_device_lambda_closure_type(F),
                  "Attempt to use an extended __device__ lambda in a context "
                  "that requires querying its return type. Use a named "
                  "function object or a __host__ __device__ lambda instead.");
    )  
#endif  

This may be slightly controversial to put something in the cuda::std layer that is so CUDA (and nvcc) specific like this, but I don't see how it would harm anyone doing the right thing or not using nvcc.

The fact that it would help eliminate a lot of potential bugs outweighs any of the misgivings I'd have about adding this check.

@gevtushenko gevtushenko self-assigned this Jun 7, 2022
@gevtushenko
Copy link
Collaborator

I'd like to address this for the following issue. If there are no objections, I assign it to myself.

@jrhemstad
Copy link
Collaborator Author

Closed by #284

@jrhemstad jrhemstad moved this to Done in CCCL Dec 6, 2022
@jarmak-nv jarmak-nv assigned alliepiper and unassigned gevtushenko Feb 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request.
Projects
Archived in project
Development

No branches or pull requests

4 participants