eyalroz / cuda-api-wrappers

Thin, unified, C++-flavored wrappers for the CUDA APIs
BSD 3-Clause "New" or "Revised" License
768 stars 79 forks source link

Want ability to set function attributes on function pointers and handles #566

Closed eyalroz closed 6 months ago

eyalroz commented 8 months ago

Currently, the cuFuncSetAttribute() can be called only in a member function of cuda::kernel. But - there's no good reason it shouldn't be usable outside of that object. Specifially, I'd like to be able to at least do something like:

cuda::kernel::detail_::set_attribute(device_id, context_handle, kernel_handle, attr_id, attr_value);

... which, for now, I can't. But beyond this, think of the following line:

cudaFuncSetAttribute(kernel_func_ptr, attr_id, attr_value);

which people may be using today with the runtime API. Should we not allow for:

cuda::kernel::set_attribute(kernel_func_ptr, attr_id, attr_value);

to cater to this? And also the context-specific version

cuda::kernel::set_attribute(context_ref, kernel_func_ptr, attr_id, attr_value);

?