Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Does DOTS physics tile the simulation to fit within CPU cache?

Discussion in 'Physics for ECS' started by Arowx, Feb 3, 2021.

  1. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Just reading about a Universe simulation system that achieves best performance when it tiles the simulation spatially so that each regional tile can fit within the CPU cache.

    Could or does DOTS physics do this to ensure maximum speeds?

    PS this approach could also benefit volume simulations e.g. particles/fluids.

    PPS does DOTS adapt it's chunk size limit to match hardware CPU cache size yet?
     
  2. milos85miki

    milos85miki

    Joined:
    Nov 29, 2019
    Posts:
    197
    Hi Arowx, thanks for reaching out with this suggestion! We're currently not looking at CPU cache size, but it's a good thing to aim for in future.

    In case you're interested in how UnityPhysics works: our broadphase uses 4way trees that are built based on body positions in the world. Then we overlap tree branches to get candidate collision pairs. After getting candidate pairs, we're batching them into phases, ensuring that no body appears in 2 pairs in the same phase. We also keep pairs with static bodies at the end, to make collisions with static a top priority (minimize the chance of penetration into a static body).