|
MemoryUtils Class |
MemoryUtils is a static class that contains methods and property that can be used to perform advanced memory copy operations by using AVX2 NonTemporal instructions.
Do disable AVX2 NonTemporal, set the static
UseAdvancedMemoryCopyInstructions to false.
Inheritance Hierarchy Namespace: Ab4d.SharpEngine.UtilitiesAssembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax public static class MemoryUtils
The MemoryUtils type exposes the following members.
Properties | Name | Description |
---|
| IsCopyMemoryNonTemporalSupported | |
| UseAdvancedMemoryCopyInstructions |
Static nullable Boolean field that specifies if advanced NonTemporal AVX copy is used to copy textures from the GPU memory to the main CPU memory.
This can be very beneficial when Intel GPU is used.
If this value is not set by the user and if AVX2 instructions are supported by the CPU, then on first copy a benchmark is used to determine
if NonTemporal AVX copy is significantly faster than normal memory copy. This benchmark also sets a value to this property.
|
TopMethods | Name | Description |
---|
| AlignPtrTo32 |
Aligns the specified pointer to 32 bytes (if not already aligned then the ptr address is increased to the next aligned address).
The method returns the addressOffset (if more than 0 then the ptr address is increased that offset).
|
| AlignValueTo32 |
Aligns the specified value to 32 bytes (if not already aligned then the value is increased to the next aligned value).
The method returns the valueOffset (if more than 0 then the value was increased by that offset).
|
| Copy(IntPtr, IntPtr, Int32) |
Copy memory size bytes from source to destination.
This method can also set the if it was not set before.
|
| Copy(IntPtr, IntPtr, Int32, Byte) |
Copy memory size bytes from source to destination.
In case the destination is not aligned to 32, the tempByteArray may be used / created as a temporary storage.
This method can also set the if it was not set before.
|
| CopyMemoryNonTemporalAvx |
When source and destination are aligned to 32, then non-temporal avx copy was performed.
|
| CopyToArray |
Copies the size bytes from the source to the destinationArray.
When source is aligned to 32, then non-temporal avx copy was performed.
When destination array is not aligned to 32, then it can be resized and destinationArrayOffset is set to the offset when the data start.
|
| IsAlignedTo32 |
Returns true when the specified memory address is aligned to 32.
|
TopSee Also