-
Notifications
You must be signed in to change notification settings - Fork 576
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
Converting Vulkan target to support executable-create2. #18306
Conversation
ac9af1f
to
e0bca76
Compare
(lit test failures are expected during the transition) |
// NOTE: vkCreateComputePipelines takes multiple pipelines but doesn't speed up | ||
// creation on any known driver; we process one at a time so that we can get | ||
// better error messages and multithread the pipeline creation ourselves. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting - did you run those speed tests / benchmarks yourself, or did other people report that somewhere? (I'll buy the point about error messages, but startup time is pretty important for us, so would prefer to have high confidence that what we're doing is optimal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, drivers are not required and don't multithread pipeline creation internally (as a general rule Vulkan drivers don't maintain their own thread pools in user mode). The only savings is on the call into the driver which is tiny compared to actual creation and shader JIT that usually happens.
From the Vulkan guide:
For compiling pipelines, vkCreateShaderModule and vkCreateGraphicsPipeline are both allowed to be called from multiple threads at once. A common approach for multithreaded shader compilation is to have a background thread dedicated to it, with it constantly looking into a parallel queue to receive compilation requests, and putting the compiled pipelines into another queue that then the main renderthread will connect to the simulation. This is very important to do if you want to have an engine that doesn’t have a lot of hitching. Compiling shader pipelines can take a very long time, so if you have to compile pipelines at runtime outside of a load screen, then you need to implement such a multithreaded async compile scheme for your game to work well.
This produces a new flatbuffer that supports multiple shared modules per HAL executable, reorganizes per-export information to be per-export, and swaps HAL pipeline layouts with internal Vulkan pipeline layouts that are constructed from metadata in the flatbuffer. This is a startup time regression for as long as we are not linking modules because descriptor set and pipeline layout reuse now happens per executable and not per VM context. The fix is to link modules together.
e0bca76
to
f6a6122
Compare
a69a93b
to
72abbc7
Compare
This produces a new flatbuffer that supports multiple shared modules per HAL executable, reorganizes per-export information to be per-export, and swaps HAL pipeline layouts with internal Vulkan pipeline layouts that are constructed from metadata in the flatbuffer.
This is a startup time regression for as long as we are not linking modules because descriptor set and pipeline layout reuse now happens per executable and not per VM context. The fix is to link modules together. I am not sure why that was never done :/
Progress on #18154.