Burst for standalone players

Hello,

As part of the 2018.2 release of Unity, we are pleased to release an official preview of the burst package with support for standalone players (i.e AOT mode of burst) which is only working with 2018.2+

This version **0.2.4-preview.20** is now accessible from the package manager:

3558840--286611--upload_2018-7-10_15-55-0.png

User Documentation

There is a documentation available through the burst package. This is an early preview. We expect to give more insights on how to better use burst to improve the performance of your games.

Support for standalone players

When building a player, burst will compile a single dynamic library for all the burst jobs in your game. Depending on the platform, the dynamic library will be output to a different folder (on Windows, it is in the path Data/Plugins/lib_burst_generated.dll)

This library will be loaded by the Job system runtime on the first job compiled by burst.
The settings to enable the compilation are controlled by the Jobs/burst menu, the same way than for the editor.
In a future iteration, these settings will be moved to proper settings per platform/player.

Supported platforms

This release is supporting the following platforms for standalone players:

  • Windows
  • MacOS
  • Linux
  • Xbox One
  • PS4
  • Android (ARM v7 and v8+)
  • iOS (ARM v7 and v8+)

Note that most platforms using Intel x64 processors should be working quite flawlessly. For the mobile platforms, this is something really new and you might encounter bugs for these platforms. Please let us know by reporting them via the Help menu and select Report a bug.

Known issues

We still have a few known issues with this release for standalone players support:

  • Accuracy/Precision are currently not supported
  • The target CPU is currently hardcoded per platform (e.g SSE4 for Windows 64 bits)

These issues will be resolved in a future release of burst.

Please note also that the latest release of ECS 0.0.12-preview.8 is not using this version of burst. A new version of ECS will be published in the coming days with the latest burst.

4 Likes

FIRST! :P can it be used outside the job system? if so I will test it asap

1 Like

Can it be used with the Incremental Compiler? Or does it has any issue ?

1 Like

Not for this version unfortunately. There are a few issues that prevented to release this feature in this release. Can’t tell exactly when these will be resolved.

2 Likes

[quote=“LordDarkon76”, post:3, topic: 707571]
Can it be used with the Incremental Compiler? Or does it has any issue ?
[/quote]

Afaik, it should work with it. Burst doesn’t work at C# compiler stage but by later post processing compiled .NET assemblies.

[quote=“xoofx”, post:4, topic: 707571]
Not for this version unfortunately. There are a few issues that prevented to release this feature in this release. Can’t tell exactly when these will be resolved.
[/quote]
Apparantently I will be the last one to try it :smile:

Is there an ETA on Burst for Nintendo Switch?

Does it work with jobs outside of the ECS? I successfully used the job system for procedural Generation and now I want to experiment with the burst compiler as well. I added the package and put the [BurstCompile] attribute over a job struct, but it can't compile as it can't find the attribute. The only attribute found is BurstDiscard.

I'm on 2018.2 and use the incremental compiler and assembly definition files.

Burst can be used without ECS. You need to include the Burst package in the package manager.
(ECS package automatically includes a dependency on Burst)

Thanks for the answer, but like I said, I have the package already installed from the package manager. The file is even there in the project browser, but even with including "Unity.Burst" the compiler can't seem to find the attribute. The Editor Tools coming with the Burst package seem to run fine though. I can open the Burst Job Inspector and so on. I simply can't compile any jobs, as the BurstCompile attribute is not recognized for some weird reason. I have the suspicion it might be related to assembly definition files, but I am not sure.

3581964--289649--BC_Issue_01.png 3581964--289650--BC_Issue_02.png 3581964--289651--BC_Issue_03.png

1 Like

If your code is in a assembly definition file then you need to create a dependency / assembly reference to "Unity.Burst"

Any ETA on when the assemblies from packages will be available in the selection menu for references? Right now, in order to add a dependency to Unity.Burst, you have to open the asmdef file in a text editor.

1 Like

you can drag it from the project folder if you have 2018.2 (under "Packages")

Ah that makes sense, thank you. I already thought about doing that, but as it didn't show up in the drop down menu, I thought it might not be the case. Thank you very much!

Maybe add to the documentation that Windows SDK and VC++ toolset has to be installed in order for burst to work in builds.

1 Like

[quote=“bgrz”, post:15, topic: 707571]
Maybe add to the documentation that Windows SDK and VC++ toolset has to be installed in order for burst to work in builds.
[/quote]

Thanks, and good idea! However, even after installing the sdk and vc++ I still get this error.I am on windows 10, VS2017, Unity 2018.2.2f1 and on Burst 0.2.4-preview.23

Exception: C:\Users\GreatAce\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.burst@0.2.4-preview.23\.Runtime\bcl.exe did not run properly!
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:130)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
Unity.Burst.Editor.BurstAotCompiler.OnPostBuildPlayerScriptDLLs (UnityEditor.Build.Reporting.BuildReport report) (at C:/Users/GreatAce/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.burst@0.2.4-preview.23/Editor/BurstAotCompiler.cs:215)
UnityEditor.Build.BuildPipelineInterfaces.OnPostBuildPlayerScriptDLLs (UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:452)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

System.NotSupportedException: Burst compilation for standalone, is only supported with a suitable compiler tool chain. (C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
Visual Studio 2010 with C++ compilers and Windows 7 SDK (it cannot build C++ code because it is not installed)
Visual Studio 2010 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\10.0_Config\InstallDir" in the registry
Windows 7 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\InstallationFolder" in the registry

Visual Studio 2013 with C++ compilers and Windows 8.1 SDK (it cannot build C++ code because it is not installed)
Visual Studio 2013 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\12.0_Config\InstallDir" in the registry
Windows 8.1 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1\InstallationFolder" in the registry

Visual Studio 2015 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
Visual Studio 2015 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry
Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry

Visual Studio 2017 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
Visual Studio 2017 installation is found using Microsoft.VisualStudio.Setup.Configuration COM APIs
Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry

).
at Burst.Compiler.IL.Aot.AotLinker.Link(IEnumerable`1 objFiles, String outPath)
at Burst.Compiler.IL.Aot.AotCompiler.Link(Module module, AotCompilerOptions compilerOptions)
at Burst.Bcl.Program.Main(String[ ] args)

These are the components I installed to remedy above error some months ago:

3587345--290361--upload_2018-8-5_20-41-35.png

I don't remember the defaults, but perhaps the CLI (command line interface) is also necessary?

Did you add the IL2CPP Windows build target inside Unitys installer?

Other than that, try a restart of Windows :|

@ : does posting "internal errors" reported in the console when using Burst help you? Such as :) :( :

C:\buildslave\unity\build\Runtime\Jobs\Managed\IJobParallelForTransform.cs(32,13): error: Internal compiler error while processing function `System.Void UnityEngine.Jobs.IJobParallelForTransformExtensions/TransformParallelForLoopStruct`1::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)`

While compiling job: System.Void UnityEngine.Jobs.IJobParallelForTransformExtensions/TransformParallelForLoopStruct`1<treePartWobbling>::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)

Compiler exception: Burst.Compiler.IL.Syntax.BuilderException: Internal compiler error while processing function `System.Void UnityEngine.Jobs.IJobParallelForTransformExtensions/TransformParallelForLoopStruct`1::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)` ---> System.InvalidOperationException: Unable to find interface method `System.Void UnityEngine.Jobs.IJobParallelForTransform::Execute(System.Int32,UnityEngine.Jobs.TransformAccess)` from type `treePartWobbling`
  at Burst.Compiler.IL.Syntax.ILBuilder.DevirtualizeMethod (Mono.Cecil.TypeReference thisType, Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Syntax.GenericContext& thisContext) [0x00147] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
  at Burst.Compiler.IL.Syntax.ILBuilder.Call (Mono.Cecil.Cil.Instruction inst, Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Syntax.ILExpression thisArgument) [0x000c6] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
  at Burst.Compiler.IL.Syntax.ILBuilder.ProcessInstruction (Mono.Cecil.Cil.Instruction inst) [0x003d6] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
  at Burst.Compiler.IL.Syntax.ILBuilder.ProcessInstructions () [0x00074] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
   --- End of inner exception stack trace ---
  at Burst.Compiler.IL.Syntax.ILBuilder.ThrowInternalError (System.Exception ex) [0x0002d] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
  at Burst.Compiler.IL.Syntax.ILBuilder.ProcessInstructions () [0x001de] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
  at Burst.Compiler.IL.Syntax.ILBuilder.ProcessFunctionBody () [0x000b7] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
  at Burst.Compiler.IL.Syntax.ILBuilder.Visit (Burst.Compiler.IL.Syntax.MethodBinding binding) [0x00099] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
  at Burst.Compiler.IL.ILVisitor.PrepareFunctionInternal (Burst.Compiler.IL.Syntax.MethodBinding methodBinding) [0x00065] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
  at Burst.Compiler.IL.ILVisitor.PrepareFunction (Burst.Compiler.IL.Syntax.MethodBinding methodBinding) [0x00000] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
  at Burst.Compiler.IL.ILVerifier.PrepareFunction (Burst.Compiler.IL.Syntax.MethodBinding methodBinding) [0x00000] in <a2ed9824c1aa48fdb9ed369837529c5f>:0
using UnityEngine;
using UnityEngine.Jobs;
using Unity.Collections;
using Unity.Burst;

[BurstCompile]
public struct treePartWobbling : IJobParallelForTransform {

    [ReadOnly]
    public Vector3 rotationAxis;

    [ReadOnly]
    public float elongation;

    void IJobParallelForTransform.Execute(int index, TransformAccess transform)
    {
        transform.rotation *= Quaternion.AngleAxis(elongation, rotationAxis);
    }
}

edit: every version up to date as of now

1 Like

[quote=“uani”, post:17, topic: 707571]
@ : does posting “internal errors” reported in the console when using Burst help you? Such as :slight_smile: :frowning: :
[/quote]

Hopefully yes :slight_smile:

Could you change your method interface implementation to public instead of explicit? (Might not work with the later)

Hi, nice, thank you. Do you mean public void I....Execute(…) ? This yields error "CS0106: The modifier `public' is not valid for this item"

[quote=“uani”, post:19, topic: 707571]
Hi, nice, thank you. Do you mean public void I....Execute(…) ? This yields error “CS0106: The modifier `public’ is not valid for this item”
[/quote]

Actually, public void Execute(int index, TransformAccess transform), without specifying the interface explicitly.