macro gymnastics to implement storage kernel, buffer op and complex compute panel
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="MatrixParallelHandle"
|
||||
// file="MatrixParallelTaskPackage"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
@@ -117,8 +117,8 @@ namespace StgSharp.Mathematics.Numeric
|
||||
#endregion
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct MatrixParallelTaskPackage<T> where T: unmanaged, INumber<T>
|
||||
[StructLayout(LayoutKind.Explicit, Size =128)]
|
||||
internal unsafe struct MatrixParallelTaskPackage<T> where T : unmanaged, INumber<T>
|
||||
{
|
||||
|
||||
public MatrixParallelTaskPackage()
|
||||
@@ -136,69 +136,69 @@ namespace StgSharp.Mathematics.Numeric
|
||||
#region source
|
||||
|
||||
// Group 1: Left/Right matrix kernel base address
|
||||
public MatrixKernel<T>* Left; // 8
|
||||
public MatrixKernel<T>* Right; // 8
|
||||
[FieldOffset(0)]public MatrixKernel<T>* Left; // 8
|
||||
[FieldOffset(8)] public MatrixKernel<T>* Right; // 8
|
||||
|
||||
#endregion
|
||||
|
||||
#region ans
|
||||
|
||||
// Group 2: Result kernel base address + reserved
|
||||
public MatrixKernel<T>* Result; // 8
|
||||
public int ElementSize = sizeof(T);
|
||||
public int ReservedPtr0; // 4 (extension/reserved)
|
||||
[FieldOffset(16)] public MatrixKernel<T>* Result; // 8
|
||||
[FieldOffset(24)] public int ElementSize = sizeof(T);
|
||||
[FieldOffset(28)] public int ReservedPtr0; // 4 (extension/reserved)
|
||||
|
||||
#endregion
|
||||
|
||||
#region left enum
|
||||
|
||||
public int LeftPrimOffset; // 4
|
||||
public int LeftPrimStride; // 4
|
||||
public int LeftSecOffset; // 4
|
||||
public int LeftSecStride; // 4
|
||||
[FieldOffset(32)]public int LeftPrimOffset; // 4
|
||||
[FieldOffset(36)]public int LeftPrimStride; // 4
|
||||
[FieldOffset(40)]public int LeftSecOffset; // 4
|
||||
[FieldOffset(44)] public int LeftSecStride; // 4
|
||||
|
||||
#endregion
|
||||
|
||||
#region right enum
|
||||
|
||||
public int RightPrimOffset; // 4
|
||||
public int RightPrimStride; // 4
|
||||
public int RightSecOffset; // 4
|
||||
public int RightSecStride; // 4
|
||||
[FieldOffset(48)]public int RightPrimOffset; // 4
|
||||
[FieldOffset(52)]public int RightPrimStride; // 4
|
||||
[FieldOffset(56)]public int RightSecOffset; // 4
|
||||
[FieldOffset(60)]public int RightSecStride; // 4
|
||||
|
||||
#endregion
|
||||
|
||||
#region ans enum
|
||||
|
||||
public int ResultPrimOffset; // 4
|
||||
public int ResultPrimStride; // 4
|
||||
public int ResultSecOffset; // 4
|
||||
public int ResultSecStride; // 4
|
||||
[FieldOffset(64)]public int ResultPrimOffset; // 4
|
||||
[FieldOffset(68)]public int ResultPrimStride; // 4
|
||||
[FieldOffset(72)]public int ResultSecOffset; // 4
|
||||
[FieldOffset(76)] public int ResultSecStride; // 4
|
||||
|
||||
#endregion
|
||||
|
||||
#region scalar/compute
|
||||
|
||||
public ScalarPacket* Scalar; // 8
|
||||
public IntPtr ComputeHandle; // 8
|
||||
[FieldOffset(80)] public ScalarPacket* Scalar; // 8
|
||||
[FieldOffset(88)]public IntPtr ComputeHandle; // 8
|
||||
|
||||
#endregion
|
||||
|
||||
#region global profile
|
||||
|
||||
public int PrimCount; // 4
|
||||
public int ComputeMode; // 4
|
||||
public int SecCount; // 4
|
||||
private readonly int ReservedInt0; // 4
|
||||
[FieldOffset(96)]public int PrimCount; // 4
|
||||
[FieldOffset(100)]public int ComputeMode; // 4
|
||||
[FieldOffset(104)]public int SecCount; // 4
|
||||
[FieldOffset(108)] private readonly int ReservedInt0; // 4
|
||||
|
||||
#endregion
|
||||
|
||||
#region count offset
|
||||
|
||||
public int PrimTileOffset; // 4
|
||||
public int SecTileOffset; // 4
|
||||
public int PrimColumnCountInTile; // 4
|
||||
public int SecColumnCountInTile; // 4
|
||||
[FieldOffset(112)]public int PrimTileOffset; // 4
|
||||
[FieldOffset(116)]public int SecTileOffset; // 4
|
||||
[FieldOffset(120)]public int PrimColumnCountInTile; // 4
|
||||
[FieldOffset(124)]public int SecColumnCountInTile; // 4
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user