Class BurstCompileAttribute | Burst | 1.3.9
docs.unity3d.com
    Show / Hide Table of Contents

    Class BurstCompileAttribute

    This attribute can be used to tag jobs as being Burst Compiled, and optionally set some compilation parameters.

    Inheritance
    Object
    Attribute
    BurstCompileAttribute
    Inherited Members
    Attribute.Equals(Object)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, Boolean)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, Boolean)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, Boolean)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, Boolean)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, Boolean)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, Boolean)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, Boolean)
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, Boolean)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, Boolean)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module, Type, Boolean)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, Boolean)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, Boolean)
    Attribute.GetHashCode()
    Attribute.IsDefaultAttribute()
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, Boolean)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, Boolean)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, Boolean)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, Boolean)
    Attribute.Match(Object)
    Attribute._Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
    Attribute._Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)
    Attribute._Attribute.GetTypeInfoCount(UInt32)
    Attribute._Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)
    Attribute.TypeId
    Object.Equals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Unity.Burst
    Syntax
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Struct)]
    public class BurstCompileAttribute : Attribute, _Attribute

    Constructors

    BurstCompileAttribute()

    Tags a struct/method/class as being burst compiled, with the default FloatPrecision, FloatMode and CompileSynchronously.

    Declaration
    public BurstCompileAttribute()
    Examples
    [BurstCompile]
    struct MyMethodsAreCompiledByBurstUsingTheDefaultSettings
    {
        //....
    }

    BurstCompileAttribute(FloatPrecision, FloatMode)

    Tags a struct/method/class as being burst compiled, with the specified FloatPrecision, FloatMode and the default CompileSynchronously.

    Declaration
    public BurstCompileAttribute(FloatPrecision floatPrecision, FloatMode floatMode)
    Parameters
    Type Name Description
    FloatPrecision floatPrecision

    Specify the required floating point precision.

    FloatMode floatMode

    Specify the required floating point mode.

    Examples
    [BurstCompile(FloatPrecision.Low,FloatMode.Fast)]
    struct MyMethodsAreCompiledByBurstWithLowPrecisionAndFastFloatingPointMode
    {
        //....
    }

    Properties

    CompileSynchronously

    Gets or sets whether or not to burst compile the code immediately on first use, or in the background over time.

    Declaration
    public bool CompileSynchronously { get; set; }
    Property Value
    Type Description
    Boolean

    The default is false, true will force this code to be compiled synchronously on first invocation.

    Debug

    Gets or sets whether to compile the code in a way that allows it to be debugged. If this is set to true, the current implementation disables optimisations on this method allowing it to be debugged using a Native debugger.

    Declaration
    public bool Debug { get; set; }
    Property Value
    Type Description
    Boolean

    The default is false.

    FloatMode

    Gets or sets the float mode of operation for this burst compilation.

    Declaration
    public FloatMode FloatMode { get; set; }
    Property Value
    Type Description
    FloatMode

    The default is Default.

    FloatPrecision

    Gets or sets the floating point precision to use for this burst compilation. Allows you to trade accuracy for speed of computation, useful when you don't require much precision.

    Declaration
    public FloatPrecision FloatPrecision { get; set; }
    Property Value
    Type Description
    FloatPrecision

    The default is Standard.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023