Search Unity

Burst doesn't seem to work in development build

Discussion in 'Data Oriented Technology Stack' started by davenirline, Nov 6, 2018.

  1. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    471
    I was profiling the performance between editor and the build. I'm surprised that the profiler shown in dev build is so slow compared to profiling in editor. The job system work's fine but the work in the threads seem too long compared to the ones in editor.

    Did I do something wrong? Is there a setting that I should tick to enable Burst in dev build?
     
    Last edited: Nov 6, 2018
  2. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,080
    When you examine the worker threads in the profiler, you should see the jobs marked with (Burst) etc if it's running on Burst, this leaves out the guesswork if Burst is used or not.

    Atm there isn't any extra toggle for enabling Burst on builds, it uses the same menu setting for both editor and builds afaik.

    What version of Unity are you using? Burst doesn't work in standalone if you use 2018.1.
     
  3. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    471
    I see. Yeah, it's not used. I'm using 2018.3.13.

    NoBurst.png
     
  4. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    471
    This is the same job when shown in editor profiler:
    EditorBurst.png
     
  5. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    471
    I see the problem now.

    Failed running C:\Users\Marnel\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.burst@0.2.4-preview.35\.Runtime\bcl.exe @C:\Users\Marnel\AppData\Local\Temp\tmp4aad13aa.tmp

    stdout:
    System.Exception: No MSVC installations were found on the machine!
    at Unity.IL2CPP.Building.ToolChains.MsvcVersions.MsvcInstallation.GetLatestFunctionalInstallation(Architecture architecture)
    at Unity.IL2CPP.Building.ToolChains.MsvcDesktopToolChain.get_MsvcInstallation()
    at Unity.IL2CPP.Building.ToolChains.MsvcToolChain.GetToolchainInfoForOutput()
    at Burst.Compiler.IL.Aot.AotLinker.Link(IEnumerable`1 objFiles, String outPath)
    at Burst.Linker.Program.Main(String[] args)
    Usage: blink.exe [options] <input .o/.obj/.ll files...>
    --help Show Help
    --platform=VALUE Target Platform <Windows|macOS|Linux|Android|iOS|
    PS4|XboxOne|Wasm|UWP>
    --target=VALUE Target CPU <Auto|X86_SSE2|X86_SSE4|X64_SSE2|X64_
    SSE4|AVX|AVX2|AVX512|WASM32|ARMV7A_NEON32|ARMV8A_
    AARCH64|THUMB2_NEON32>
    --il2cpp-plugin-folder=VALUE
    Plugin folder
    --output=VALUE Output shared library file

    An unexpected exception occurred:
    stderr:

    System.InvalidOperationException: The linker failed. Check previous exception in the log
    at Burst.Compiler.IL.Aot.AotCompiler.CallLinkerProcess(TargetPlatform platform, TargetCpu targetCpu, List`1 plugins, List`1 inputFiles, String outputFile)
    at Burst.Compiler.IL.Aot.AotCompiler.Link(Module module, AotCompilerOptions compilerOptions)
    at Burst.Bcl.Program.Main(String[] args)

    UnityEngine.Debug:LogError(Object)
    UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128)
    UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
    Unity.Burst.Editor.BurstAotCompiler:OnPostBuildPlayerScriptDLLs(BuildReport) (at C:/Users/Marnel/AppData/Local/Unity/cache/packages/staging-packages.unity.com/com.unity.burst@0.2.4-preview.35/Editor/BurstAotCompiler.cs:236)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    But that's weird. I have visual studio.
     
  6. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    471
    I already updated my visual studio and added the visual studio components through Unity Hub. Still the same error. Any advise from Unity team? How do you fix this?
     
  7. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,080
    @davenirline That error message hints that you don't have c++ toolchain installed for VS. If you let Unity installer install VS it should include it automatically, but if you install manually with the VS installer it's not enabled by default and you have to separately select it.
     
  8. kakashi8841

    kakashi8841

    Joined:
    Apr 27, 2018
    Posts:
    7
    I think may be you could try to do one of these following steps and try again:
    1. Reinstall the "Unity VS Support"(I don't remember the exact name of the component) via the "UnityDownloadAssistant" and try again.
    2. Reinstall the latest Visual Studio 2017 and check all component. (except ASP.net, nodejs something associate with web development)
    3. Reinstall the Burst via "Package Manager" in Unity.
    I hope you will compile your sucessfully soon!
     
  9. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    471
    I was able to make the Burst compiler work by reinstalling Visual Studio. However, I still can't build for IL2CPP. It shows this error:

    UnityException: Build path contains project built with Mono scripting backend, while current project is using IL2CPP scripting backend. Consider building your project into an empty directory.
    UnityEditor.WindowsStandalone.WindowsDesktopStandalonePostProcessor.CheckSafeProjectOverwrite (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/WinPlayer/Extensions/Managed/WindowsDesktopStandalonePostProcessor.cs:63)
    DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:38)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    It doesn't really point which project was built with Mono.
     
  10. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,080
    @davenirline the error message says it all, you should read it more literally :) You are trying to build your project in same directory where you've build before with Mono as scripting backend and IL2CPP doesn't like this as it uses different folder structure. Just go to your projects build directory (whatever path you put there when you hit Build button in editor) and delete everything on that specific folder and then IL2CPP build will run.
     
    kakashi8841 likes this.
  11. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    471
    I totally misunderstood the message. I thought it was related to asmdef files as I'm using a bunch of them. Or some asset might have caused it.

    Thanks!