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

Reduce the number of redundant informative API calls #334

Closed
eyalroz opened this issue May 25, 2022 · 0 comments
Closed

Reduce the number of redundant informative API calls #334

eyalroz opened this issue May 25, 2022 · 0 comments

Comments

@eyalroz
Copy link
Owner

eyalroz commented May 25, 2022

We are making too many API calls to:

  • determine the current context.
  • increase and decrease the reference count of the primary context

due to this information not passing between proxy class instances. Let's try to pass more of it when we can (without burdening the user).

@eyalroz eyalroz self-assigned this May 25, 2022
eyalroz added a commit that referenced this issue May 25, 2022
* Switched many methods which require a context, and take a `device_t` by value, to taking it by const-reference - to make use of device_t's mutable primary-context cache.
* Host memory allocations no longer increase primary context refcounts, nor do their freeing decrease the refcount
* The following proxy class instances can now keep primary contexts alive with a reference count unit (depending on how they were constructed): `device_t`, `primary_context_t`, `kernel_t`, `stream_t`, `event_t`, `module_t`.
* Some doxygen comment corrections and additions
* Added bool aliases regarding whether or not a proxy object should hold a primary context refcount unit.
* Dropped: The `scoped_` and `unscoped_` bool-aliases which were used with `device_t::primary_context()`; we now indicate clearly whether the proxy object should or should not hold a refcount unit
* Spaces -> tabs fixes in `context.hpp`
* Added an alternative  method for setting the current device (`device::current::detail_::set_with_aux_info()`) that requires performing less API calls.
* The combined behavior of `device_t`, `primary_context_t` and `current_device::detail_::scoped_context_override` was such, that `make_unique()` with no device passed, and with the primary context inactive, would cause a primary context to be activated, then destroyed/deactivated immediately after allocation. This no longer happens.
* No longer using `current_device::detail_::scoped_context_override`; now preferring `device_t`'s primary context caching mechanism + delegating to methods which take a (not necessarily primary) context.
* The scoped context override gadget now has two flags: One for popping the context, another for reducing the primary context refcount; the logic for using them has been updated.
* `device_t` now uses an explicit flag for when it's holding a primary context refcount unit; this allows in-context copies of a `device_t` to know the primary context without holding a refcount unit.
* Spacing tweaks
* Corrected an exception message in `stream.hpp`.
* CAVEAT: Some DRY in the code handling refcount units in the various proxy class.
eyalroz added a commit that referenced this issue May 25, 2022
* Switched many methods which require a context, and take a `device_t` by value, to taking it by const-reference - to make use of device_t's mutable primary-context cache.
* Host memory allocations no longer increase primary context refcounts, nor do their freeing decrease the refcount
* The following proxy class instances can now keep primary contexts alive with a reference count unit (depending on how they were constructed): `device_t`, `primary_context_t`, `kernel_t`, `stream_t`, `event_t`, `module_t`.
* Some doxygen comment corrections and additions
* Added bool aliases regarding whether or not a proxy object should hold a primary context refcount unit.
* Dropped: The `scoped_` and `unscoped_` bool-aliases which were used with `device_t::primary_context()`; we now indicate clearly whether the proxy object should or should not hold a refcount unit
* Spaces -> tabs fixes in `context.hpp`
* Added an alternative  method for setting the current device (`device::current::detail_::set_with_aux_info()`) that requires performing less API calls.
* The combined behavior of `device_t`, `primary_context_t` and `current_device::detail_::scoped_context_override` was such, that `make_unique()` with no device passed, and with the primary context inactive, would cause a primary context to be activated, then destroyed/deactivated immediately after allocation. This no longer happens.
* No longer using `current_device::detail_::scoped_context_override`; now preferring `device_t`'s primary context caching mechanism + delegating to methods which take a (not necessarily primary) context.
* The scoped context override gadget now has two flags: One for popping the context, another for reducing the primary context refcount; the logic for using them has been updated.
* `device_t` now uses an explicit flag for when it's holding a primary context refcount unit; this allows in-context copies of a `device_t` to know the primary context without holding a refcount unit.
* Spacing tweaks
* Corrected an exception message in `stream.hpp`.
* CAVEAT: Some DRY in the code handling refcount units in the various proxy class.
eyalroz added a commit that referenced this issue May 25, 2022
* Switched many methods which require a context, and take a `device_t` by value, to taking it by const-reference - to make use of device_t's mutable primary-context cache.
* Host memory allocations no longer increase primary context refcounts, nor do their freeing decrease the refcount
* The following proxy class instances can now keep primary contexts alive with a reference count unit (depending on how they were constructed): `device_t`, `primary_context_t`, `kernel_t`, `stream_t`, `event_t`, `module_t`.
* Some doxygen comment corrections and additions
* Added bool aliases regarding whether or not a proxy object should hold a primary context refcount unit.
* Dropped: The `scoped_` and `unscoped_` bool-aliases which were used with `device_t::primary_context()`; we now indicate clearly whether the proxy object should or should not hold a refcount unit
* Spaces -> tabs fixes in `context.hpp`
* Added an alternative  method for setting the current device (`device::current::detail_::set_with_aux_info()`) that requires performing less API calls.
* The combined behavior of `device_t`, `primary_context_t` and `current_device::detail_::scoped_context_override` was such, that `make_unique()` with no device passed, and with the primary context inactive, would cause a primary context to be activated, then destroyed/deactivated immediately after allocation. This no longer happens.
* No longer using `current_device::detail_::scoped_context_override`; now preferring `device_t`'s primary context caching mechanism + delegating to methods which take a (not necessarily primary) context.
* The scoped context override gadget now has two flags: One for popping the context, another for reducing the primary context refcount; the logic for using them has been updated.
* `device_t` now uses an explicit flag for when it's holding a primary context refcount unit; this allows in-context copies of a `device_t` to know the primary context without holding a refcount unit.
* Spacing tweaks
* Corrected an exception message in `stream.hpp`.
* CAVEAT: Some DRY in the code handling refcount units in the various proxy class.
eyalroz added a commit that referenced this issue May 29, 2022
* Switched many methods which require a context, and take a `device_t` by value, to taking it by const-reference - to make use of device_t's mutable primary-context cache.
* Host memory allocations no longer increase primary context refcounts, nor do their freeing decrease the refcount
* The following proxy class instances can now keep primary contexts alive with a reference count unit (depending on how they were constructed): `device_t`, `primary_context_t`, `kernel_t`, `stream_t`, `event_t`, `module_t`.
* Some doxygen comment corrections and additions
* Added bool aliases regarding whether or not a proxy object should hold a primary context refcount unit.
* Dropped: The `scoped_` and `unscoped_` bool-aliases which were used with `device_t::primary_context()`; we now indicate clearly whether the proxy object should or should not hold a refcount unit
* Spaces -> tabs fixes in `context.hpp`
* Added an alternative  method for setting the current device (`device::current::detail_::set_with_aux_info()`) that requires performing less API calls.
* The combined behavior of `device_t`, `primary_context_t` and `current_device::detail_::scoped_context_override` was such, that `make_unique()` with no device passed, and with the primary context inactive, would cause a primary context to be activated, then destroyed/deactivated immediately after allocation. This no longer happens.
* No longer using `current_device::detail_::scoped_context_override`; now preferring `device_t`'s primary context caching mechanism + delegating to methods which take a (not necessarily primary) context.
* The scoped context override gadget now has two flags: One for popping the context, another for reducing the primary context refcount; the logic for using them has been updated.
* `device_t` now uses an explicit flag for when it's holding a primary context refcount unit; this allows in-context copies of a `device_t` to know the primary context without holding a refcount unit.
* Spacing tweaks
* Corrected an exception message in `stream.hpp`.
* CAVEAT: Some DRY in the code handling refcount units in the various proxy class.
eyalroz added a commit that referenced this issue Jun 2, 2022
* Switched many methods which require a context, and take a `device_t` by value, to taking it by const-reference - to make use of device_t's mutable primary-context cache.
* Host memory allocations no longer increase primary context refcounts, nor do their freeing decrease the refcount
* The following proxy class instances can now keep primary contexts alive with a reference count unit (depending on how they were constructed): `device_t`, `primary_context_t`, `kernel_t`, `stream_t`, `event_t`, `module_t`.
* Some doxygen comment corrections and additions
* Added bool aliases regarding whether or not a proxy object should hold a primary context refcount unit.
* Dropped: The `scoped_` and `unscoped_` bool-aliases which were used with `device_t::primary_context()`; we now indicate clearly whether the proxy object should or should not hold a refcount unit
* Spaces -> tabs fixes in `context.hpp`
* Added an alternative  method for setting the current device (`device::current::detail_::set_with_aux_info()`) that requires performing less API calls.
* The combined behavior of `device_t`, `primary_context_t` and `current_device::detail_::scoped_context_override` was such, that `make_unique()` with no device passed, and with the primary context inactive, would cause a primary context to be activated, then destroyed/deactivated immediately after allocation. This no longer happens.
* No longer using `current_device::detail_::scoped_context_override`; now preferring `device_t`'s primary context caching mechanism + delegating to methods which take a (not necessarily primary) context.
* The scoped context override gadget now has two flags: One for popping the context, another for reducing the primary context refcount; the logic for using them has been updated.
* `device_t` now uses an explicit flag for when it's holding a primary context refcount unit; this allows in-context copies of a `device_t` to know the primary context without holding a refcount unit.
* Spacing tweaks
* Corrected an exception message in `stream.hpp`.
* CAVEAT: Some DRY in the code handling refcount units in the various proxy class.
eyalroz added a commit that referenced this issue Jun 5, 2022
* Switched many methods which require a context, and take a `device_t` by value, to taking it by const-reference - to make use of device_t's mutable primary-context cache.
* Host memory allocations no longer increase primary context refcounts, nor do their freeing decrease the refcount
* The following proxy class instances can now keep primary contexts alive with a reference count unit (depending on how they were constructed): `device_t`, `primary_context_t`, `kernel_t`, `stream_t`, `event_t`, `module_t`.
* Some doxygen comment corrections and additions
* Added bool aliases regarding whether or not a proxy object should hold a primary context refcount unit.
* Dropped: The `scoped_` and `unscoped_` bool-aliases which were used with `device_t::primary_context()`; we now indicate clearly whether the proxy object should or should not hold a refcount unit
* Spaces -> tabs fixes in `context.hpp`
* Added an alternative  method for setting the current device (`device::current::detail_::set_with_aux_info()`) that requires performing less API calls.
* The combined behavior of `device_t`, `primary_context_t` and `current_device::detail_::scoped_context_override` was such, that `make_unique()` with no device passed, and with the primary context inactive, would cause a primary context to be activated, then destroyed/deactivated immediately after allocation. This no longer happens.
* No longer using `current_device::detail_::scoped_context_override`; now preferring `device_t`'s primary context caching mechanism + delegating to methods which take a (not necessarily primary) context.
* The scoped context override gadget now has two flags: One for popping the context, another for reducing the primary context refcount; the logic for using them has been updated.
* `device_t` now uses an explicit flag for when it's holding a primary context refcount unit; this allows in-context copies of a `device_t` to know the primary context without holding a refcount unit.
* Spacing tweaks
* Corrected an exception message in `stream.hpp`.
* CAVEAT: Some DRY in the code handling refcount units in the various proxy class.
eyalroz added a commit that referenced this issue Jun 20, 2022
* Switched many methods which require a context, and take a `device_t` by value, to taking it by const-reference - to make use of device_t's mutable primary-context cache.
* Host memory allocations no longer increase primary context refcounts, nor do their freeing decrease the refcount
* The following proxy class instances can now keep primary contexts alive with a reference count unit (depending on how they were constructed): `device_t`, `primary_context_t`, `kernel_t`, `stream_t`, `event_t`, `module_t`.
* Some doxygen comment corrections and additions
* Added bool aliases regarding whether or not a proxy object should hold a primary context refcount unit.
* Dropped: The `scoped_` and `unscoped_` bool-aliases which were used with `device_t::primary_context()`; we now indicate clearly whether the proxy object should or should not hold a refcount unit
* Spaces -> tabs fixes in `context.hpp`
* Added an alternative  method for setting the current device (`device::current::detail_::set_with_aux_info()`) that requires performing less API calls.
* The combined behavior of `device_t`, `primary_context_t` and `current_device::detail_::scoped_context_override` was such, that `make_unique()` with no device passed, and with the primary context inactive, would cause a primary context to be activated, then destroyed/deactivated immediately after allocation. This no longer happens.
* No longer using `current_device::detail_::scoped_context_override`; now preferring `device_t`'s primary context caching mechanism + delegating to methods which take a (not necessarily primary) context.
* The scoped context override gadget now has two flags: One for popping the context, another for reducing the primary context refcount; the logic for using them has been updated.
* `device_t` now uses an explicit flag for when it's holding a primary context refcount unit; this allows in-context copies of a `device_t` to know the primary context without holding a refcount unit.
* Spacing tweaks
* Corrected an exception message in `stream.hpp`.
* CAVEAT: Some DRY in the code handling refcount units in the various proxy class.
eyalroz added a commit that referenced this issue Jun 20, 2022
* Switched many methods which require a context, and take a `device_t` by value, to taking it by const-reference - to make use of device_t's mutable primary-context cache.
* Host memory allocations no longer increase primary context refcounts, nor do their freeing decrease the refcount
* The following proxy class instances can now keep primary contexts alive with a reference count unit (depending on how they were constructed): `device_t`, `primary_context_t`, `kernel_t`, `stream_t`, `event_t`, `module_t`.
* Some doxygen comment corrections and additions
* Added bool aliases regarding whether or not a proxy object should hold a primary context refcount unit.
* Dropped: The `scoped_` and `unscoped_` bool-aliases which were used with `device_t::primary_context()`; we now indicate clearly whether the proxy object should or should not hold a refcount unit
* Spaces -> tabs fixes in `context.hpp`
* Added an alternative  method for setting the current device (`device::current::detail_::set_with_aux_info()`) that requires performing less API calls.
* The combined behavior of `device_t`, `primary_context_t` and `current_device::detail_::scoped_context_override` was such, that `make_unique()` with no device passed, and with the primary context inactive, would cause a primary context to be activated, then destroyed/deactivated immediately after allocation. This no longer happens.
* No longer using `current_device::detail_::scoped_context_override`; now preferring `device_t`'s primary context caching mechanism + delegating to methods which take a (not necessarily primary) context.
* The scoped context override gadget now has two flags: One for popping the context, another for reducing the primary context refcount; the logic for using them has been updated.
* `device_t` now uses an explicit flag for when it's holding a primary context refcount unit; this allows in-context copies of a `device_t` to know the primary context without holding a refcount unit.
* Spacing tweaks
* Corrected an exception message in `stream.hpp`.
* CAVEAT: Some DRY in the code handling refcount units in the various proxy class.
eyalroz added a commit that referenced this issue Jun 20, 2022
* Switched many methods which require a context, and take a `device_t` by value, to taking it by const-reference - to make use of device_t's mutable primary-context cache.
* Host memory allocations no longer increase primary context refcounts, nor do their freeing decrease the refcount
* The following proxy class instances can now keep primary contexts alive with a reference count unit (depending on how they were constructed): `device_t`, `primary_context_t`, `kernel_t`, `stream_t`, `event_t`, `module_t`.
* Some doxygen comment corrections and additions
* Added bool aliases regarding whether or not a proxy object should hold a primary context refcount unit.
* Dropped: The `scoped_` and `unscoped_` bool-aliases which were used with `device_t::primary_context()`; we now indicate clearly whether the proxy object should or should not hold a refcount unit
* Spaces -> tabs fixes in `context.hpp`
* Added an alternative  method for setting the current device (`device::current::detail_::set_with_aux_info()`) that requires performing less API calls.
* The combined behavior of `device_t`, `primary_context_t` and `current_device::detail_::scoped_context_override` was such, that `make_unique()` with no device passed, and with the primary context inactive, would cause a primary context to be activated, then destroyed/deactivated immediately after allocation. This no longer happens.
* No longer using `current_device::detail_::scoped_context_override`; now preferring `device_t`'s primary context caching mechanism + delegating to methods which take a (not necessarily primary) context.
* The scoped context override gadget now has two flags: One for popping the context, another for reducing the primary context refcount; the logic for using them has been updated.
* `device_t` now uses an explicit flag for when it's holding a primary context refcount unit; this allows in-context copies of a `device_t` to know the primary context without holding a refcount unit.
* Spacing tweaks
* Corrected an exception message in `stream.hpp`.
* CAVEAT: Some DRY in the code handling refcount units in the various proxy class.
@eyalroz eyalroz closed this as completed Jun 20, 2022
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