C#/.NET System namespace support
Read time 2 minutesLast updated 12 days ago
Burst provides support for some of the namespace, transforming these into Burst compatible variants in the Burst compiler.
SystemSystem.Math
Burst supports all methods that declares, with the following exceptions:
System.Math- is only supported when Api Compatibility Level is set to .NET Standard 2.1 in project settings
double IEEERemainder(double x, double y)
System.IntPtr
Burst supports all methods of /, including the static fields and
System.IntPtrSystem.UIntPtrIntPtr.ZeroIntPtr.SizeSystem.Threading.Interlocked
Burst supports atomic memory intrinsics for all methods provided by (for example, ).
System.Threading.InterlockedInterlocked.IncrementMake sure that the source location of the interlocked methods are naturally aligned. For example, the alignment of the pointer is a multiple of the pointed-to-type:
[StructLayout(LayoutKind.Explicit)]struct Foo{ [FieldOffset(0)] public long a; [FieldOffset(5)] public long b; public long AtomicReadAndAdd() { return Interlocked.Read(ref a) + Interlocked.Read(ref b); }}
If the pointer to the struct has an alignment of 8, which is the natural alignment of a value, the of would be successful because it lies on a naturally aligned address. However, would not be successful and undefined behavior happens at the load of as a result.
FoolongInterlocked.ReadabbSystem.Threading.Thread
Burst supports the method of .
MemoryBarrierSystem.Threading.ThreadSystem.Threading.Volatile
Burst supports the non-generic variants of and provided by .
ReadWriteSystem.Threading.VolatileSystem.HashCode
Burst supports all methods of except for .
HashCodeHashCode.Add<T>(T, IEqualityComparer<T>)However, Burst does not guarantee compatibility of results with the .NET implementation. As a consequence, functions might produce different results when running in Burst versus other runtime environments such as Mono.
HashCodeFor example, the value produced by is different when run on Burst compared to managed code, because Burst doesn't have access to the seed value used by the managed implementation.
HashCode.Combine