Page MenuHome

Bad performance with texture painting depending on multi-thread settings
Closed, ResolvedPublic

Description

System Information
Windows 6 64bit, Nvidia Quadro K4000

Blender Version
Broken: Newest official 2.78c (hash e92F235283)

Short description of error

The more I have threads enabled, the slower the texture painting performance is.
I get best performance when setting the threads manually to 1, from render settings.
Maximum I can have is 24 threads.

Exact steps for others to reproduce the error

Make a cube, unwrap, make new image (4096 x 4096), enter texture paint mode, start painting.
Go to render settings and experiment with different thread settings.

My other possibly related settings:
Window Draw Method: Triple Buffer
Region Overlap enabled

Event Timeline

Dalai Felinto (dfelinto) lowered the priority of this task from Needs Triage by Developer to Needs Information from User.May 22 2017, 3:38 PM

Please attach a sample file as per the bug tracker instructions.

More than a week without reply. Due to the policy of the tracker archiving for until required info/data are provided.

I have the same problem.

System Information
os: Windows 10 64bit,
cpu: ryzen 7 1700,
gpu: amd rx480,
ram: 16 gb ram

Blender version:
2.79

Short description of error:
The performance will drop during texture painting on 3D view port if auto detection of threading is on.
The stroke will become laggy after several stroke. If I change the thread to 1, the performance will restore.
In addition, I change my threads manually, the lower number of threads, the better performance is.
P.s. threads:1 is the best and smooth.

Exact steps for others to reproduce the error:

Make a cube,
unwrap,
make new image (1024x 1024),
enter texture paint mode in 3d view port,
painting.
stroke become laggy after several stroke

File of my setting:

thanks.

Bastien Montagne (mont29) raised the priority of this task from Needs Information from User to Normal.Dec 30 2017, 11:45 AM

Yeah… threaded code of texpaint should probably be re-written, it’s not even using our scheduler, but launches it own set of threads.

And as we learned recently in another area (mesh normals computation), the more threads you have, the harder it is to get good results unless you manage to have totally lock-free code…

Will see if/when I can tackle that, but this is a TODO really, and am afraid this is not a top-priority task, for now I may just add an hard limit to the number of threads launched by that code (probably between 2 and 4 ?).

Bastien Montagne (mont29) changed Type from Bug to To Do.Dec 30 2017, 11:46 AM

Also… I cannot reproduce the issue here with current master nor with official 2.79 release (linux64bit, 8 threads, also tried forcing to 48 threads with no issue). So could be a problem specific to windows threading implementation… Can you please check in your system monitor whether all or some of your CPU cores are fully occupied when you paint and it becomes laggy?

Also… I cannot reproduce the issue here with current master nor with official 2.79 release (linux64bit, 8 threads, also tried forcing to 48 threads with no issue). So could be a problem specific to windows threading implementation… Can you please check in your system monitor whether all or some of your CPU cores are fully occupied when you paint and it becomes laggy?

Thank you for your prompt reply.
Here is the print screen for your reference.

Yep, so cores are from from fully occupied, which indeed hints at wasted time in locking…

I wanted to bring this issue up again. Noticed the same behavior. And it seems many other people are having massive performance issues with multithreading too.

I also noticed that on one machine the Window Draw Method set to Full also helped.
My machine:

  • Windows 10
  • Intel Core I5
  • Geforce gtx 750 ti
  • 16 gb ram

https://twitter.com/ndee85/status/1044231281045884929

I can confirm this issue.
https://twitter.com/martin_lindelof/status/1044481672710885376

Also it's present for me in 2.80, switching from Eevee render to Cycles, and under Performance lock it to 1 thread instead of Auto-detect. Painting improves.

Brecht Van Lommel (brecht) triaged this task as Confirmed, Medium priority.May 29 2019, 12:38 PM

I'd almost want to set this as high priority, but it's also not a new issue in 2.80.

From the profile in T58465#635130, I'm guessing this is due to a high cost of starting threads on Windows, and if so switching to the task scheduler could fix it.

@Bastien Montagne (mont29), could you try doing this? Would be great to have this fixed for 2.80.

Unless I'm missing something, this would not require major code changes. Just switching from the thread pool to task scheduler in project_paint_op, while leaving all the other threading logic untouched.

Brecht Van Lommel (brecht) raised the priority of this task from Confirmed, Medium to Confirmed, High.May 29 2019, 12:46 PM
Brecht Van Lommel (brecht) changed Type from To Do to Bug.

Eh, didn’t though that would be high prio, this has been buging us since ages… Though with many poeple enjoying tens of threads nowadays, I guess it’s becoming more of an issue.

Am happy to work on it yes, not sure how big of a task that is though. ;)

If it's a big task we can reconsider. But glancing at the code I did not immediately see a reason for this to be more than a local change in project_paint_op. Surely threading can be improved for texture paint in many ways, the only thing to solve here would be to avoid creating threads all the time.

Bastien Montagne (mont29) lowered the priority of this task from Confirmed, High to Confirmed, Low.

Will keep that task open, since that commit is not really great in the long run, proper refactor needs to be done here after 2.80 is out.

Brecht Van Lommel (brecht) changed Type from Bug to To Do.May 29 2019, 4:35 PM

@Antonio Vazquez (antoniov) confirmed on blender.chat that performance is much better now with multi-threading, so it appears the main performance issue on Windows is solved.

System Information
Operating system: Windows-10-10.0.17134 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 419.35 / 4 core 8 thread Intel i7 870 CPU / 16GB of RAM

Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-11 13:50, hash: rB06312c6d2db8
Worked: (optional)

Short description of error
It lags a lot when paiting in Texture Paiting.

Exact steps for others to reproduce the error
Either with a textured brush or simple brush, when I try to texture paint it freeeeezees like hell. I've tried to change the multi-thread option to 1 but is still happening. It lags in Solid mode, in lookdev mode, in 2.8, in 2.79, in 2.79b... It happens with a Principled BSDF shader applied, with the textures unplugged or plugged into the shader, in cycles, in eevee, in workbench, I really don't know what else to do. I think I have a pretty good PC (is old but powerful) that in my opinion should take care of these kind of tasks.

Also I have a bevel modifer and a Subsurf modifier applied. It lags less (but it still lags) if I dissable them or hide them.

Bastien Montagne (mont29) closed this task as Resolved.Jul 30 2019, 3:49 PM