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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[Burst] New release 1.3.0-preview.10, we need your feedback!

Discussion in 'Burst' started by xoofx, Apr 23, 2020.

  1. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Hello,

    Today we are pleased to release a new preview version of Burst 1.3.0-preview.10

    The 1.3.0 version is bringing several new features, improvements as well as bug fixes from 1.2.0, more specifically:

    • Cross-compilation support for desktop platforms (e.g Compile Burst for Windows from a macOS)
    • Cache of Burst JIT compiled results in the Editor to the disk, so that reloading after an editor restart should be faster
    • Native debugging support (a video tutorial here)
    • A new x86 Intrinsics API (more documentation here)
    • Several improvements of codegen quality with improved no-alias analysis (that should improve auto-vectorization)
    • A partial support for Debug.Log, string and string interpolation (more documentation here)
    • The Burst Inspector now loads asynchronously without blocking the UI
    • Show a popup window if you upgrade Burst to restart the editor
    • Various bug fixes and improvements

    We hope to release a last preview early next week, and would like to release a stable early in May, but we need to make sure that we are not missing any critical bugs that might affect your current workflow with Burst.

    So please, let us know if you have any issues with this new version, try it and give us some feedback!

    On behalf of the Burst Team.
    Alexandre
     
    psuong, Nyanpas, bobbaluba and 24 others like this.
  2. apaxnid

    apaxnid

    Joined:
    Nov 18, 2012
    Posts:
    34
    Would gladly try this new version if only any version higher 1.3.0-preview.7 didn't end up in a crash:(
     
  3. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    First, have you tried it? Because this version might fix actually the crashes you had in preview8/9... It's a chicken egg problem here ;)

    Secondly, have you filled an issue for that crash with your project or have you been able to make/isolate a simple repro it? Having the sole feedback "it crashes" is really difficult for us to help you to solve your issue.
     
  4. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    Would be good to add to Known Issues that NativeArrays don't work in Function Pointers.
     
  5. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    Exception: This method should have been replaced by codegen

    Still getting this error (and i got this error since like half a year already) .. i posted this in the forum but no one answered

    This lambda is executed whenever Observable.Interval(TimeSpan.FromSeconds(WorldManager.Instance.CleanupTime))
    is outputting a number

    Code (CSharp):
    1. listener.RegisterOnEvent("name",
    2.                 Observable.Interval(TimeSpan.FromSeconds(WorldManager.Instance.CleanupTime)),
    3.                 (l, inputDeps) =>
    4.                 {
    5.                     LoggerSystem.Log("Cleanup");
    6.  
    7.                     var cmdBuffer = commandBufferSystem.CreateCommandBuffer().ToConcurrent();
    8.  
    9.                     var middlePoint = GetSingleton<MiddlePointSingleton>().Value;
    10.  
    11.                     var gridSize = WorldManager.Instance.GridSize;
    12.                     var planeSize = WorldManager.Instance.PlaneSize;
    13.  
    14.                     Entities.WithBurst()
    15.                         .WithStructuralChanges()
    16.                         .ForEach((Entity entity, int index, ref PlanePosition position) =>
    17.                         {
    18.                             if (!IdMath.IsPositionInsideCurrentMiddlePoint(position.Position, middlePoint, gridSize,
    19.                                 planeSize))
    20.                             {
    21.                                 cmdBuffer.DestroyEntity(index, entity);
    22.                             }
    23.                         });
    24.  
    25.                     commandBufferSystem.AddJobHandleForProducer(inputDeps);
    26.  
    27.                     return inputDeps;
    28.                 });
    if i replace the Entities.Foreach method with an already deprecated
    IJobForEachWithEntity then it works...

    EDIT: behind the scenes in RegisterOnEvent(), ill wrap the whole thing in a lambda again... so i have like 2 nested lambdas
     
  6. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Could post this separately from this thread? This issue is not related to Burst but I suspect is due to Entities ForEach code rewritting.
     
  7. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    My bad you are right! I somehow thought this is related to burst, but ofc its related to entities
     
  8. apaxnid

    apaxnid

    Joined:
    Nov 18, 2012
    Posts:
    34
    Yes I Have tried it. I have filled an automatic crash report once. I tested with the default urp template project. With 1.3.0-preview.7 everything is fine. After i update to preview.10 i get this errors
    Code (CSharp):
    1. System.InvalidOperationException: Burst failed to compile the function pointer `Int32 DoGetCSRTrampoline()`
    2.   at Unity.Burst.BurstCompiler.Compile[T] (T delegateObj, System.Boolean isFunctionPointer) [0x00132] in C:\Users\apaxn\Unity Projects\Test\Library\PackageCache\com.unity.burst@1.3.0-preview.10\Runtime\BurstCompiler.cs:176
    3.   at Unity.Burst.BurstCompiler.CompileFunctionPointer[T] (T delegateMethod) [0x00000] in C:\Users\apaxn\Unity Projects\Test\Library\PackageCache\com.unity.burst@1.3.0-preview.10\Runtime\BurstCompiler.cs:81
    4.   at Unity.Burst.Intrinsics.X86.CompileManagedCsrAccessors () [0x00000] in C:\Users\apaxn\Unity Projects\Test\Library\PackageCache\com.unity.burst@1.3.0-preview.10\Runtime\Intrinsics\x86\Csr.cs:191
    5.   at Unity.Burst.Editor.BurstLoader..cctor () [0x00198] in C:\Users\apaxn\Unity Projects\Test\Library\PackageCache\com.unity.burst@1.3.0-preview.10\Editor\BurstLoader.cs:147
    6. UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])
    7.  
    8. InvalidOperationException: Burst failed to compile the function pointer `Void AddComponentEntitiesBatchExecute(Unity.Entities.EntityComponentStore*, Unity.Collections.LowLevel.Unsafe.UnsafeList*, Int32)`
    9. Unity.Burst.BurstCompiler.Compile[T] (T delegateObj, System.Boolean isFunctionPointer) (at Library/PackageCache/com.unity.burst@1.3.0-preview.10/Runtime/BurstCompiler.cs:176)
    10. Unity.Burst.BurstCompiler.CompileFunctionPointer[T] (T delegateMethod) (at Library/PackageCache/com.unity.burst@1.3.0-preview.10/Runtime/BurstCompiler.cs:81)
    11. Unity.Entities.StructuralChange.Initialize () (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities/EntityManagerChangeArchetype.cs:65)
    12. Unity.Entities.EntityManager..ctor (Unity.Entities.World world) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities/EntityManager.cs:162)
    13. Unity.Entities.World..ctor (System.String name, Unity.Entities.WorldFlags flags) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities/World.cs:145)
    14. Unity.Entities.DefaultWorldInitialization.Initialize (System.String defaultWorldName, System.Boolean editorWorld) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:101)
    15. Unity.Entities.DefaultWorldInitialization.DefaultLazyEditModeInitialize () (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:219)
    16. Unity.Scenes.SubScene.OnEnable () (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Scenes.Hybrid/SubScene.cs:181)
    Then, after editor restart the moment I create SubScene or put an empty object in scene with convertToEntity script and press play editor crashes.
     
  9. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    Seems like entities 0.7 (the newest version for Unity 2019.3) are not fully compatible for il2cpp:
    Code (CSharp):
    1. The method `Int32 CalculateEntityCountExecute(Unity.Entities.UnsafeMatchingArchetypePtrList ByRef, Unity.Entities.EntityQueryFilter ByRef)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    2. The method `Int32 CalculateChunkCountExecute(Unity.Entities.UnsafeMatchingArchetypePtrList ByRef, Unity.Entities.EntityQueryFilter ByRef)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    3. The method `Void AddComponentEntitiesBatchExecute(Unity.Entities.EntityComponentStore*, Unity.Collections.LowLevel.Unsafe.UnsafeList*, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    4. The method `Boolean AddComponentEntityExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.Entity*, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    5. The method `Void AddComponentChunksExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.ArchetypeChunk*, Int32, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    6. The method `Boolean RemoveComponentEntityExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.Entity*, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    7. The method `Void RemoveComponentEntitiesBatchExecute(Unity.Entities.EntityComponentStore*, Unity.Collections.LowLevel.Unsafe.UnsafeList*, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    8. The method `Void RemoveComponentChunksExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.ArchetypeChunk*, Int32, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    9. The method `Void AddSharedComponentChunksExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.ArchetypeChunk*, Int32, Int32, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    10. The method `Void MoveEntityArchetypeExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.Entity*, Void*)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    11. The method `Void SetChunkComponentExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.ArchetypeChunk*, Int32, Void*, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    12. The method `Void CreateEntityExecute(Unity.Entities.EntityComponentStore*, Void*, Unity.Entities.Entity*, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
    13. The method `Void InstantiateEntitiesExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.Entity*, Unity.Entities.Entity*, Int32)` must have `MonoPInvokeCallback` attribute to be compatible with IL2CPP!
     
    Last edited: Apr 24, 2020
  10. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    677
    The newest compatible with 2019.3 is 0.9.1
     
  11. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    Oh ye, thanks, somehow my brain started mixing urp requirements with entities.
    After updating all packages there are no errors anymore.


    One difference I found compared to 1.2.3 is that lib_burst_generated.dll is generated to "Plugins/x86_64" folder even when all other dlls go to "Plugins/" folder. I have to manually move over everything to one folder otherwise project won't work.

    In 1.2.3 everything went to "Plugins/" folder and run correctly. I'm building for x86_64 Windows.
     
    Last edited: Apr 24, 2020
  12. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    863
    Tried it, looks like everything is working as expected (including builds without C++ build tools).
     
    xoofx likes this.
  13. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Do you have a case id we could have a look? I'm not sure we have seen your bug reported to our team through the bug report. Otherwise, could you send it again and give us here the case id so that we won't miss it?
     
  14. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    254
    thank you for the hard work!
     
  15. apaxnid

    apaxnid

    Joined:
    Nov 18, 2012
    Posts:
    34
    Case 1240586 older one, Case 1241175 new
     
  16. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Thanks, we will have a look at them.

    So the case 1240586, I can see it, but it was filed 2 days ago, and these are triaged by QA and it takes usually a bit of time to reach our team. For now it is not affected to any team. If you want an issue to be notified more directly to us, you can open a new discussion forum, make your forum post about "[Burst] My issue xxx", and link to your case - with some more context if you want and we will able to look at it more quickly.
     
  17. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Which version of Unity are you using? If you don't have the latest (e.g 2019.3 move to a more recent version of it), You should update your Unity otherwise it is indeed going to not load the plugins correctly (or it might not load Burst at all).

    There was a bug in Unity for native plugins and they have fixed this (to take into account CPU in the output folder), but it made a breaking change for Burst that required us to release also a new version of Burst to be compatible with these new folder layout.
     
  18. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    And just to make sure, 1241175 is a duplicate of 1240586 correct? (and so we could close one of them)
     
  19. apaxnid

    apaxnid

    Joined:
    Nov 18, 2012
    Posts:
    34
    Basically yes, but they were made with different engine versions.1240586 with 2020.2 and don't have project files,1241175 was made with 2020.1 and include project file.
     
  20. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Good, thanks for the precision, we will have a look.
     
  21. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    Going to 2019.3.10 from 2019.3.3 fixed the issue, all dlls go to x84_64 folder, thanks!

    The "xms elapsed" (since last brake point) makes it better for performance testing than normal debugger. I wish that would also work for non-bursted code.
     
    Lee_Hammerton likes this.
  22. Soaryn

    Soaryn

    Joined:
    Apr 17, 2015
    Posts:
    327
    @xoofx would the limited string support, support equivalencies?
    Example, I have a ref BlobString variable within a job, can I either:
    • switch(variable) with string literals as cases?
    • check if(variable.Equals( $"some context + {arg}"))
    • Or some way to pull the string out of the blob string to do the previous two in burst?
    Realistically in my case I have immutable strings in BlobAssets in the form of BlobStrings. I know in a job what the string should be or can construct the matching string, but I'd like to compare a blobstring contents with a string literal if possible.
     
  23. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Oh, we were not made aware about this BlobString actually and so it was under the radar, thanks for bringing this. We will forward this to the team handling this type to check with them if they could provide methods on it to work with e.g FixedString. Though switch(variable) won't be possible, but otherwise BlobString should provide the relevant method to interact with FixedStrings (not sure it is possible e.g in terms of package dependencies...)
     
  24. Soaryn

    Soaryn

    Joined:
    Apr 17, 2015
    Posts:
    327
    Awesome! Being able to move most of my system to Burst would be amazing! Strings are pretty much the largest component of the current limitations. The switch statement was mostly a hopeful thought, but understandable as to why it isn't necessarily supported :)

    Also out of curiosity, would being able to compare NativeStrings to FixedStrings be a feasibility in burst?
     
  25. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    282
    I'm not an expert on either `FixedString` or `NativeString`, but you may be able to do something like:

    Code (CSharp):
    1. NativeString32 nativeString = ...;
    2. byte* nativeStringPtr = &nativeString.buffer.byte0000;
    3.  
    4. FixedString32 fixedString = ...;
    5. byte* fixedStringPtr = (byte*)&fixedString.bytes;
    6.  
    7. bool areEqual = UnsafeUtility.MemCmp(nativeStringPtr, fixedStringPtr, length);
     
  26. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Burst is mostly not involved in that. It's more about having NativeStrings/FixedStrings to provide a burst compatible/HPC# API. Burst is only involved with strings when the code is using a managed string literal and this string is used in certain scenarios (as listed by the documentation).

    But I have forwarded this to the team responsible for NativeString/FixedString.
     
  27. sl1nk3_ubi

    sl1nk3_ubi

    Joined:
    Aug 21, 2019
    Posts:
    15
    Hello there!

    Having Debug.Log support in burst was much needed, so this is a pretty good addition!
    Would it be possible in the future to forward managed string literals to our own static methods without converting to FixedString somehow?

    Having Debug.Log support is awesome, but in our case we often have wrappers around the Log API (e.g. for conditional compilation or to redirect logging) so we would want to pass the string around in a method call and only format later on if needed, or store that in a ring buffer for later processing.
    Having to deal with FixedStrings for what is essentially a constant fixed array of chars feels weird, essentially we would want the same functionality as Debug.Log() but without using Debug.Log, and we can deal with any limitation such as not using any string methods or storing the string in a native array format :)


    Other than that, I also have some general feedback regarding using burst with Entities.ForEach, which might not be *directly* related to burst, so I'll quickly mention them:
    • NativeArray<T> would benefit from ref indexer ("ref T this[int index]"), something we can already do with UnsafeUtilityEx.ArrayElementAsRef<T>() but having it directly in the NativeArray would be nice
    • Would also be nice if we could force the capture of variables by copy in lambdas (something like [=]() { } in C++) instead of having to declare copies in the calling method, though I understand that this may become error-prone as it bends the language even more, but oh well, we're already far enough, aren't we? :)

    Thanks!
    Christopher.
     
  28. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    299
    hi @xoofx, are you able to give any update on cross-platform deterministic floats in the Burst compiler? Is it still being worked on?
     
  29. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    282
    > are you able to give any update on cross-platform deterministic floats in the Burst compiler? Is it still being worked on?

    @jdtec it's not something we're working on right now. It's definitely a feature we want to do (maybe later this year), but it's a significant piece of work and (so far) not as high priority as the other things we're working on. We do listen to feedback though so it's useful to hear that it's something you're interested in.
     
    jdtec likes this.
  30. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    299
    tim_jones likes this.
  31. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,647
    After updating from p7 to p10, one of our developers is now getting a

    Unhandled exception at 0x00007FFFE18F171D (2434e8347f5ac492b9b5fcdc29e9a4d5.dll) in crash.dmp: 0xC000001D: Illegal Instruction. occurred

    crashing his editor every time he tries to play.

    The line of assembly looks like this

    upload_2020-4-29_21-52-32.png

    He's using an older i5-3470 which doesn't support avx2, but it seems to be using it for him in editor anyway?
     
    Last edited: Apr 29, 2020
  32. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    Hey @tertle - this is my bug. Basically when I added the F16C intrinsics in preview.8 I think it was I broke the check for AVX2 such that if the CPU supports F16C it enabled AVX2, sorry :(

    It'll be fixed in preview.11 which I hope we can get out this week.
     
    vildauget, sebas77, tertle and 3 others like this.
  33. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    Maybe you had same issue. @apaxnid what's your cpu?
     
    sheredom likes this.
  34. apaxnid

    apaxnid

    Joined:
    Nov 18, 2012
    Posts:
    34
    I have corei7 3630qm and I got an answer to my issue:)
     
    sheredom likes this.
  35. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I filed 1237423 for preview9 which is a crash with sub scenes and it still shows as open. Was also a thread on this. Any ETA on when a fix will land?
     
  36. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    282
    This looks like the same issue that @sheredom mentioned above. We hope to have 1.3.0-preview.11 out very shortly, with a fix for this.
     
  37. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    wg-siggig, tertle and tim_jones like this.
  38. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    preview-11 after restarting at first didn't compile my jobs. I had burst safety check off. Turned them on and went into play mode and it crashed. Editor logs didn't show much stack trace had a single unhelpful line.

    Just did that once on me so far, maybe had issues with cached old data or something?

    Sub scenes didn't crash on me.
     
  39. apaxnid

    apaxnid

    Joined:
    Nov 18, 2012
    Posts:
    34
    sheredom likes this.
  40. andrewoconnor

    andrewoconnor

    Joined:
    Jul 12, 2016
    Posts:
    1
    I'm getting a crash any time I try and use the X86.Avx.mm256_cvtepi32_ps intrinsic. Simply viewing it in the Burst inspector crashes Unity. Using preview 12 now, 2020.1.0b8. Case ID is 1245193
     
  41. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Thanks, we will have a look. We will probably include a fix in 1.3.1, as it is not a critical/core issue. We hope to release 1.3.0 final next week or so.
     
    eizenhorn likes this.
  42. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    412
    Actually we shipped a small bug fix 1.3.0-preview.13 release yesterday so it should hopefully be fixed.