Progress on 2.0

Discuss topics related to BEPUphysics or physics engine development.
Post Reply
User avatar
BrightBit
Posts: 19
Joined: Fri Jul 08, 2016 12:11 pm

Progress on 2.0

Post by BrightBit » Fri Jun 09, 2017 4:52 pm

Hey Norbo,

are there any updates regarding version 2.0 of your engine? I'm really looking forward to your next iteration so I just have to ask. :)

Greetings
BrightBit

Norbo
Site Admin
Posts: 4479
Joined: Tue Jul 04, 2006 4:45 am

Re: Progress on 2.0

Post by Norbo » Fri Jun 09, 2017 11:11 pm

It's moving along! I got a little quagmired in microoptimizations there for a while, but as of now the prototype has:
1) multithreaded solver with work scheduling that seems to do well on the NUMA-ish processors that are becoming more popular (Ryzen/Threadripper/Epyc, dual ring bus intel processors),
2) incremental memory layout optimization to scoot bodies and constraints around in an attempt to minimize cache misses and to lower the number of multithreaded sync points,
3) body pose integration,
4) a bunch of supporting infrastructure,
5) and as of this week, the beginnings of a new demos renderer and framework. The scale of the simulations involved are a bit too big for the ancient v1 renderer.

Unfortunately, even ignoring the fact that the renderer isn't done, it's a little hard to play with at the moment. The projects currently reference specific nightly build versions of .NET Core 2.0, and there are also some bugs with post build event macros in .NET Core projects that resulted in some hardcoded file paths. I'll address those once newer versions become available.

There's still quite a bit left to do, in no particular order:
1) pulling in the tree I wrote earlier for use as the broad phase,
2) building the new narrow/midphase (involving some new continuous collision detection work),
3) building the new deactivation system,
4) a new character controller that doesn't have gross teleportation-related quirks,
5) filling out the set of available constraints (so far, I've only implemented a ContactManifold4Constraint and BallSocket for testing the surrounding systems),
6) ... and I might feel compelled to rewrite the broadphase again to take advantage of some more recent things I figured out. It would be nice if virtually the entire engine execution time was spent in code capable of taking advantage of AVX512.

I'm hoping to get the basics of the collision detection pipeline in by the end of june. Ideally, that would include box, sphere, cylinder, capsule, cone, and triangle special cases. I'm putting a bit more effort into primitive-primitive special cases in v2 since they have the potential to be much, much faster. More general shapes like convex hulls, meshes, and compounds would follow afterward, but I can't improve them quite as much.

The performance situation is looking interesting, but I don't really want to get super specific with benchmark numbers until I have a bit more time to confirm realistic test cases- a full pipeline, rather than just a few bits and pieces- to make sure that I'm not just observing weird corner cases that won't generalize. But if what I'm seeing now is realistic and does generalize, well, it's a significant improvement :)

User avatar
BrightBit
Posts: 19
Joined: Fri Jul 08, 2016 12:11 pm

Re: Progress on 2.0

Post by BrightBit » Sat Jun 10, 2017 7:00 am

That sounds really interesting! I would love it so much to replace Unity's PhysX with your engine. Keep up the good work! :)

BTW: Are you working fulltime on your project? May I ask how you do this? Are you rich? ;)

Norbo
Site Admin
Posts: 4479
Joined: Tue Jul 04, 2006 4:45 am

Re: Progress on 2.0

Post by Norbo » Sat Jun 10, 2017 7:35 pm

I would love it so much to replace Unity's PhysX with your engine.
It occurs to me that I'm not entirely sure whether the newest versions of unity will actually be able to produce good code for System.Numerics.Vectors types. They couldn't yet fully jump to the .NET Core runtime last I saw, so it would be up to an upgraded mono runtime or IL2CPP to handle the codegen- unless this ends up growing beyond a hackweek project.

Even without explicit support, it's possible that IL2CPP's toolchain could do some kind of autovectorization. The inner loops of v2 should be very friendly to an autovectorizer, at least.

It would be pretty disappointing to have an order of magnitude performance penalty for running under unity. Have you (or anyone else) seen indications that the unity toolchain can emit SIMD instructions, apart from the mono runtime's own jit intrinsics?

Maybe I should poke some people once I have a convincing proof of concept :)
Are you working fulltime on your project? May I ask how you do this? Are you rich? ;)
Full-time, yes; rich, I wish :)

BEPUphysics v2 is basically just one building block in a larger and absurdly risky plan. But even if everything goes south, I probably won't be homeless :P

Norbo
Site Admin
Posts: 4479
Joined: Tue Jul 04, 2006 4:45 am

Re: Progress on 2.0

Post by Norbo » Mon Jun 12, 2017 3:53 pm

Regarding unity, this is pretty promising: https://twitter.com/xoofx/status/874258186597003264

User avatar
BrightBit
Posts: 19
Joined: Fri Jul 08, 2016 12:11 pm

Re: Progress on 2.0

Post by BrightBit » Mon Jun 12, 2017 5:57 pm

Norbo wrote:
Sat Jun 10, 2017 7:35 pm
Have you (or anyone else) seen indications that the unity toolchain can emit SIMD instructions, apart from the mono runtime's own jit intrinsics?
I don't know anything about that, sorry.
Norbo wrote:
Mon Jun 12, 2017 3:53 pm
Regarding unity, this is pretty promising: https://twitter.com/xoofx/status/874258186597003264
Well, that's good to read. I really wasn't expecting your engine not to be compatible with Unity, so I'm glad that there's still hope.

Norbo
Site Admin
Posts: 4479
Joined: Tue Jul 04, 2006 4:45 am

Re: Progress on 2.0

Post by Norbo » Mon Jun 12, 2017 7:52 pm

On the upside, in the worst reasonable case, it should still work- it just might not make full use of SIMD. Based on the numbers I'm seeing, it'll probably still be faster than V1, though :P

Norbo
Site Admin
Posts: 4479
Joined: Tue Jul 04, 2006 4:45 am

Re: Progress on 2.0

Post by Norbo » Tue Jun 27, 2017 7:38 pm

A tidbit regarding unity's future SIMD codegen:
https://www.youtube.com/watch?v=-jZdMFPACpU#t=1h26m45s

So it's looking pretty promising, at least. Even if it doesn't end up explicitly recognizing the jit intrinsics, hopefully it can recognize the available vectorization.

User avatar
BrightBit
Posts: 19
Joined: Fri Jul 08, 2016 12:11 pm

Re: Progress on 2.0

Post by BrightBit » Wed Jun 28, 2017 4:54 pm

Thank you. :) The time in the URL seems wrong, though. The video is just 1 hour and 24 minutes long. Did you mean 1:11:17?

Norbo
Site Admin
Posts: 4479
Joined: Tue Jul 04, 2006 4:45 am

Re: Progress on 2.0

Post by Norbo » Wed Jun 28, 2017 6:14 pm

Looks like it- I think they trimmed the first 15 minutes off :P

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest