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.
  2. Dismiss Notice

Burst compile "auto" mode vector ISA? (AVX, AVX2 or AVX512)?

Discussion in 'Burst' started by tigerleapgorge, Oct 28, 2019.

  1. tigerleapgorge

    tigerleapgorge

    Joined:
    Sep 17, 2019
    Posts:
    4
    Hi Unity devs,

    Trying to vectorize some game code on X64.
    Burst compile is set to "auto".
    I am wondering what's the actual target of auto: AVX, AVX 2 or AVX 512?

    I've combed through the documentation, the closest I can find is the example
    https://docs.unity3d.com/Packages/com.unity.burst@0.2/manual/index.html
    In here, it is using AVX2, not sure if that's the default or am I reading tea leaves?

    And to fellow game devs, do you recommend going up to AVX-512?
    The ISA extension has only been around since 2015,
    so I'd guess there still are gaming rigs out there not supporting it?
     
  2. siggigg

    siggigg

    Joined:
    Apr 11, 2018
    Posts:
    247
    With the Burst decompiler and some googling of instruction sets you should be able to see what instruction sets are being used?
     
    tigerleapgorge likes this.
  3. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    3,983
    Auto currently targets SSE code. Don't bother optimizing for AVX until Unity releases AVX intrinsics. Also, in the future, don't bother with AVX-512. It only works with Intel processors and needs to be crafted very carefully to keep the cores from reducing their clock speeds. AVX2 will be a good next step over SSE once Unity figures out how to build with it and not take SSE-AVX switch penalties.
     
    tigerleapgorge and sschoener like this.
  4. sschoener

    sschoener

    Joined:
    Aug 18, 2014
    Posts:
    73
    Actually, almost no-one will have AVX512. It's too recent and my understanding is that large parts of it are not aimed at commodity customers. You can get a good overview of what users have by checking Steam's hardware survey (go all the way to the bottom to Other Settings). Note that AVX512 is effectively at 0% adoption. As @DreamingImLatios said, SSE is the standard target and virtually all modern processors support SSE3 (or even SSE4), as is visible in the survey linked above :)
     
    tigerleapgorge likes this.
  5. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    It is currently SSE4. These modes are accessible only from the inspector, but beyond the disassembler view purpose, we have not yet figured out how to properly expose these CPU features as mentioned by others in this discussion, there are some penalties when using them. It is on our radar for Q1 next year.
     
    tigerleapgorge likes this.