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

Implement parallel_invoker #41

Open
4 tasks
johannesugb opened this issue Jul 31, 2020 · 0 comments
Open
4 tasks

Implement parallel_invoker #41

johannesugb opened this issue Jul 31, 2020 · 0 comments
Labels
C++ C++-centric task enhancement New feature or request

Comments

@johannesugb
Copy link
Member

johannesugb commented Jul 31, 2020

Currently, there is only one invoker: class sequential_invoker which invokes invokee::initialize(), invokee::update(), invokee::render(), etc. sequentially. Vulkan, however, allows to build command buffers in parallel to decrease the CPU-time of a frame by utilizing multiple CPU cores.

Implement class parallel_invoker : public invoker_interface and invoke all of the invokee's callback methods from multiple threads in parallel.
Attention: Only the invokees that have the same execution order may be invoked in parallel (=> evaluate invokee::execution_order()!). invokees with different execution orders must be invoked sequentially in order to maintain correctness.

A parallel_invoker can be used by providing it to the call of gvk::start as a parameter:

gvk::start( gvk::parallel_invoker(), ... );

Furthermore, create a new example application which can potentially benefit from a parallel_invoker. That can be, for example, an application which animates or transforms a lot of objects on the GPU and/or needs to create a lot of command buffers. Maybe also look into the creation of secondary command buffers for this example application!

It would be a nice-to-have if the same invokees would always be invoked from the same thread::id (i.e. across subsequent frames). In the general case, this is probably infeasible => care must be taken about the way how class descriptor_cache assigns descriptor_pools to specific thread::ids. It is unclear what happens if a descriptor_pool was created from thread 1, but in a subsequent frame, is used from thread 2, for example. Think about possible problematic cases!

Definition of done:

  • gvk::parallel_invoker has been implemented and can be used as a replacement to gvk::sequential_invoker wherever the latter has been in use.
  • All the example applications still work when a gvk::parallel_invoker is used with them instead of a gvk::sequential_invoker.
  • An additional example application has been implemented which benefits from a gvk::parallel_invoker performance-wise.
  • The new class gvk::parallel_invoker and all its methods are well documented and the Contribution Guidelines have been followed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ C++-centric task enhancement New feature or request
Development

No branches or pull requests

1 participant