Search Unity

Release of burst 1.0

Discussion in 'Burst' started by xoofx, Apr 16, 2019.

  1. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    417
    Hi All,

    We have just published the final version of burst 1.0, more than 90 releases since the first package published last year, that's quite a milestone!

    The compiler is able to generate, from a subset of C#, highly optimized native code, sometimes faster than their C++ equivalent, and an order of magnitude faster than regular C# code. In practice, this should give more creative opportunities in your games, which is awesome.

    We have been improving the quality of the compiler over the previous months and fixing any bugs as quickly - and correctly as possible. The overall quality has been improved thanks to all your feedback here and we appreciate.

    This is really just the beginning of our journey with burst, we plan to bring more performance and user oriented features in the coming months and years. Stay tuned!

    In case you are having an issue with this latest version let us know via a new forum message and a submit of your issue with Unity bug report system.

    Best regards
     
    Last edited: Apr 16, 2019
  2. siggigg

    siggigg

    Joined:
    Apr 11, 2018
    Posts:
    247
    Congrats on this huge milestone! :)
     
    xoofx likes this.
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Hi @xoofx, any plan to support burst compile job that has add/remove component?
     
  4. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    417
    Yes, we are working jointly with the DOTS ECS team to make this possible (hopefully for Q2)
     
  5. Deleted User

    Deleted User

    Guest

    Hi there.

    Any information to readup on burst best practises, optimization, vectorization etc?
     
  6. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    987
    Nice. Thanks for all your good work! We'll be using it heavily.
     
  7. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    private static readonly int3[] Corners = {
    int3(0,0,0), int3(0,0,1), int3(0,1,0), int3(0,1,1),
    int3(1,0,0), int3(1,0,1), int3(1,1,0), int3(1,1,1)
    };
    error: Creating a managed array `Unity.Mathematics.int3[]` is not supported by burst

    Is that a bug or in the todo list, or I should just use a static NativeArray ?
     
  8. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    987
    .NET arrays are managed so they're not allowed in HPC#.
     
  9. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    417
    It should work (but the error printed doesn't say if it is really on the declaration of the array or not), but it depends how it is used. You cannot for example pass this array around, you can only access it directly in a method... but we might a particular bug with int3 in your case, we will double check this.

    So this is something that we haven't communicated yet broadly, but burst has been supporting for a few release now constant managed arrays. You need to declare a static readonly field with the managed array, and you need to make sure that no C# code will modify the array outside of a burst job (C# doesn't support deep const/readonly unfortunately, you need to enforce it through a container). They can be used as constant lookup tables for example. They should work with primitive types as well as vector types and plain struct types (e.g no exceptions in their constructors).
     
  10. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    987
    Oh, that's cool then.
     
  11. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    More context for your investigations :

    Errors :
    • first an exception when accessing the array in a job
    • and then, lower in the console, this "error: Creating a managed array `Unity.Mathematics.int3[]` " is not supported by burst
    • I had those errors for int3[] float3[] int2[] and double3[], all static readonly
    Usage :
    • My arrays are private readonly, initialized in a static class 'C'
    • These private arrays are referenced in public static methods of this static class 'C'
    • I call these static methods in a foreach job
    • the job is in a JobComponentSystem class, private struct MyJob : IJobForEachWithEntity<X>
    • both the static class and the system are in the same namespace
    • and lastly, I'm using static Unity.Mathematics.math;
     
  12. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    Congratulations! we have seen 10-100x performance improvements with burst, making our old code obsolete, thanks!