What is the AOT burst compiler, and why should I care?

I just upgraded from Unity 2020 to 2021, and suddenly I’m seeing all kinds of stuff (aka warnings) about burst compilers. I have no idea what this is or why it’s important. I am only concerned that my project continues to build and run properly in Unity 2021 like it did in 2020.

So here are some questions…

  1. What is burst compiler?
  2. Why is it important/why should I use it?
  3. Is it something that can be disabled?

Thanks!

It’s a package you can remove.

“Burst is a compiler that translates from IL/.NET bytecode to highly optimized native code using LLVM. It is released as a Unity package and integrated into Unity using the Unity Package Manager.”

Right now, if you use a lot of jobs and highly parallel code and you are willing to refactor your code, there are possibly quite big speed gains to be found.

At the same time, it makes compilation times in the editor take even longer, and you also add an extra source of potential things to break when you are publishing your games to various platforms.

Yes, remove the package!

@Gillissie please could you take a screenshot of the warnings you’re seeing?

I posted somewhere else in the forums about the warnings, but here’s a screenshot. I guess it’s mainly just this warning that happens during builds. I’ve seen other threads about it where basically someone says “it’s a warning, so just ignore it”, but I don’t like that answer. It just makes me want to gut the burst compiler if it’s not working right, and I’m not using the features of it.

In addition to that warning, at runtime I also randomly see these errors, which also baffle me since I’m not using any native collections in my code. And of course, I can’t enable the full stack because the package required to do that isn’t available for Unity 2021, apparently.

A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.

I don’t see a package to remove…
7994094--1027398--Screen Shot 2022-03-25 at 10.45.38 AM.jpg

Hmm maybe it’s a dependency to something. There’s a show dependencies option somewhere in the package manager, see if burst shows up after you enable it and see what depends on it.

@tim_jones Here is another error that I get sometimes during the build process:

TLS Allocator ALLOC_TEMP_TLS, underlying allocator ALLOC_TEMP_MAIN has unfreed allocations, size 48
UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions)
gilligames.BuildOptions:buildClient (UnityEditor.BuildTarget) (at Assets/Code/Editor/BuildOptions.cs:115)
gilligames.BuildOptions:buildiOS () (at Assets/Code/Editor/BuildOptions.cs:17)

@tim_jones Here is another warning I get most of the time during the build process:

Exception occurred attempting to connect to Unity Cloud Diagnostics service. Native symbols will not be uploaded for this build. Exception details:
System.UriFormatException: Invalid URI: The URI is empty.
at System.Uri.CreateThis (System.String uri, System.Boolean dontEscape, System.UriKind uriKind) [0x0007b] in :0
at System.Uri…ctor (System.String uriString) [0x00014] in :0
at System.Net.WebRequest.Create (System.String requestUriString) [0x0000e] in :0
at UnityEditor.CrashReporting.CrashReporting.GetUsymUploadAuthToken () [0x0008e] in /Users/bokken/buildslave/unity/build/Modules/CloudServicesSettingsEditor/CrashReporting/Managed/CrashReporting.cs:82
at System.Uri.CreateThis (System.String uri, System.Boolean dontEscape, System.UriKind uriKind) [0x0007b] in :0
at System.Uri…ctor (System.String uriString) [0x00014] in :0
at System.Net.WebRequest.Create (System.String requestUriString) [0x0000e] in :0
at UnityEditor.CrashReporting.CrashReporting.GetUsymUploadAuthToken () [0x0008e] in /Users/bokken/buildslave/unity/build/Modules/CloudServicesSettingsEditor/CrashReporting/Managed/CrashReporting.cs:82
UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions)
gilligames.BuildOptions:buildClient (UnityEditor.BuildTarget) (at Assets/Code/Editor/BuildOptions.cs:115)
gilligames.BuildOptions:buildAndroidBundle () (at Assets/Code/Editor/BuildOptions.cs:25)

In my experience Unity will always put out warnings in some way or another that you have no control over, so forget about any ideas of implementing a zero warnings policy. I eventually simply toggle warnings off in the console and stop using them altogether, logging errors instead.

1 Like

If anyone is still facing this problem with Burst you could try turning its’ compiler off in Build Settings → Player Settings

2 Likes