I have been implementing a couple of threaded algorithms using QtConcurrent::blockingMap(indices, Functor). The functor utilizes AVX/AVX2 instructions for completing the algorithm. Using the Gallium driver on LLVMPipe, all 8 of my CPU cores are being used during the algorithm. When I switch to Gallium driver on swr, the CPU0 is the only cpu being utilized during the algorithm. Only thing different is the driver. Any ideas?
We've seen a similar problem with apps using TBB as their threading model. OpenSWR creates its thread pool when the OpenGL context is created and, by default, binds threads to physical cores. Two things you might try: 1) Create your application thread pool before creating the OpenGL context. 2) Set the KNOB_MAX_WORKER_THREADS environment variable to limit the number of threads that OpenSWR creates. This also tells OpenSWR to not bind threads to cores. Setting it to 0 may work in your situation and still enable the full number of OpenSWR threads.
I did some experimenting and created a similar situation. Try the KNOB, it should work for you. export KNOB_MAX_WORKER_THREADS=<# threads SWR can use> You might need to play with the number a little to get a good balance for your situation.
Any chance you've been able to try the suggestion I made (KNOB_MAX_WORKER_THREADS) to resolve this issue?
(In reply to Bruce Cherniak from comment #3) > Any chance you've been able to try the suggestion I made > (KNOB_MAX_WORKER_THREADS) to resolve this issue? Hi Bruce, my apologies for the late reply. Yes, I fired up this project today and tried setting the KNOB_MAX_WORKER_THREADS to the number of physical cores. I do get a balanced cpu load now, it definitely worked. Like you said, performance varies a bit with different values, so I will try and play with it.
I'm glad that works for you. We will continue to work on threading models that don't require external intervention for optimal performance. But, in the meantime, I'm going to close this bug as resolved. Please let us know of any other troubles you observe and thank you for your interest in OpenSWR.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.