Legion ECS Discussion

(Alec Thilenius) #62

Draft of a Transform system implemented in Legion: https://github.com/AThilenius/legion_transform

Would very much appreciate comments / issues!

Mechanism to sub-dispatch group of systems
(Zicklag) #63

@Xercsess That’s awesome! Not sure when I will be able to, but I can’t wait to try it out. :smiley:

@dakom This was something you were needing in Legion, too.

(BenzzZX) #64

The DepthTag can cause fragmentation.
Unity implemented transfrom system with it but then refactored their code to get rid of it.

(Alec Thilenius) #65

@BenzzzX Noted, ty! :slight_smile: That’s an implementation detail, so for now I’m going to leave it in as it’s already part of the prototype; it’s an easy thing to change later. I’ll take a peak at the Unity ECS source some time to see if I can figure out what they replaced it with. I think parallelism gets a bit harder without the tags (excluding specialized Legion support) but fragmentation would for sure be an issue which might negate the parallelism support in the end.

(Jaynus) #66

@zicklag and all others interested.

I have the working systems and resources implementation of legion in my branch:

This branch is being updated as I need it, but updates have slowed down so I consider it close to API-complete.

This is being used to integrate into my …drum roll…port of amethyst to legion.

A few caveats:

  • This implementats a SHIM syncing system between specs and legion to allow for easier porting. This moves all resources back-and-forth between specs and legion on the legion execution boundary. Additionally, all entities are cloned between the worlds.
    • This means there is some overhead for now, but at least I can much more quickly and fluidly work on porting
  • I am in the process of porting systems. You can see this in amethyst_rendy at the moment.

You can see my current active work at porting amethyst_rendy here: https://github.com/jaynus/amethyst/tree/legion/amethyst_rendy/src/legion

Obviously, help at this point would be great, as its a slow slog through systems.


(Zicklag) #67

Whaat!! That’s awesome! Good job @jaynus and everybody else who helped! That is very exciting to see, and good idea bout the interim syncing solution. :tada:

I’m not sure if I will be able to, but if I do get the time I will definitely look into helping out.

(Alec Thilenius) #68

Maybe not the right spot for this but…

Unity is pulling some seriously impressive performance out of their new ECS. This is done with an chunked archetypical ECS, just like Legion. Side-by-side with the ECS is the ‘burst compiler’. Burst is essentially an LLVM front-end for a subset of IR, but where I think it has great potential is it’s ability to force vectorization on loops. Combined with chunked ECS, you can get very significant speedups on SIMD hardware (which is all hardware these days).

Now Unity has it hard because they have to interop with their old messy ‘Behavior’ layout, and they are stuck with C#, which is a great language but you can absolutely alias memory in it. So they have to restrict things to prevent that. Rust solves most (all?) of the aliasing issue out the gate; afaik safe run cannot alias memory (apart from RO aliases) because of the borrow checker.

My question is: how much of the advantages ‘burst’ brings to the table do we get for free with the borrow checker + LLVM, and how much could be improved upon? Can Rust guarantee no aliasing and can it improve on something like C++ which is very hit-or-miss on if LLVM can vectorize it?

Mechanism to sub-dispatch group of systems
(Swarnim Arun) #69

I am not good enough to answer about the topic but here are links to the Burst Compiler Presentation and details(might save someone else the time),


1 Like
(Jaynus) #70

Linking the RFC here: https://github.com/amethyst/rfcs/issues/22

(Erlend Sogge Heggen) split this topic #71

5 posts were split to a new topic: Mechanism to sub-dispatch group of systems