[Bf-committers] SSE/AVX in cloth simulator

darkdefende at gmail.com darkdefende at gmail.com
Fri Dec 20 20:35:48 CET 2019

On Thu, Dec 19, 2019 at 06:28:36PM +0100, Mariusz Pluciński wrote:
> I definitely agree that replacing the algorithm by one able to utilize
> multiple cores or the GPU would be more beneficial. At the same time, it's
> simply much more work. My idea was rather aiming at a low-hanging fruit -
> better utilization of the single core with the algorithm we have right now,
> instead of a bigger effort of total overhaul.
I basically think that the current solver is a dead end as I don't think
that doing a lot of these micro optimisations will help that much.

The biggest bottleneck right now is the single threaded solver and it
seems like all modern cloth sim papers agree and has moved onto other
methods to be able to have fast and nice looking simulations.

However, you are of course free to do as you wish and try to optimize
the current code further. I'm just thinking it might be a bit counter
productive as I don't think there will be any significant speed up from

For examples in the papers I linked it has around 10-15 times the
performance of our old method (which will also scale with higher thread

At best, I would estimate you could perhaps get a 10% speedup with some
clever SSE or AVX usage.

> That sounds like an interesting idea! Although as usual, time may be a
> problem, but I would be anyway happy to help.

Of course! I have to admit I don't really know how much time testing and
integrating this new solver would take. But if you are willing to help
then that would be awesome!

> A problem on my side is also almost total lack of knowledge in the area of
> simulations. Which is also why I was thinking about low-level optimizations
> of the existing algorithm in the first place.

In this case the code as already been written for you. So I don't think
you need to have deep knowledge to do this.

I have to admit that I'm a bit rusty myself as it was quite some time
ago that I coded mass spring systems.

> How far are you with your solution so far?

I'm basically done with the research phase. I looked at what new sexy
cloth papers were available and if they would be easy to implement in

After some days I landed on the ones I linked previously. This is

1. Code is readily available to be run and tested
2. This is using the same mass spring system data structure as the
current implementation (so we can reuse it)
3. It SEEMS to behave well and offer real time interaction with the

The next step would be to just download the code from github and see if
it actually delivers in terms of performance and usability.

Sometimes things look awesome on paper, but in reality if has some very
major limitations that makes it just a chore to work with.

I don't know how much time I can spend on this during the holiday
season. So just building and playing around with the
implementation available on github would be really helpful.

Hell, if it works well, you could perhaps look into doing SSE and AVX
optimisations on that code base.

Sebastian Parborg

More information about the Bf-committers mailing list