first commit
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
namespace Unity.Burst.CompilerServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Compile-time aliasing intrinsics.
|
||||
/// </summary>
|
||||
public static class Aliasing
|
||||
{
|
||||
/// <summary>
|
||||
/// Will cause a compiler error in Burst-compiled code if a and b do not alias.
|
||||
/// </summary>
|
||||
/// <param name="a">A pointer to do aliasing checks on.</param>
|
||||
/// <param name="b">A pointer to do aliasing checks on.</param>
|
||||
public static unsafe void ExpectAliased(void* a, void* b) { }
|
||||
|
||||
/// <summary>
|
||||
/// Will cause a compiler error in Burst-compiled code if a and b do not alias.
|
||||
/// </summary>
|
||||
/// <typeparam name="A">The type of a.</typeparam>
|
||||
/// <typeparam name="B">The type of b.</typeparam>
|
||||
/// <param name="a">A reference to do aliasing checks on.</param>
|
||||
/// <param name="b">A reference to do aliasing checks on.</param>
|
||||
public static void ExpectAliased<A, B>(in A a, in B b) where A : struct where B : struct { }
|
||||
|
||||
/// <summary>
|
||||
/// Will cause a compiler error in Burst-compiled code if a and b do not alias.
|
||||
/// </summary>
|
||||
/// <typeparam name="B">The type of b.</typeparam>
|
||||
/// <param name="a">A pointer to do aliasing checks on.</param>
|
||||
/// <param name="b">A reference to do aliasing checks on.</param>
|
||||
public static unsafe void ExpectAliased<B>(void* a, in B b) where B : struct { }
|
||||
|
||||
/// <summary>
|
||||
/// Will cause a compiler error in Burst-compiled code if a and b do not alias.
|
||||
/// </summary>
|
||||
/// <typeparam name="A">The type of a.</typeparam>
|
||||
/// <param name="a">A reference to do aliasing checks on.</param>
|
||||
/// <param name="b">A pointer to do aliasing checks on.</param>
|
||||
public static unsafe void ExpectAliased<A>(in A a, void* b) where A : struct { }
|
||||
|
||||
/// <summary>
|
||||
/// Will cause a compiler error in Burst-compiled code if a and b can alias.
|
||||
/// </summary>
|
||||
/// <param name="a">A pointer to do aliasing checks on.</param>
|
||||
/// <param name="b">A pointer to do aliasing checks on.</param>
|
||||
public static unsafe void ExpectNotAliased(void* a, void* b) { }
|
||||
|
||||
/// <summary>
|
||||
/// Will cause a compiler error in Burst-compiled code if a and b can alias.
|
||||
/// </summary>
|
||||
/// <typeparam name="A">The type of a.</typeparam>
|
||||
/// <typeparam name="B">The type of b.</typeparam>
|
||||
/// <param name="a">A reference to do aliasing checks on.</param>
|
||||
/// <param name="b">A reference to do aliasing checks on.</param>
|
||||
public static void ExpectNotAliased<A, B>(in A a, in B b) where A : struct where B : struct { }
|
||||
|
||||
/// <summary>
|
||||
/// Will cause a compiler error in Burst-compiled code if a and b can alias.
|
||||
/// </summary>
|
||||
/// <typeparam name="B">The type of b.</typeparam>
|
||||
/// <param name="a">A pointer to do aliasing checks on.</param>
|
||||
/// <param name="b">A reference to do aliasing checks on.</param>
|
||||
public static unsafe void ExpectNotAliased<B>(void* a, in B b) where B : struct { }
|
||||
|
||||
/// <summary>
|
||||
/// Will cause a compiler error in Burst-compiled code if a and b can alias.
|
||||
/// </summary>
|
||||
/// <typeparam name="A">The type of a.</typeparam>
|
||||
/// <param name="a">A reference to do aliasing checks on.</param>
|
||||
/// <param name="b">A pointer to do aliasing checks on.</param>
|
||||
public static unsafe void ExpectNotAliased<A>(in A a, void* b) where A : struct { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57a9f349ecdd3cd6b50a30954d4f50f3
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace Unity.Burst.CompilerServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Can be used to specify that a parameter or return has a range assumption.
|
||||
/// Assumptions feed directly into the optimizer and allow better codegen.
|
||||
///
|
||||
/// Only usable on values of type scalar integer.
|
||||
///
|
||||
/// The range is a closed interval [min..max] - EG. the attributed value
|
||||
/// is greater-than-or-equal-to min and less-than-or-equal-to max.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter)]
|
||||
public class AssumeRangeAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Assume that an integer is in the signed closed interval [min..max].
|
||||
/// </summary>
|
||||
/// <param name="min">The inclusive minimum value.</param>
|
||||
/// <param name="max">The inclusive maximum value.</param>
|
||||
public AssumeRangeAttribute(long min, long max) { }
|
||||
|
||||
/// <summary>
|
||||
/// Assume that an integer is in the unsigned closed interval [min..max].
|
||||
/// </summary>
|
||||
/// <param name="min">The inclusive minimum value.</param>
|
||||
/// <param name="max">The inclusive maximum value.</param>
|
||||
public AssumeRangeAttribute(ulong min, ulong max) { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17055f9e032f36c6ae549103649199f4
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Unity.Burst.CompilerServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Compile-time queries intrinsics.
|
||||
/// </summary>
|
||||
public static class Constant
|
||||
{
|
||||
/// <summary>
|
||||
/// Performs a compile-time check on whether the provided argument is known to be constant by Burst.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type</typeparam>
|
||||
/// <param name="t">The value to check whether it is constant.</param>
|
||||
/// <returns>True if Burst knows at compile-time that it is a constant, false otherwise.</returns>
|
||||
public static bool IsConstantExpression<T>(T t) where T : unmanaged => false;
|
||||
|
||||
/// <summary>
|
||||
/// Performs a compile-time check on whether the provided argument is known to be constant by Burst.
|
||||
/// </summary>
|
||||
/// <param name="t">The value to check whether it is constant.</param>
|
||||
/// <returns>True if Burst knows at compile-time that it is a constant, false otherwise.</returns>
|
||||
public static unsafe bool IsConstantExpression(void* t) => false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 425b1cb76be0397aae735d27918c5a76
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace Unity.Burst.CompilerServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Compile-time hint intrinsics.
|
||||
/// </summary>
|
||||
public static class Hint
|
||||
{
|
||||
/// <summary>
|
||||
/// Hints to the compiler that the condition is likely to be true.
|
||||
/// </summary>
|
||||
/// <param name="condition">The boolean condition that is likely to be true.</param>
|
||||
/// <returns>The condition.</returns>
|
||||
public static bool Likely(bool condition) => condition;
|
||||
|
||||
/// <summary>
|
||||
/// Hints to the compiler that the condition is unlikely to be true.
|
||||
/// </summary>
|
||||
/// <param name="condition">The boolean condition that is unlikely to be true.</param>
|
||||
/// <returns>The condition.</returns>
|
||||
public static bool Unlikely(bool condition) => condition;
|
||||
|
||||
/// <summary>
|
||||
/// Hints to the compiler that the condition can be assumed to be true.
|
||||
/// </summary>
|
||||
/// <param name="condition">The boolean condition that can be assumed to be true.</param>
|
||||
public static void Assume(bool condition) { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b570e06d83103645837b57ee63c39049
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace Unity.Burst.CompilerServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Can be used to specify that a warning produced by Burst for a given
|
||||
/// method should be ignored.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class IgnoreWarningAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Ignore a single warning produced by Burst.
|
||||
/// </summary>
|
||||
/// <param name="warning">The warning to ignore.</param>
|
||||
public IgnoreWarningAttribute(int warning) { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fae4cb13a004334fb1b9261d2a368cff
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Unity.Burst.CompilerServices
|
||||
{
|
||||
#if UNITY_BURST_EXPERIMENTAL_LOOP_INTRINSICS
|
||||
public static class Loop
|
||||
{
|
||||
/// <summary>
|
||||
/// Must be called from inside a loop.
|
||||
/// Will cause a compiler error in Burst-compiled code if the loop is not auto-vectorized.
|
||||
/// </summary>
|
||||
public static void ExpectVectorized() { }
|
||||
|
||||
/// <summary>
|
||||
/// Must be called from inside a loop.
|
||||
/// Will cause a compiler error in Burst-compiled code if the loop is auto-vectorized.
|
||||
/// </summary>
|
||||
public static void ExpectNotVectorized() { }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31e17c7531d63dcfa71f892d658bc44c
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Unity.Burst.CompilerServices.Spmd
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies that multiple calls to a method act as if they are
|
||||
/// executing in a Single Program, Multiple Data (SPMD) paradigm.
|
||||
/// </summary>
|
||||
#if UNITY_BURST_EXPERIMENTAL_SPMD_ATTRIBUTE
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class SpmdAttribute : Attribute
|
||||
{
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d8f464f6c9033c89a0ee334f0aad30c
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Unity.Burst.CompilerServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Skip zero-initialization of local variables.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class SkipLocalsInitAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5aea2c85eccf39d4807b4b09e1286046
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user