Cool VL Viewer forum http://sldev.free.fr/forum/ |
|
Different multi threaded sync strategy for AMD http://sldev.free.fr/forum/viewtopic.php?f=10&t=2335 |
Page 1 of 1 |
Author: | kathrine [ 2022-12-29 17:37:27 ] | ||
Post subject: | Different multi threaded sync strategy for AMD | ||
The patch tries to improve the sync strategy for multi threaded texture binding a bit, especially for AMD cards. The NVidia path enabled in the last version is not optimal on AMD, it prevents texture corruption but leads to hangs and grey textures while the pipeline is blocked on the syncs. The AMD driver does not handle the same thread sync as fast and efficient as the NVidia one, so it blocks for quite some time in the glWaitClientSync() and stalls the texture processing. The patch does the following things:
* Just delete the texture in the main thread if needed * Add the wait for the fence in the places where the mTexName is actually accessed, no need to block earlier I tested a bit with 512m draw distance and teleporting and running/flying around to new places and it felt pretty snappy. No grey or corrupted textures as far as i could see. Textures from snapshots and notecards worked nicely as well. Better than the old code for AMD at least, no stuttering. The code could be used for NVidia in the same way without issues. I do not know how good it works with the older AMD drivers, but with the current 22.11.2 driver it looked fairly stable.
|
Author: | Henri Beauchamp [ 2022-12-29 23:42:39 ] | ||||||||||||||||||||||||||||||||||||
Post subject: | Re: Different multi threaded sync strategy for AMD | ||||||||||||||||||||||||||||||||||||
EDIT: I found a better solution and kept your (excellent) idea for non-NVIDIA GPUs; the latter will still, by default, wait for the fence in the GL image creation thread, to avoid risking to stall the main thread GL pipeline at all, but I added a debug setting ("RenderGLImageSyncInThread") for them, in case people want to experiment with the new syncing algorithm. This allowed me to remove entirely the posting to the main thread work queue (simpler) while ensuring (via an atomic boolean test each time we use mTexName) that the tex name is swapped in the main thread when first needed. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |