Blender Git Loki

Kaikki Blender Git kommitit.

Page: 4017 / 8462

March 3, 2017, 16:42 (GMT)
Attempt to address nearly-starving cases.

Idea here is to reduce number of threads a pool is allowed to work on,
in case it does not get tasks quickly enough.

This does not seem to be really great result (have to only do the checks
once every 200 tasks pushed to avoid too much overhead), but I cannot
reproduce that nearly-starving case here so far. @sergey, curious if it
gives any difference on your 12cores with 14_03_G?
March 3, 2017, 16:42 (GMT)
Never starve main thread (run_and_wait) from tasks!
March 3, 2017, 16:42 (GMT)
Fix use-after-free concurrent issues.
March 3, 2017, 16:42 (GMT)
Some minor changes from review.
March 3, 2017, 16:42 (GMT)
Cleanup, factorization, comments, and some fixes for potential issues.
March 3, 2017, 16:42 (GMT)
Attempt to address performances issues of task scheduler with lots of very small tasks.

This is partially based on Sergey's work from D2421, but pushing the things
a bit further. Basically:
- We keep a sheduler-counter of TODO tasks, which avoids us to do any
locking (even of the spinlock) when queue is empty, in workers.
- We spin/nanosleep a bit (less than a ms) when we cannot find a task,
before going into real condition-waiting sleep.
- We keep a counter of condition-sleeping threads, and only use
condition notifications in case we know some are waiting on it.

In other words, when no tasks are available, we spend a bit of time in a
rather high-activity but very cheap and totally lock-free loop, before
going into more expansive real condition-waiting sleep.

No noticeable speedup in complex production scene (barbershop one), here
master, D2421 and this code give roughly same performances (about 30%
slower in new than in old despgraph).

But with testfile from T50027 and new depsgraph, after initial bake,
with master I have ~14fps, with D2421 ~14.5fps, and with this code ~19.5fps.

Note that in theory, we could get completely rid of condition and stay
in the nanosleep loop, but this implies some rather high 'noise' (about
3% of CPU usage here with 8 cores), and going into condition-waiting
state after a few hundreds of micro-seconds does not give any measurable
slow down for me.

Also note that this code is only working on POSIX systems (so no Windows, not
sure how to do our nanosleeps on this OS :/ ).

Reviewers: sergey

Differential Revision: https://developer.blender.org/D2426
March 3, 2017, 16:23 (GMT)
Fix own previous commit, sorry about that :(
March 3, 2017, 16:16 (GMT)
Get rid of `BLI_task_pool_stop()`.

Comments said that function was supposed to 'stop worker threads', but
it absolutely did not do anything like that, was merely wiping out TODO
queue of tasks from given pool (kind of subset of what
`BLI_task_pool_cancel()` does).

Misleading, and currently useless, we can always add it back if we need
it some day, but for now we try to simplify that area.
March 3, 2017, 16:12 (GMT)
Fix ugly mistake in BLI_task - freeing while some tasks are still being processed.

Freeing pool was calling `BLI_task_pool_stop()`, which only clears
pool's tasks that are in TODO queue, whithout ensuring no more tasks
from that pool are being processed in worker threads.

This could lead to use-after-free random (and seldom) crashes.

Now use instead `BLI_task_pool_cancel()`, which does waits for all tasks
being processed to finish, before returning.
March 3, 2017, 15:36 (GMT)
Update comment which was remained in an old place
March 3, 2017, 15:33 (GMT)
added multigrid preconditioner setup

dynamic and static obstacles are recognized and preconditioner is set accordingly
March 3, 2017, 14:53 (GMT)
Cleanup: Indentation
March 3, 2017, 13:35 (GMT)
Merge branch 'workspaces' into temp-workspace-multi-window

Conflicts:
source/blender/blenkernel/BKE_workspace.h
source/blender/blenloader/intern/versioning_270.c
March 3, 2017, 12:48 (GMT)
Edit Mesh overlay: remove one extra buffer.
March 3, 2017, 12:24 (GMT)
Fix T50842: NLA Influence Curve draws out of bounds when it exceeds the 0-1 range
March 3, 2017, 12:22 (GMT)
Fix error in vertex shader to make equal to fragment shader
March 3, 2017, 12:19 (GMT)
fix for hair particle system, was wrong hair distribution and render error

suppressed "dynamic" particle redistribution for hair now too
March 3, 2017, 12:17 (GMT)
Fix error in shader to avoid deformations when rotate viewport
March 3, 2017, 12:17 (GMT)
Use perfect squares as bounding box to get square UVs
March 3, 2017, 12:17 (GMT)
Add new fields when copy palette color
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021