Page MenuHome

Bad performance with texture painting depending on multi-thread settings
Open, Confirmed, LowPublic

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) triaged this task as Needs Information from User priority.

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.

tsui kin keung (tsuiking) reopened this task as Open.

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) raised the priority of this task from Normal to Confirmed, Medium.

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) changed Type from To Do to Bug.Wed, May 29, 12:46 PM
Brecht Van Lommel (brecht) raised the priority of this task from Confirmed, Medium to Confirmed, High.

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.Wed, May 29, 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.