NVIDIA / libcudacxx

[ARCHIVED] The C++ Standard Library for your entire system. See https://github.com/NVIDIA/cccl
https://nvidia.github.io/libcudacxx
Other
2.29k stars 187 forks source link

Relax execution checks for function objects #470

Closed miscco closed 1 year ago

miscco commented 1 year ago

Previously, we would require that a function that is passed to a function object such as cuda::std::plus is annotated as __host__ __device__

However, this breaks valid use cases, such as using a __device__ function in a __global__ kernel.

This obviously also inhibits any compiler warnings which might catch a bug, but rejecting valid code seems the worse choice.

miscco commented 1 year ago

@jrhemstad I just realized, that we still require the predicate to be copy-constructible on device.

I am not really that concerned because stateful functors are rare on device, but do we want to also disable execution space checks for constructors?