Multithreaded shader compilation #6132
-
Hello everyone! I am switching from On my machine, it takes from 0.18s to 0.5s to init a global session, and as I understand, the creation of a global session basically means loading a Slang.dll and other dynamic libraries. Since global session init takes quite a lot of time, I wouldn't want to create a global session per shader, nor would I want to create a global session per thread (if it's even possible). If I can safely reuse a single global session for concurrent shader compilation on multiple threads, do I need to create a local session per shader? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
At the moment we don't support calling global session functions concurrently, so you will still need to create one global session per thread, or use a pool of global sessions and ensure only one thread is using a global session at a time. We would like to improve this situation by allowing sharing a single global session, and allow working on different ISessions concurrently as the next step. However we don't have a timeline for this improvement. However, if anyone feel like contributing a patch to make the API more multi-threading friendly, we are happy to share more technical details and work together with you to make it happen sooner. |
Beta Was this translation helpful? Give feedback.
-
So, does it mean that using |
Beta Was this translation helpful? Give feedback.
At the moment we don't support calling global session functions concurrently, so you will still need to create one global session per thread, or use a pool of global sessions and ensure only one thread is using a global session at a time.
We would like to improve this situation by allowing sharing a single global session, and allow working on different ISessions concurrently as the next step. However we don't have a timeline for this improvement.
However, if anyone feel like contributing a patch to make the API more multi-threading friendly, we are happy to share more technical details and work together with you to make it happen sooner.