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

Avoid the fancy-shmancy heap allocation for stream callbacks #473

Closed
eyalroz opened this issue Feb 23, 2023 · 1 comment
Closed

Avoid the fancy-shmancy heap allocation for stream callbacks #473

eyalroz opened this issue Feb 23, 2023 · 1 comment

Comments

@eyalroz
Copy link
Owner

eyalroz commented Feb 23, 2023

At the moment, when a host (callback) function or callable is enqueued on a stream, we allocate some heap memory to pass it several arguments. While this does work, it is a problem, for two reasons:

  1. It goes against the design principle of these wrappers, which is being thin, and refraining from forcing the user into the use of particular data structures or programming patterns that the underlying API itself does not force.
  2. More importantly - this will be incompatible with repeated launching of the same function, which is what happens if we apply stream capture, then get the result into an execution graph template.

We therefore need to avoid this allocation, and make do with only what CUDA's API itself guarantees the provision of.

And - note also the deprecation of the callback enqueuing API function which passes the stream to the callback; we'll probably need to make do without it.

@eyalroz eyalroz added the task label Feb 23, 2023
@eyalroz eyalroz self-assigned this Feb 23, 2023
eyalroz added a commit that referenced this issue Feb 23, 2023
* No longer allocating heap memory on enqueue and releaing it during launch - only passing pointers the user has provided. Part of the motivation for this is enabling stream capture and re-execution of the launch.
* Separated a method for enqueuing no-argument callables and enqueuing functions which take a single (pointer) argument.
* Enqueued callables no longer receive a stream (as CUDA has moved away from this convention and we can't make it happen without the heap allocation scheme we had before
* `#ifdef`'ed out parts of `launch_config_builder.hpp` which require CUDA 10.0 to run (essentially obtaining minimum dimensions for maximum occupancy).
* Dropped some redundant comments in `stream.hpp` about the choice of API functions
eyalroz added a commit that referenced this issue Feb 23, 2023
* No longer allocating heap memory on enqueue and releaing it during launch - only passing pointers the user has provided. Part of the motivation for this is enabling stream capture and re-execution of the launch.
* Separated a method for enqueuing no-argument callables and enqueuing functions which take a single (pointer) argument.
* Enqueued callables no longer receive a stream (as CUDA has moved away from this convention and we can't make it happen without the heap allocation scheme we had before
* `#ifdef`'ed out parts of `launch_config_builder.hpp` which require CUDA 10.0 to run (essentially obtaining minimum dimensions for maximum occupancy).
* Dropped some redundant comments in `stream.hpp` about the choice of API functions
@eyalroz
Copy link
Owner Author

eyalroz commented Feb 26, 2023

Farwell fancy-shmancy closure call with arguments, we hardly knew ya!

eyalroz added a commit that referenced this issue Mar 9, 2023
* No longer allocating heap memory on enqueue and releaing it during launch - only passing pointers the user has provided. Part of the motivation for this is enabling stream capture and re-execution of the launch.
* Separated a method for enqueuing no-argument callables and enqueuing functions which take a single (pointer) argument.
* Enqueued callables no longer receive a stream (as CUDA has moved away from this convention and we can't make it happen without the heap allocation scheme we had before
* `#ifdef`'ed out parts of `launch_config_builder.hpp` which require CUDA 10.0 to run (essentially obtaining minimum dimensions for maximum occupancy).
* Dropped some redundant comments in `stream.hpp` about the choice of API functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant