remove branch conflict
This commit is contained in:
@@ -1,12 +1,4 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixKernel"
|
// file="MatrixKernel"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -40,10 +32,6 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace StgSharp.HighPerformance
|
namespace StgSharp.HighPerformance
|
||||||
{
|
{
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
public unsafe struct MatrixKernel
|
public unsafe struct MatrixKernel
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -51,20 +39,9 @@ namespace StgSharp.HighPerformance
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
[InlineArray(16)]
|
[InlineArray(16)]
|
||||||
public unsafe struct MatrixKernel<T> where T : unmanaged, INumber<T>
|
public unsafe struct MatrixKernel<T> where T : unmanaged, INumber<T>
|
||||||
=======
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
[InlineArray(16)]
|
|
||||||
public unsafe struct MatrixKernel<T> where T: unmanaged, INumber<T>
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
[InlineArray(16)]
|
|
||||||
public unsafe struct MatrixKernel<T> where T : unmanaged, INumber<T>
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
{
|
{
|
||||||
|
|
||||||
private T c0r0;
|
private T c0r0;
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixPanel"
|
// file="MatrixPanel"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -33,14 +25,7 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
using StgSharp.Internal;
|
using StgSharp.Internal;
|
||||||
=======
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
using StgSharp.Internal;
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -48,8 +33,6 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace StgSharp.HighPerformance
|
namespace StgSharp.HighPerformance
|
||||||
{
|
{
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
public unsafe struct MatrixPanel
|
public unsafe struct MatrixPanel
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -178,308 +161,3 @@ namespace StgSharp.HighPerformance
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
=======
|
|
||||||
#pragma warning disable CA1000
|
|
||||||
|
|
||||||
public interface IMatrixPanel<T> : IDisposable where T : unmanaged,INumber<T>
|
|
||||||
=======
|
|
||||||
public unsafe struct MatrixPanel
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
{
|
|
||||||
|
|
||||||
public const int AlignmentBytes = 64;
|
|
||||||
|
|
||||||
private byte Head;
|
|
||||||
|
|
||||||
// Allocate aligned memory for one panel; caller must free via Destroy.
|
|
||||||
public static unsafe MatrixPanel<T>* Create<T>() where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
return (MatrixPanel<T>*)NativeMemory.AlignedAlloc(Size<T>(), AlignmentBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static unsafe void Destroy<T>(MatrixPanel<T>* panel) where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
NativeMemory.AlignedFree(panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static unsafe Span<T> Elements<T>(ref T head) where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
void* p = Unsafe.AsPointer(ref head);
|
|
||||||
return new Span<T>(p, MaxElementCount<T>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static int ElementSideLength<T>() where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
return Math.Max(8, AlignmentBytes / sizeof(T));
|
|
||||||
}
|
|
||||||
|
|
||||||
// View an existing pointer; caller guarantees lifetime/alignment.
|
|
||||||
public static unsafe MatrixPanel<T>* FromPointer<T>(void* ptr)
|
|
||||||
where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
return (MatrixPanel<T>*)Align64(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static int MaxElementCount<T>() where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
int side = ElementSideLength<T>();
|
|
||||||
return side * side;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static nuint Size<T>() where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
return (nuint)(MaxElementCount<T>() * sizeof(T));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number of 4x4 kernels that fit in a panel for the given ISA and element T.
|
|
||||||
/// </summary>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
internal static int KernelCapacity<T>() where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
int perSide = KernelSideCount<T>();
|
|
||||||
return perSide * perSide;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How many 4x4 kernels fit along a single panel dimension for the given ISA.
|
|
||||||
/// </summary>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
internal static int KernelSideCount<T>() where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
return NativeIntrinsic.IntrinsicLevel switch
|
|
||||||
{
|
|
||||||
IntrinsicLevel.SSE => KernelSideCountSse<T>(),
|
|
||||||
IntrinsicLevel.AVX2 => KernelSideCountAvx2<T>(),
|
|
||||||
IntrinsicLevel.AVX512 => KernelSideCountAvx512<T>(),
|
|
||||||
_ => 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
private static unsafe nuint Align64(void* p) => ((nuint)p + (AlignmentBytes - 1)) & ~(nuint)(AlignmentBytes - 1);
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
private static int KernelSideCountAvx2<T>() where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
const int minQ = 8;
|
|
||||||
int lanes = 32 / sizeof(T);
|
|
||||||
int side = Math.Max(lanes, minQ);
|
|
||||||
return side / 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
private static int KernelSideCountAvx512<T>() where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
const int minQ = 8;
|
|
||||||
int lanes = 64 / sizeof(T);
|
|
||||||
int side = Math.Max(lanes, minQ);
|
|
||||||
return side / 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
private static int KernelSideCountSse<T>() where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
const int minQ = 4;
|
|
||||||
int lanes = 16 / sizeof(T);
|
|
||||||
int side = Math.Max(lanes, minQ);
|
|
||||||
return side / 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Single POD-style panel: ZMM-compatible size. Alignment handled by allocator, not by the struct.
|
|
||||||
public unsafe struct MatrixPanel<T> where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
|
|
||||||
internal T Head; // first element of the panel buffer
|
|
||||||
|
|
||||||
public ref T this[int column, int row]
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => ref Unsafe.Add(ref Head, row * MatrixPanel.ElementSideLength<T>() + column);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Span<T> Elements
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => MatrixPanel.Elements(ref Head);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
/// <summary>
|
|
||||||
/// Buffer for AVX targeted matrix panel, size of a panel is 4x4 elements, and no smaller than
|
|
||||||
/// 16 bytes.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">
|
|
||||||
/// Type of matrix element.
|
|
||||||
/// </typeparam>
|
|
||||||
public unsafe struct MatrixPanelAVX<T> : IMatrixPanel<T> where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
|
|
||||||
private T element;
|
|
||||||
|
|
||||||
[Obsolete("Compute kernel should not be created from new(), use Create instead", true)]
|
|
||||||
public MatrixPanelAVX() { }
|
|
||||||
|
|
||||||
public ref T this[int column, int row]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
int index = row * ElementSideLength + column;
|
|
||||||
return ref Unsafe.Add(ref element, index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int ElementSideLength
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get;
|
|
||||||
} = int.Max(8, 32 / sizeof(T));
|
|
||||||
|
|
||||||
public static unsafe int MaxElementCount
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get;
|
|
||||||
} = ElementSideLength * ElementSideLength;
|
|
||||||
|
|
||||||
public static unsafe nuint Size { get; } = (nuint)(MaxElementCount * sizeof(T));
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static int ChunkCount() => (ElementSideLength + LanesPerVector() - 1) / LanesPerVector();
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static MatrixPanelAVX<T>* Create()
|
|
||||||
{
|
|
||||||
MatrixPanelAVX<T>* kernel = (MatrixPanelAVX<T>*)NativeMemory.AlignedAlloc(Size, 32);
|
|
||||||
return kernel;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static void Destroy(MatrixPanelAVX<T>* kernel)
|
|
||||||
{
|
|
||||||
NativeMemory.AlignedFree(kernel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
fixed (MatrixPanelAVX<T>* thisPtr = &this) {
|
|
||||||
NativeMemory.AlignedFree(thisPtr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public ref M256 GetVectorChunk(int column, int chunk)
|
|
||||||
{
|
|
||||||
int lanes = LanesPerVector();
|
|
||||||
int rowStart = chunk * lanes;
|
|
||||||
ref T colBase = ref this[column, 0];
|
|
||||||
return ref Unsafe.As<T, M256>(ref Unsafe.Add(ref colBase, rowStart));
|
|
||||||
}
|
|
||||||
|
|
||||||
// SIMD access helpers for AVX (column-major)
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static int LanesPerVector() => 32 / sizeof(T);
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public void SetVectorChunk(int column, int chunk, in M256 value)
|
|
||||||
{
|
|
||||||
GetVectorChunk(column, chunk) = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Buffer for AVX512 targeted matrix panel, size of a panel is 4x4 elements, and no smaller
|
|
||||||
/// than 16 bytes.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">
|
|
||||||
/// Type of matrix element.
|
|
||||||
/// </typeparam>
|
|
||||||
public unsafe struct MatrixComputeKernelAVX512<T> : IMatrixPanel<T>
|
|
||||||
where T : unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
|
|
||||||
private T element;
|
|
||||||
|
|
||||||
[Obsolete("Compute kernel should not be created from new(), use Create instead", true)]
|
|
||||||
public MatrixComputeKernelAVX512() { }
|
|
||||||
|
|
||||||
public ref T this[int column, int row]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
int index = row * ElementSideLength + column;
|
|
||||||
return ref Unsafe.Add(ref element, index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int ElementSideLength
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get;
|
|
||||||
} = int.Max(8, 64 / sizeof(T));
|
|
||||||
|
|
||||||
public static unsafe int MaxElementCount
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get;
|
|
||||||
} = ElementSideLength * ElementSideLength;
|
|
||||||
|
|
||||||
public static unsafe nuint Size { get; } = (nuint)(MaxElementCount * sizeof(T));
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static int ChunkCount() => (ElementSideLength + LanesPerVector() - 1) / LanesPerVector();
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static MatrixComputeKernelAVX512<T>* Create()
|
|
||||||
{
|
|
||||||
MatrixComputeKernelAVX512<T>* kernel = (MatrixComputeKernelAVX512<T>*)NativeMemory.AlignedAlloc(Size, 64);
|
|
||||||
return kernel;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static void Destroy(MatrixComputeKernelAVX512<T>* kernel)
|
|
||||||
{
|
|
||||||
NativeMemory.AlignedFree(kernel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
fixed (MatrixComputeKernelAVX512<T>* thisPtr = &this) {
|
|
||||||
NativeMemory.AlignedFree(thisPtr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public ref M512 GetVectorChunk(int column, int chunk)
|
|
||||||
{
|
|
||||||
int lanes = LanesPerVector();
|
|
||||||
int rowStart = chunk * lanes;
|
|
||||||
ref T colBase = ref this[column, 0];
|
|
||||||
return ref Unsafe.As<T, M512>(ref Unsafe.Add(ref colBase, rowStart));
|
|
||||||
}
|
|
||||||
|
|
||||||
// SIMD access helpers for AVX-512 (column-major)
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static int LanesPerVector() => 64 / sizeof(T);
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public void SetVectorChunk(int column, int chunk, in M512 value)
|
|
||||||
{
|
|
||||||
GetVectorChunk(column, chunk) = value;
|
|
||||||
}
|
|
||||||
#pragma warning restore CA1000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|||||||
@@ -26,17 +26,11 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.HighPerformance;
|
using StgSharp.HighPerformance;
|
||||||
<<<<<<< HEAD
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
=======
|
|
||||||
using StgSharp.Internal;
|
using StgSharp.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -45,19 +39,6 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
public partial class MatrixCompute
|
public partial class MatrixCompute
|
||||||
{
|
{
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
private static unsafe void ComputeFmaPanelF32(
|
|
||||||
MatrixKernel* left,
|
|
||||||
MatrixKernel* right,
|
|
||||||
MatrixKernel* ans,
|
|
||||||
ScalarPacket* scalar)
|
|
||||||
{
|
|
||||||
const int eSize = 32;
|
|
||||||
int colum = scalar->Data<int>(0);
|
|
||||||
int row = scalar->Data<int>(1);
|
|
||||||
int k =
|
|
||||||
|
|
||||||
=======
|
|
||||||
internal static unsafe void ComputeFmaPanelF32(MatrixParallelTaskPackage* p)
|
internal static unsafe void ComputeFmaPanelF32(MatrixParallelTaskPackage* p)
|
||||||
{
|
{
|
||||||
int size = p->ElementSize;
|
int size = p->ElementSize;
|
||||||
@@ -97,7 +78,6 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixPanel.Destroy(leftPanel);
|
MatrixPanel.Destroy(leftPanel);
|
||||||
MatrixPanel.Destroy(rightPanel);
|
MatrixPanel.Destroy(rightPanel);
|
||||||
MatrixPanel.Destroy(ansPanel);
|
MatrixPanel.Destroy(ansPanel);
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,4 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
=======
|
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixCompute"
|
// file="MatrixCompute"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -37,57 +25,24 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
<<<<<<< HEAD
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
=======
|
|
||||||
using StgSharp.Collections;
|
using StgSharp.Collections;
|
||||||
using StgSharp.HighPerformance;
|
using StgSharp.HighPerformance;
|
||||||
using StgSharp.Internal;
|
using StgSharp.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
=======
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Security.AccessControl;
|
using System.Security.AccessControl;
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Numeric
|
namespace StgSharp.Mathematics.Numeric
|
||||||
{
|
{
|
||||||
<<<<<<< HEAD
|
|
||||||
public static partial class MatrixCompute { }
|
|
||||||
=======
|
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
public static partial class MatrixCompute
|
public static partial class MatrixCompute
|
||||||
{
|
{
|
||||||
|
|
||||||
public static unsafe void Add(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
public static unsafe void Add(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
||||||
=======
|
|
||||||
public static class MatrixCompute
|
|
||||||
{
|
|
||||||
|
|
||||||
public static unsafe Matrix<float> Add(
|
|
||||||
Matrix<float> left,
|
|
||||||
Matrix<float> right,
|
|
||||||
Matrix<float> ans)
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
public static partial class MatrixCompute
|
|
||||||
{
|
|
||||||
|
|
||||||
public static unsafe void Add(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
{
|
{
|
||||||
if (left.ColumnLength != right.ColumnLength ||
|
if (left.ColumnLength != right.ColumnLength ||
|
||||||
left.RowLength != right.RowLength ||
|
left.RowLength != right.RowLength ||
|
||||||
@@ -102,16 +57,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixKernel<float>* rightPtr = right.Buffer;
|
MatrixKernel<float>* rightPtr = right.Buffer;
|
||||||
MatrixKernel<float>* ansPtr = ans.Buffer;
|
MatrixKernel<float>* ansPtr = ans.Buffer;
|
||||||
NativeIntrinsic.Intrinsic.f32_buffer_add(leftPtr, rightPtr, ansPtr, count);
|
NativeIntrinsic.Intrinsic.f32_buffer_add(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return;
|
return;
|
||||||
=======
|
|
||||||
return ans;
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
return;
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
} else if (count <= 1024)
|
} else if (count <= 1024)
|
||||||
{
|
{
|
||||||
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
@@ -122,49 +68,21 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
NativeIntrinsic.Intrinsic.f32_buffer_add(leftPtr, rightPtr, ansPtr, count);
|
NativeIntrinsic.Intrinsic.f32_buffer_add(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return;
|
return;
|
||||||
=======
|
|
||||||
return ans;
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
return;
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
||||||
package->Left = (nint)left.Buffer;
|
package->Left = (nint)left.Buffer;
|
||||||
package->Right = (nint)right.Buffer;
|
package->Right = (nint)right.Buffer;
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
package->ElementSize = sizeof(float);
|
package->ElementSize = sizeof(float);
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
package->PrimCount = ans.KernelColumnLength;
|
|
||||||
package->SecCount = ans.KernelRowLength;
|
|
||||||
=======
|
|
||||||
package->PrimCount = left.KernelColumnLength;
|
|
||||||
package->SecCount = left.KernelRowLength;
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
package->ComputeMode = new MatrixOpMode(MatrixOperationStyle.BUFFER_OP, MatrixOperationParam.LEFT_RIGHT_ANS_PARAM);
|
|
||||||
========
|
|
||||||
package->PrimCount = ans.KernelColumnLength;
|
package->PrimCount = ans.KernelColumnLength;
|
||||||
package->SecCount = ans.KernelRowLength;
|
package->SecCount = ans.KernelRowLength;
|
||||||
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.LEFT_RIGHT_ANS_PARAM);
|
package->ComputeMode = new MatrixOpMode(MatrixIndexStyle.BUFFER_INDEX, MatrixOperationParam.LEFT_RIGHT_ANS_PARAM);
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
package->ComputeHandle = (IntPtr)NativeIntrinsic.Intrinsic.f32_buffer_add;
|
package->ComputeHandle = (IntPtr)NativeIntrinsic.Intrinsic.f32_buffer_add;
|
||||||
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
||||||
|
|
||||||
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
taskGroup.Dispose();
|
taskGroup.Dispose();
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return;
|
|
||||||
=======
|
|
||||||
return ans;
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
return;
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void Fill(Matrix<float> ans, float value)
|
public static unsafe void Fill(Matrix<float> ans, float value)
|
||||||
@@ -197,89 +115,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
taskGroup.Dispose();
|
taskGroup.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
public static unsafe void Mul(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
public static unsafe void Mul(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
||||||
{
|
|
||||||
// For matrix multiplication (left: MxK) * (right: KxN) => ans: MxN
|
|
||||||
// ColumnLength = number of columns (N), RowLength = number of rows (M)
|
|
||||||
if (left.ColumnLength != right.RowLength ||
|
|
||||||
ans.ColumnLength != right.ColumnLength ||
|
|
||||||
ans.RowLength != left.RowLength)
|
|
||||||
{
|
|
||||||
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
|
||||||
}
|
|
||||||
long count = (long)left.KernelColumnLength * left.KernelRowLength;
|
|
||||||
if (count <= 1024)
|
|
||||||
{
|
|
||||||
MatrixParallelThread[] pool = null;
|
|
||||||
if (count > 256) {
|
|
||||||
pool = MatrixParallel.LeadParallel(1);
|
|
||||||
}
|
|
||||||
MatrixPanel<float>* leftPanel = MatrixPanel.Create<float>();
|
|
||||||
MatrixPanel<float>* rightPanel = MatrixPanel.Create<float>();
|
|
||||||
MatrixPanel<float>* ansPanel = MatrixPanel.Create<float>();
|
|
||||||
int size = MatrixPanel.KernelSideCount<float>();
|
|
||||||
for (int i = 0; i < left.RowLength; i += size)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < right.ColumnLength; j += size)
|
|
||||||
{
|
|
||||||
NativeIntrinsic.Intrinsic.f32_clear_panel((MatrixPanel*)ansPanel);
|
|
||||||
for (int k = 0; k < left.ColumnLength; k += size)
|
|
||||||
{
|
|
||||||
NativeIntrinsic.Intrinsic
|
|
||||||
.f32_build_panel((MatrixKernel*)left.Buffer,
|
|
||||||
(MatrixPanel*)leftPanel,
|
|
||||||
left.ColumnLength, left.RowLength, i,
|
|
||||||
k);
|
|
||||||
NativeIntrinsic.Intrinsic
|
|
||||||
.f32_build_panel((MatrixKernel*)right.Buffer,
|
|
||||||
(MatrixPanel*)rightPanel,
|
|
||||||
right.ColumnLength, right.RowLength, k,
|
|
||||||
j);
|
|
||||||
NativeIntrinsic.Intrinsic
|
|
||||||
.f32_panel_fma((MatrixPanel*)leftPanel,
|
|
||||||
(MatrixPanel*)rightPanel,
|
|
||||||
(MatrixPanel*)ansPanel);
|
|
||||||
}
|
|
||||||
NativeIntrinsic.Intrinsic
|
|
||||||
.f32_store_panel((MatrixKernel*)ans.Buffer,
|
|
||||||
(MatrixPanel*)ansPanel, ans.ColumnLength,
|
|
||||||
ans.RowLength, i, j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MatrixPanel.Destroy(leftPanel);
|
|
||||||
MatrixPanel.Destroy(rightPanel);
|
|
||||||
MatrixPanel.Destroy(ansPanel);
|
|
||||||
if (count > 256) {
|
|
||||||
MatrixParallel.ReturnParallelResources(ref pool!);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
|
||||||
package->Right = (nint)left.Buffer;
|
|
||||||
package->Result = (nint)ans.Buffer;
|
|
||||||
package->ElementSize = sizeof(float);
|
|
||||||
package->PrimCount = left.KernelColumnLength;
|
|
||||||
package->SecCount = left.KernelRowLength;
|
|
||||||
package->ComputeMode = new MatrixOpMode(MatrixOperationStyle.BUFFER_OP, MatrixOperationParam.RIGHT_ANS_SCALAR_PARAM);
|
|
||||||
package->ComputeHandle = (IntPtr)NativeIntrinsic.Intrinsic.f32_buffer_scalar_mul;
|
|
||||||
MatrixParallelHandle taskGroup = MatrixParallel.ScheduleTask(package);
|
|
||||||
|
|
||||||
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
|
||||||
taskGroup.Dispose();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static unsafe void Mul(Matrix<float> left, float right, Matrix<float> ans)
|
|
||||||
=======
|
|
||||||
public static unsafe Matrix<float> Mul(
|
|
||||||
Matrix<float> left,
|
|
||||||
Matrix<float> right,
|
|
||||||
Matrix<float> ans)
|
|
||||||
========
|
|
||||||
public static unsafe void Mul(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
{
|
{
|
||||||
// For matrix multiplication (left: MxK) * (right: KxN) => ans: MxN
|
// For matrix multiplication (left: MxK) * (right: KxN) => ans: MxN
|
||||||
// ColumnLength = number of columns (N), RowLength = number of rows (M)
|
// ColumnLength = number of columns (N), RowLength = number of rows (M)
|
||||||
@@ -357,12 +193,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
public static unsafe Matrix<float> Mul(Matrix<float> left, float right, Matrix<float> ans)
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
public static unsafe void Mul(Matrix<float> left, float right, Matrix<float> ans)
|
public static unsafe void Mul(Matrix<float> left, float right, Matrix<float> ans)
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
{
|
{
|
||||||
if (left.ColumnLength != ans.ColumnLength || left.RowLength != ans.RowLength) {
|
if (left.ColumnLength != ans.ColumnLength || left.RowLength != ans.RowLength) {
|
||||||
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
|
||||||
@@ -375,16 +206,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixKernel<float>* leftPtr = left.Buffer;
|
MatrixKernel<float>* leftPtr = left.Buffer;
|
||||||
MatrixKernel<float>* ansPtr = ans.Buffer;
|
MatrixKernel<float>* ansPtr = ans.Buffer;
|
||||||
NativeIntrinsic.Intrinsic.f32_buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
NativeIntrinsic.Intrinsic.f32_buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
||||||
|
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return;
|
return;
|
||||||
=======
|
|
||||||
return ans;
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
return;
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
} else if (count <= 1024)
|
} else if (count <= 1024)
|
||||||
{
|
{
|
||||||
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
@@ -394,15 +216,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
NativeIntrinsic.Intrinsic.f32_buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
NativeIntrinsic.Intrinsic.f32_buffer_scalar_mul(leftPtr, ansPtr, scalar, count);
|
||||||
|
|
||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return;
|
return;
|
||||||
=======
|
|
||||||
return ans;
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
return;
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
||||||
package->Right = (nint)left.Buffer;
|
package->Right = (nint)left.Buffer;
|
||||||
@@ -418,27 +232,10 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
taskGroup.Dispose();
|
taskGroup.Dispose();
|
||||||
MatrixParallelFactory.Release(scalar);
|
MatrixParallelFactory.Release(scalar);
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void Sub(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
public static unsafe void Sub(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
||||||
=======
|
|
||||||
return ans;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static unsafe Matrix<float> Sub(
|
|
||||||
Matrix<float> left,
|
|
||||||
Matrix<float> right,
|
|
||||||
Matrix<float> ans)
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static unsafe void Sub(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
{
|
{
|
||||||
if (left.ColumnLength != right.ColumnLength ||
|
if (left.ColumnLength != right.ColumnLength ||
|
||||||
left.RowLength != right.RowLength ||
|
left.RowLength != right.RowLength ||
|
||||||
@@ -453,16 +250,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixKernel<float>* rightPtr = right.Buffer;
|
MatrixKernel<float>* rightPtr = right.Buffer;
|
||||||
MatrixKernel<float>* ansPtr = ans.Buffer;
|
MatrixKernel<float>* ansPtr = ans.Buffer;
|
||||||
NativeIntrinsic.Intrinsic.f32_buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
NativeIntrinsic.Intrinsic.f32_buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return;
|
return;
|
||||||
=======
|
|
||||||
return ans;
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
return;
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
} else if (count <= 1024)
|
} else if (count <= 1024)
|
||||||
{
|
{
|
||||||
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
|
||||||
@@ -473,15 +261,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
NativeIntrinsic.Intrinsic.f32_buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
NativeIntrinsic.Intrinsic.f32_buffer_sub(leftPtr, rightPtr, ansPtr, count);
|
||||||
|
|
||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return;
|
return;
|
||||||
=======
|
|
||||||
return ans;
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
return;
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask<float>();
|
||||||
package->Left = (nint)left.Buffer;
|
package->Left = (nint)left.Buffer;
|
||||||
@@ -496,17 +276,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
|
|
||||||
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
MatrixParallel.LaunchParallel(taskGroup, SleepMode.DeepSleep);
|
||||||
taskGroup.Dispose();
|
taskGroup.Dispose();
|
||||||
<<<<<<<< HEAD:StgSharp.Mathematics/Numeric/MatrixCompute.Basic.cs
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return;
|
|
||||||
=======
|
|
||||||
return ans;
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
========
|
|
||||||
return;
|
|
||||||
>>>>>>>> stgsharp-dev/giga:StgSharp.Mathematics/Numeric/MatrixCompute.cs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixComputeModel"
|
// file="MatrixComputeModel"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -61,7 +53,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
long offset = Unsafe.As<int, long>(ref p->PrimTileOffset) * size;
|
long offset = Unsafe.As<int, long>(ref p->PrimTileOffset) * size;
|
||||||
ScalarPacket* scalar = p->Scalar;
|
ScalarPacket* scalar = p->Scalar;
|
||||||
((delegate* unmanaged[Cdecl]<void*, void*, void*,ScalarPacket*, long, void>)p->ComputeHandle)((void*)(p->Left + offset),
|
((delegate* unmanaged[Cdecl]<void*, void*, void*, ScalarPacket*, long, void>)p->ComputeHandle)((void*)(p->Left + offset),
|
||||||
(void*)(p->Right + offset),
|
(void*)(p->Right + offset),
|
||||||
(void*)(p->Answer + offset),
|
(void*)(p->Answer + offset),
|
||||||
scalar,
|
scalar,
|
||||||
@@ -74,7 +66,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
int size = p->ElementSize * 16;
|
int size = p->ElementSize * 16;
|
||||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
long offset = Unsafe.As<int, long>(ref p->PrimTileOffset) * size;
|
long offset = Unsafe.As<int, long>(ref p->PrimTileOffset) * size;
|
||||||
((delegate* unmanaged[Cdecl]<void*, ScalarPacket*,long, void>)p->ComputeHandle)((void*)(p->Answer + offset),
|
((delegate* unmanaged[Cdecl]<void*, ScalarPacket*, long, void>)p->ComputeHandle)((void*)(p->Answer + offset),
|
||||||
p->Scalar, count);
|
p->Scalar, count);
|
||||||
MatrixParallelFactory.Release(p);
|
MatrixParallelFactory.Release(p);
|
||||||
}
|
}
|
||||||
@@ -96,25 +88,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
int size = p->ElementSize * 16;
|
int size = p->ElementSize * 16;
|
||||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||||
long offset = Unsafe.As<int, long>(ref p->PrimTileOffset) * size;
|
long offset = Unsafe.As<int, long>(ref p->PrimTileOffset) * size;
|
||||||
((delegate* unmanaged[Cdecl]< void*, void*, ScalarPacket*, long, void>)p->ComputeHandle)((void*)(p->Right + offset),
|
((delegate* unmanaged[Cdecl]<void*, void*, ScalarPacket*, long, void>)p->ComputeHandle)((void*)(p->Right + offset),
|
||||||
<<<<<<< HEAD
|
|
||||||
(void*)(p->Result + offset),
|
|
||||||
<<<<<<< HEAD
|
|
||||||
p->Scalar,
|
|
||||||
count);
|
|
||||||
=======
|
|
||||||
p->Scalar, count);
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
MatrixParallelFactory.Release(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
<<<<<<< HEAD
|
|
||||||
internal static unsafe void KernelComputeBinary(MatrixParallelTaskPackage* p)
|
|
||||||
=======
|
|
||||||
internal static unsafe void Compute_Binary(MatrixParallelTaskPackage* p)
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
(void*)(p->Answer + offset),
|
(void*)(p->Answer + offset),
|
||||||
p->Scalar,
|
p->Scalar,
|
||||||
count);
|
count);
|
||||||
@@ -122,7 +96,6 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe void SpecialBufferCompute(MatrixParallelTaskPackage* p)
|
internal static unsafe void SpecialBufferCompute(MatrixParallelTaskPackage* p)
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
{
|
{
|
||||||
switch ((MatrixOperationSpecial)p->ComputeMode.ParameterStyle)
|
switch ((MatrixOperationSpecial)p->ComputeMode.ParameterStyle)
|
||||||
{
|
{
|
||||||
@@ -132,170 +105,8 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
MatrixParallelFactory.Release(p);
|
MatrixParallelFactory.Release(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
<<<<<<< HEAD
|
|
||||||
internal static unsafe void KernelComputeBinaryScalar(MatrixParallelTaskPackage* p)
|
|
||||||
=======
|
|
||||||
internal static unsafe void Compute_BinaryScalar(MatrixParallelTaskPackage* p)
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
{
|
|
||||||
int eSize = p->ElementSize;
|
|
||||||
|
|
||||||
// base pointer to matrix kernels
|
|
||||||
nint l = p->Left, r = p->Right, a = p->Result;
|
|
||||||
long
|
|
||||||
|
|
||||||
// set beginning value to counters for primary offsets
|
|
||||||
lCount = (long)p->LeftPrimOffset * p->LeftPrimStride,
|
|
||||||
rCount = (long)p->RightPrimOffset * p->RightPrimStride,
|
|
||||||
aCount = (long)p->ResultPrimOffset * p->ResultPrimStride,
|
|
||||||
pCount = int.Min(p->PrimCount, p->PrimColumnCountInTile + p->PrimTileOffset) /*_count of tile may be too much*/,
|
|
||||||
//edge to reset counters
|
|
||||||
lLimit = pCount - p->LeftPrimOffset,
|
|
||||||
rLimit = pCount - p->RightPrimOffset,
|
|
||||||
aLimit = pCount - p->ResultPrimOffset;
|
|
||||||
delegate* unmanaged[Cdecl]<IntPtr, IntPtr, IntPtr, ScalarPacket*, void> op =
|
|
||||||
(delegate* unmanaged[Cdecl]<IntPtr, IntPtr, IntPtr, ScalarPacket*, void>)p->ComputeHandle;
|
|
||||||
for (long i = p->PrimTileOffset % pCount; i < pCount; i++)
|
|
||||||
{
|
|
||||||
// update primary counters
|
|
||||||
// if reaches edge, reset to zero
|
|
||||||
lCount = i < lLimit ? lCount + p->LeftPrimStride : 0;
|
|
||||||
rCount = i < rLimit ? rCount + p->RightPrimStride : 0;
|
|
||||||
aCount = i < rLimit ? aCount + p->ResultPrimStride : 0;
|
|
||||||
|
|
||||||
// get kernel column pointers
|
|
||||||
nint left = l + (nint)(lCount * eSize);
|
|
||||||
nint right = r + (nint)(rCount * eSize);
|
|
||||||
nint ans = a + (nint)(aCount * eSize);
|
|
||||||
long
|
|
||||||
lc = (long)p->LeftSecOffset * p->LeftSecStride,
|
|
||||||
rc = (long)p->RightSecOffset * p->RightSecStride,
|
|
||||||
ac = (long)p->ResultSecOffset * p->ResultSecStride,
|
|
||||||
sCount = int.Min(p->SecCount, p->PrimColumnCountInTile * p->SecTileOffset);
|
|
||||||
long
|
|
||||||
ll = sCount - p->LeftSecOffset,
|
|
||||||
rl = sCount - p->RightSecOffset,
|
|
||||||
al = sCount - p->ResultSecOffset;
|
|
||||||
for (long j = p->SecTileOffset % sCount; j < sCount; j++)
|
|
||||||
{
|
|
||||||
lc = j < ll ? lc + p->LeftSecStride : 0;
|
|
||||||
rc = j < rl ? rc + p->RightSecStride : 0;
|
|
||||||
ac = j < al ? ac + p->ResultSecStride : 0;
|
|
||||||
op(left + (nint)lc, right + (nint)rc, ans + (nint)ac, p->Scalar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MatrixParallelFactory.Release(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
<<<<<<< HEAD
|
|
||||||
internal static unsafe void KernelComputeUnary(MatrixParallelTaskPackage* p)
|
|
||||||
=======
|
|
||||||
internal static unsafe void Compute_Unary(MatrixParallelTaskPackage* p)
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
{
|
|
||||||
int eSize = p->ElementSize;
|
|
||||||
|
|
||||||
// base pointer to matrix kernels
|
|
||||||
nint r = p->Right, a = p->Result;
|
|
||||||
long
|
|
||||||
|
|
||||||
// set beginning value to counters for primary offsets
|
|
||||||
rCount = (long)p->RightPrimOffset * p->RightPrimStride,
|
|
||||||
aCount = (long)p->ResultPrimOffset * p->ResultPrimStride,
|
|
||||||
pCount = int.Min(p->PrimCount, p->PrimColumnCountInTile + p->PrimTileOffset) /*_count of tile may be too much*/,
|
|
||||||
//edge to reset counters
|
|
||||||
rLimit = pCount - p->RightPrimOffset,
|
|
||||||
aLimit = pCount - p->ResultPrimOffset;
|
|
||||||
delegate* unmanaged[Cdecl]<IntPtr, IntPtr, void> op =
|
|
||||||
(delegate* unmanaged[Cdecl]<IntPtr, IntPtr, void>)p->ComputeHandle;
|
|
||||||
for (long i = p->PrimTileOffset % pCount; i < pCount; i++)
|
|
||||||
{
|
|
||||||
// update primary counters
|
|
||||||
// if reaches edge, reset to zero
|
|
||||||
rCount = i < rLimit ? rCount + p->RightPrimStride : 0;
|
|
||||||
aCount = i < rLimit ? aCount + p->ResultPrimStride : 0;
|
|
||||||
|
|
||||||
// get kernel column pointers
|
|
||||||
nint right = r + (nint)(rCount * eSize);
|
|
||||||
nint ans = a + (nint)(aCount * eSize);
|
|
||||||
long
|
|
||||||
rc = (long)p->RightSecOffset * p->RightSecStride,
|
|
||||||
ac = (long)p->ResultSecOffset * p->ResultSecStride,
|
|
||||||
sCount = int.Min(p->SecCount, p->PrimColumnCountInTile * p->SecTileOffset);
|
|
||||||
long
|
|
||||||
rl = sCount - p->RightSecOffset,
|
|
||||||
al = sCount - p->ResultSecOffset;
|
|
||||||
for (long j = p->SecTileOffset % sCount; j < sCount; j++)
|
|
||||||
{
|
|
||||||
rc = j < rl ? rc + p->RightSecStride : 0;
|
|
||||||
ac = j < al ? ac + p->ResultSecStride : 0;
|
|
||||||
op(right + (nint)rc, ans + (nint)ac);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MatrixParallelFactory.Release(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
<<<<<<< HEAD
|
|
||||||
internal static unsafe void KernelComputeUnaryScalar(MatrixParallelTaskPackage* p)
|
|
||||||
=======
|
|
||||||
internal static unsafe void Compute_UnaryScalar(MatrixParallelTaskPackage* p)
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
{
|
|
||||||
int eSize = p->ElementSize;
|
|
||||||
|
|
||||||
// base pointer to matrix kernels
|
|
||||||
nint r = p->Right, a = p->Result;
|
|
||||||
long
|
|
||||||
|
|
||||||
// set beginning value to counters for primary offsets
|
|
||||||
rCount = (long)p->RightPrimOffset * p->RightPrimStride,
|
|
||||||
aCount = (long)p->ResultPrimOffset * p->ResultPrimStride,
|
|
||||||
pCount = int.Min(p->PrimCount, p->PrimColumnCountInTile + p->PrimTileOffset) /*_count of tile may be too much*/,
|
|
||||||
//edge to reset counters
|
|
||||||
rLimit = pCount - p->RightPrimOffset,
|
|
||||||
aLimit = pCount - p->ResultPrimOffset;
|
|
||||||
delegate* unmanaged[Cdecl]<IntPtr, IntPtr, ScalarPacket*, void> op =
|
|
||||||
(delegate* unmanaged[Cdecl]<IntPtr, IntPtr, ScalarPacket*, void>)p->ComputeHandle;
|
|
||||||
for (long i = p->PrimTileOffset % pCount; i < pCount; i++)
|
|
||||||
{
|
|
||||||
// update primary counters
|
|
||||||
// if reaches edge, reset to zero
|
|
||||||
rCount = i < rLimit ? rCount + p->RightPrimStride : 0;
|
|
||||||
aCount = i < rLimit ? aCount + p->ResultPrimStride : 0;
|
|
||||||
|
|
||||||
// get kernel column pointers
|
|
||||||
nint right = r + (nint)(rCount * eSize);
|
|
||||||
nint ans = a + (nint)(aCount * eSize);
|
|
||||||
long
|
|
||||||
rc = (long)p->RightSecOffset * p->RightSecStride,
|
|
||||||
ac = (long)p->ResultSecOffset * p->ResultSecStride,
|
|
||||||
sCount = int.Min(p->SecCount, p->PrimColumnCountInTile * p->SecTileOffset);
|
|
||||||
long
|
|
||||||
rl = sCount - p->RightSecOffset,
|
|
||||||
al = sCount - p->ResultSecOffset;
|
|
||||||
for (long j = p->SecTileOffset % sCount; j < sCount; j++)
|
|
||||||
{
|
|
||||||
rc = j < rl ? rc + p->RightSecStride : 0;
|
|
||||||
ac = j < al ? ac + p->ResultSecStride : 0;
|
|
||||||
op(right + (nint)rc, ans + (nint)ac, p->Scalar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MatrixParallelFactory.Release(p);
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
}
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
internal static unsafe void PanelComputeBinary(MatrixParallelTaskPackage* p) { }
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,4 @@
|
|||||||
<<<<<<< HEAD
|
//-----------------------------------------------------------------------
|
||||||
<<<<<<< HEAD
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixParallel"
|
// file="MatrixParallel"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -35,20 +27,6 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Collections;
|
using StgSharp.Collections;
|
||||||
using System;
|
using System;
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Numeric
|
|
||||||
{
|
|
||||||
public static class MatrixParallel
|
|
||||||
=======
|
|
||||||
using System.Collections.Concurrent;
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -57,7 +35,6 @@ using System.Threading.Tasks;
|
|||||||
namespace StgSharp.Mathematics.Numeric
|
namespace StgSharp.Mathematics.Numeric
|
||||||
{
|
{
|
||||||
public static partial class MatrixParallel
|
public static partial class MatrixParallel
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
{
|
{
|
||||||
|
|
||||||
private static bool _meaningful;
|
private static bool _meaningful;
|
||||||
@@ -119,12 +96,4 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
}
|
}
|
||||||
=======
|
|
||||||
}
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
}
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixParallelThread"
|
// file="MatrixParallelThread"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -120,41 +112,6 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
<<<<<<< HEAD
|
|
||||||
case MatrixOperationStyle.KERNEL_OP:
|
|
||||||
switch (p->ComputeMode.ParameterStyle)
|
|
||||||
{
|
|
||||||
case MatrixOperationParam.RIGHT_ANS_PARAM:
|
|
||||||
<<<<<<< HEAD
|
|
||||||
MatrixComputeModel.KernelComputeUnary(p);
|
|
||||||
break;
|
|
||||||
case MatrixOperationParam.RIGHT_ANS_SCALAR_PARAM:
|
|
||||||
MatrixComputeModel.KernelComputeUnaryScalar(p);
|
|
||||||
break;
|
|
||||||
case MatrixOperationParam.LEFT_RIGHT_ANS_PARAM:
|
|
||||||
MatrixComputeModel.KernelComputeBinary(p);
|
|
||||||
break;
|
|
||||||
case MatrixOperationParam.LEFT_RIGHT_ANS_SCALAR_PARAM:
|
|
||||||
MatrixComputeModel.KernelComputeBinaryScalar(p);
|
|
||||||
=======
|
|
||||||
MatrixComputeModel.Compute_Unary(p);
|
|
||||||
break;
|
|
||||||
case MatrixOperationParam.RIGHT_ANS_SCALAR_PARAM:
|
|
||||||
MatrixComputeModel.Compute_UnaryScalar(p);
|
|
||||||
break;
|
|
||||||
case MatrixOperationParam.LEFT_RIGHT_ANS_PARAM:
|
|
||||||
MatrixComputeModel.Compute_Binary(p);
|
|
||||||
break;
|
|
||||||
case MatrixOperationParam.LEFT_RIGHT_ANS_SCALAR_PARAM:
|
|
||||||
MatrixComputeModel.Compute_BinaryScalar(p);
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -426,19 +383,9 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
private static extern IntPtr GetCurrentThread();
|
private static extern IntPtr GetCurrentThread();
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
private static extern nuint SetThreadAffinityMask(
|
private static extern nuint SetThreadAffinityMask(
|
||||||
IntPtr hThread,
|
IntPtr hThread,
|
||||||
nuint dwThreadAffinityMask);
|
nuint dwThreadAffinityMask);
|
||||||
=======
|
|
||||||
private static extern nuint SetThreadAffinityMask(IntPtr hThread, nuint dwThreadAffinityMask);
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
private static extern nuint SetThreadAffinityMask(
|
|
||||||
IntPtr hThread,
|
|
||||||
nuint dwThreadAffinityMask);
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|
||||||
[LibraryImport("kernel32.dll")]
|
[LibraryImport("kernel32.dll")]
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
|||||||
@@ -141,34 +141,14 @@ typedef void(SN_DECL *PNL_PROC_LRAS)(mat_panel *left, mat_panel *right, mat_pane
|
|||||||
typedef void(SN_DECL *PNL_PROC_RAS)(mat_panel *right, mat_panel *ans, scalar_pack *scalar);
|
typedef void(SN_DECL *PNL_PROC_RAS)(mat_panel *right, mat_panel *ans, scalar_pack *scalar);
|
||||||
|
|
||||||
#define PNL_PROC(T_type, T_arch, T_op_name) T_type##_pnl_##T_op_name##_##T_arch
|
#define PNL_PROC(T_type, T_arch, T_op_name) T_type##_pnl_##T_op_name##_##T_arch
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
#define DECLARE_PNL_PROC_ANS(T_type, T_arch, T_op_name) \
|
#define DECLARE_PNL_PROC_ANS(T_type, T_arch, T_op_name) \
|
||||||
INTERNAL void SN_DECL PNL_PROC(T_type, T_arch, \
|
INTERNAL void SN_DECL PNL_PROC(T_type, T_arch, \
|
||||||
T_op_name)(MAT_PANEL_##T_arch##(T_type) *restrict ans)
|
T_op_name)(MAT_PANEL_##T_arch##(T_type) *restrict ans)
|
||||||
=======
|
|
||||||
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
#define DECLARE_PNL_PROC_ANS(T_type, T_arch, T_op_name) \
|
|
||||||
INTERNAL void SN_DECL PNL_PROC(T_type, T_arch, \
|
|
||||||
T_op_name)(MAT_PANEL_##T_arch##(T_type) *restrict ans)
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
#define DECLARE_PNL_PROC_LEFT_RIGHT_ANS(T_type, T_arch, T_op_name) \
|
#define DECLARE_PNL_PROC_LEFT_RIGHT_ANS(T_type, T_arch, T_op_name) \
|
||||||
INTERNAL void SN_DECL PNL_PROC(T_type, T_arch, \
|
INTERNAL void SN_DECL PNL_PROC(T_type, T_arch, \
|
||||||
T_op_name)(MAT_PANEL_##T_arch##(T_type) const *left, \
|
T_op_name)(MAT_PANEL_##T_arch##(T_type) const *left, \
|
||||||
MAT_PANEL_##T_arch##(T_type) const *right, \
|
MAT_PANEL_##T_arch##(T_type) const *right, \
|
||||||
MAT_PANEL_##T_arch##(T_type) *restrict ans)
|
MAT_PANEL_##T_arch##(T_type) *restrict ans)
|
||||||
#define DECLARE_PNL_PROC_LEFT_RIGHT_ANS(T_type, T_arch, T_op_name) \
|
|
||||||
INTERNAL void SN_DECL PNL_PROC(T_type, T_arch, \
|
|
||||||
T_op_name)(MAT_PANEL_##T_arch##(T_type) const *left, \
|
|
||||||
MAT_PANEL_##T_arch##(T_type) const *right, \
|
|
||||||
MAT_PANEL_##T_arch##(T_type) *restrict ans)
|
|
||||||
#define DECLARE_PNL_PROC_LEFT_RIGHT_ANS_SCALAR(T_type, T_arch, T_op_name) \
|
|
||||||
INTERNAL void SN_DECL PNL_PROC(T_type, T_arch, T_op_name)( \
|
|
||||||
MAT_PANEL_##T_arch##(T_type) const *left, \
|
|
||||||
MAT_PANEL_##T_arch##(T_type) const *right, \
|
|
||||||
MAT_PANEL_##T_arch##(T_type) *restrict ans, scalar_pack const *scalar)
|
|
||||||
#define DECLARE_PNL_PROC_LEFT_RIGHT_ANS_SCALAR(T_type, T_arch, T_op_name) \
|
#define DECLARE_PNL_PROC_LEFT_RIGHT_ANS_SCALAR(T_type, T_arch, T_op_name) \
|
||||||
INTERNAL void SN_DECL PNL_PROC(T_type, T_arch, T_op_name)( \
|
INTERNAL void SN_DECL PNL_PROC(T_type, T_arch, T_op_name)( \
|
||||||
MAT_PANEL_##T_arch##(T_type) const *left, \
|
MAT_PANEL_##T_arch##(T_type) const *left, \
|
||||||
@@ -249,11 +229,6 @@ DECLARE_BUF_PROC_ANS_SCALAR(float, 512, fill);
|
|||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region fma
|
#pragma region fma
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
DECLARE_PNL_PROC_ANS(float, sse, clear);
|
DECLARE_PNL_PROC_ANS(float, sse, clear);
|
||||||
DECLARE_PNL_PROC_ANS(float, avx, clear);
|
DECLARE_PNL_PROC_ANS(float, avx, clear);
|
||||||
DECLARE_PNL_PROC_ANS(float, 512, clear);
|
DECLARE_PNL_PROC_ANS(float, 512, clear);
|
||||||
@@ -262,13 +237,6 @@ DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, sse, fma);
|
|||||||
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx, fma);
|
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx, fma);
|
||||||
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx_fma, fma);
|
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx_fma, fma);
|
||||||
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, 512, fma);
|
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, 512, fma);
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, sse, fma);
|
|
||||||
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx, fma);
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
@@ -310,14 +278,7 @@ typedef struct sn_intrinsic {
|
|||||||
BUF_PROC_LRA f32_buffer_sub;
|
BUF_PROC_LRA f32_buffer_sub;
|
||||||
KER_PROC_RA f32_buffer_transpose;
|
KER_PROC_RA f32_buffer_transpose;
|
||||||
PANEL_PROC f32_build_panel;
|
PANEL_PROC f32_build_panel;
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
PANEL_PROC f32_clear_panel;
|
PANEL_PROC f32_clear_panel;
|
||||||
=======
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
PANEL_PROC f32_clear_panel;
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
VECTORNORMALIZEPROC f32_normalize_3;
|
VECTORNORMALIZEPROC f32_normalize_3;
|
||||||
PNL_PROC_LRA f32_panel_fma;
|
PNL_PROC_LRA f32_panel_fma;
|
||||||
PANEL_PROC f32_store_panel;
|
PANEL_PROC f32_store_panel;
|
||||||
|
|||||||
@@ -117,26 +117,12 @@ extern __declspec(align(64)) sn_zero_kernel_u64 SN_ZERO_KERNEL;
|
|||||||
int col_index, int row_index)
|
int col_index, int row_index)
|
||||||
|
|
||||||
/* Declarations for AVX float variant */
|
/* Declarations for AVX float variant */
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
DECLARE_BUILD_PANEL(sse, float);
|
DECLARE_BUILD_PANEL(sse, float);
|
||||||
DECLARE_BUILD_PANEL(avx, float);
|
DECLARE_BUILD_PANEL(avx, float);
|
||||||
DECLARE_BUILD_PANEL(512, float);
|
DECLARE_BUILD_PANEL(512, float);
|
||||||
DECLARE_STORE_PANEL(sse, float);
|
DECLARE_STORE_PANEL(sse, float);
|
||||||
DECLARE_STORE_PANEL(avx, float);
|
DECLARE_STORE_PANEL(avx, float);
|
||||||
DECLARE_STORE_PANEL(512, float);
|
DECLARE_STORE_PANEL(512, float);
|
||||||
=======
|
|
||||||
=======
|
|
||||||
DECLARE_BUILD_PANEL(sse, float);
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
DECLARE_BUILD_PANEL(avx, float);
|
|
||||||
DECLARE_BUILD_PANEL(512, float);
|
|
||||||
DECLARE_STORE_PANEL(sse, float);
|
|
||||||
DECLARE_STORE_PANEL(avx, float);
|
|
||||||
<<<<<<< HEAD
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
DECLARE_STORE_PANEL(512, float);
|
DECLARE_STORE_PANEL(512, float);
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|
||||||
#endif /* SN_MATKERNEL */
|
#endif /* SN_MATKERNEL */
|
||||||
|
|||||||
@@ -1,52 +1,29 @@
|
|||||||
#include "sn_intrinsic.h"
|
#include "sn_intrinsic.h"
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
DECLARE_PNL_PROC_ANS(float, sse, clear)
|
DECLARE_PNL_PROC_ANS(float, sse, clear)
|
||||||
{
|
{
|
||||||
register __m128 zero = _mm_setzero_ps();
|
register __m128 zero = _mm_setzero_ps();
|
||||||
PANEL_COL_VEC((*ans), 0, 0) = zero;
|
for (size_t i = 0; i < 4; i++) {
|
||||||
PANEL_COL_VEC((*ans), 1, 0) = zero;
|
PANEL_COL_VEC((*ans), i, 0) = zero;
|
||||||
PANEL_COL_VEC((*ans), 2, 0) = zero;
|
}
|
||||||
PANEL_COL_VEC((*ans), 3, 0) = zero;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_PNL_PROC_ANS(float, avx, clear)
|
DECLARE_PNL_PROC_ANS(float, avx, clear)
|
||||||
{
|
{
|
||||||
register __m256 zero = _mm256_setzero_ps();
|
register __m256 zero = _mm256_setzero_ps();
|
||||||
<<<<<<< HEAD
|
|
||||||
PANEL_COL_VEC((*ans), 0, 0) = zero;
|
|
||||||
PANEL_COL_VEC((*ans), 1, 0) = zero;
|
|
||||||
PANEL_COL_VEC((*ans), 2, 0) = zero;
|
|
||||||
PANEL_COL_VEC((*ans), 3, 0) = zero;
|
|
||||||
=======
|
|
||||||
for (size_t i = 0; i < 8; i++) {
|
for (size_t i = 0; i < 8; i++) {
|
||||||
PANEL_COL_VEC((*ans), i, 0) = zero;
|
PANEL_COL_VEC((*ans), i, 0) = zero;
|
||||||
}
|
}
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_PNL_PROC_ANS(float, 512, clear)
|
DECLARE_PNL_PROC_ANS(float, 512, clear)
|
||||||
{
|
{
|
||||||
register __m512 zero = _mm512_setzero_ps();
|
register __m512 zero = _mm512_setzero_ps();
|
||||||
<<<<<<< HEAD
|
|
||||||
PANEL_COL_VEC((*ans), 0, 0) = zero;
|
|
||||||
PANEL_COL_VEC((*ans), 1, 0) = zero;
|
|
||||||
PANEL_COL_VEC((*ans), 2, 0) = zero;
|
|
||||||
PANEL_COL_VEC((*ans), 3, 0) = zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
for (size_t i = 0; i < 16; i++) {
|
for (size_t i = 0; i < 16; i++) {
|
||||||
PANEL_COL_VEC((*ans), i, 0) = zero;
|
PANEL_COL_VEC((*ans), i, 0) = zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
// Matrix transpose implementations
|
// Matrix transpose implementations
|
||||||
DECLARE_KER_PROC_RIGHT_ANS(float, sse, transpose)
|
DECLARE_KER_PROC_RIGHT_ANS(float, sse, transpose)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,10 +54,6 @@ DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, sse, fma)
|
|||||||
|
|
||||||
// ans = left * right + ans
|
// ans = left * right + ans
|
||||||
// right is not transposed
|
// right is not transposed
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx_fma, fma)
|
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx_fma, fma)
|
||||||
{
|
{
|
||||||
static const __m256i idx0 = { 1, 1, 1, 1, 1, 1, 1, 1 };
|
static const __m256i idx0 = { 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||||
@@ -101,11 +97,6 @@ DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx_fma, fma)
|
|||||||
|
|
||||||
// ans = left * right + ans
|
// ans = left * right + ans
|
||||||
// right is not transposed
|
// right is not transposed
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx, fma)
|
DECLARE_PNL_PROC_LEFT_RIGHT_ANS(float, avx, fma)
|
||||||
{
|
{
|
||||||
static const __m256i idx0 = { 1, 1, 1, 1, 1, 1, 1, 1 };
|
static const __m256i idx0 = { 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||||
|
|||||||
@@ -41,18 +41,10 @@ DECLARE_BUILD_PANEL(avx, float)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
DECLARE_BUILD_PANEL(sse, float)
|
|
||||||
{
|
|
||||||
/* Single kernel -> 4 columns, each is one __m128 column vector. */
|
|
||||||
const MAT_KERNEL(float) *src = matrix + (col_index * row_length + row_index);
|
|
||||||
=======
|
|
||||||
DECLARE_BUILD_PANEL(sse, float)
|
DECLARE_BUILD_PANEL(sse, float)
|
||||||
{
|
{
|
||||||
/* Single kernel -> 4 columns, each is one __m128 column vector. */
|
/* Single kernel -> 4 columns, each is one __m128 column vector. */
|
||||||
const MAT_KERNEL(float) *src = matrix + (row_index * col_length + col_index);
|
const MAT_KERNEL(float) *src = matrix + (row_index * col_length + col_index);
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|
||||||
for (int pc = 0; pc < 4; ++pc) {
|
for (int pc = 0; pc < 4; ++pc) {
|
||||||
PANEL_COL_VEC((*panel), pc, 0) = src->xmm[pc];
|
PANEL_COL_VEC((*panel), pc, 0) = src->xmm[pc];
|
||||||
@@ -62,35 +54,22 @@ DECLARE_BUILD_PANEL(sse, float)
|
|||||||
DECLARE_BUILD_PANEL(512, float)
|
DECLARE_BUILD_PANEL(512, float)
|
||||||
{
|
{
|
||||||
const MAT_KERNEL(float) *const zero = (const MAT_KERNEL(float) *)&SN_ZERO_KERNEL;
|
const MAT_KERNEL(float) *const zero = (const MAT_KERNEL(float) *)&SN_ZERO_KERNEL;
|
||||||
<<<<<<< HEAD
|
|
||||||
const MAT_KERNEL(float) *k[4][4];
|
|
||||||
=======
|
|
||||||
const MAT_KERNEL(float) * k[4][4];
|
const MAT_KERNEL(float) * k[4][4];
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|
||||||
for (int kc = 0; kc < 4; ++kc) {
|
for (int kc = 0; kc < 4; ++kc) {
|
||||||
for (int kr = 0; kr < 4; ++kr) {
|
for (int kr = 0; kr < 4; ++kr) {
|
||||||
const int col = col_index + kc;
|
const int col = col_index + kc;
|
||||||
const int row = row_index + kr;
|
const int row = row_index + kr;
|
||||||
k[kc][kr] = (col < col_length && row < row_length) ?
|
k[kc][kr] = (col < col_length && row < row_length) ?
|
||||||
<<<<<<< HEAD
|
|
||||||
(matrix + (col * row_length + row)) :
|
|
||||||
=======
|
|
||||||
(matrix + (row * col_length + col)) :
|
(matrix + (row * col_length + col)) :
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
zero;
|
zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Each panel column corresponds to a kernel column (0..3) within a block col (0..3). */
|
/* Each panel column corresponds to a kernel column (0..3) within a block col (0..3). */
|
||||||
for (int pc = 0; pc < 16; ++pc) {
|
for (int pc = 0; pc < 16; ++pc) {
|
||||||
<<<<<<< HEAD
|
|
||||||
const int blk_col = pc >> 2; /* which kernel column block (0..3) */
|
const int blk_col = pc >> 2; /* which kernel column block (0..3) */
|
||||||
const int kc_col = pc & 3; /* column inside a 4x4 kernel */
|
const int kc_col = pc & 3; /* column inside a 4x4 kernel */
|
||||||
=======
|
|
||||||
const int blk_col = pc >> 2; /* which kernel column block (0..3) */
|
|
||||||
const int kc_col = pc & 3; /* column inside a 4x4 kernel */
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|
||||||
const __m128 r0 = k[blk_col][0]->xmm[kc_col];
|
const __m128 r0 = k[blk_col][0]->xmm[kc_col];
|
||||||
const __m128 r1 = k[blk_col][1]->xmm[kc_col];
|
const __m128 r1 = k[blk_col][1]->xmm[kc_col];
|
||||||
@@ -107,11 +86,6 @@ DECLARE_BUILD_PANEL(512, float)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
DECLARE_STORE_PANEL(avx, float)
|
DECLARE_STORE_PANEL(avx, float)
|
||||||
{
|
{
|
||||||
const int Q = 8; /* fixed for AVX float panel */
|
const int Q = 8; /* fixed for AVX float panel */
|
||||||
@@ -167,18 +141,10 @@ DECLARE_STORE_PANEL(avx, float)
|
|||||||
k_lb->xmm[kc_col] = bot128;
|
k_lb->xmm[kc_col] = bot128;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
DECLARE_STORE_PANEL(sse, float)
|
|
||||||
{
|
|
||||||
MAT_KERNEL(float) *dst = matrix + (col_index * row_length + row_index);
|
|
||||||
=======
|
|
||||||
|
|
||||||
DECLARE_STORE_PANEL(sse, float)
|
DECLARE_STORE_PANEL(sse, float)
|
||||||
{
|
{
|
||||||
MAT_KERNEL(float) *dst = matrix + (row_index * col_length + col_index);
|
MAT_KERNEL(float) *dst = matrix + (row_index * col_length + col_index);
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|
||||||
for (int pc = 0; pc < 4; ++pc) {
|
for (int pc = 0; pc < 4; ++pc) {
|
||||||
const __m128 col = PANEL_COL_VEC((*panel), pc, 0);
|
const __m128 col = PANEL_COL_VEC((*panel), pc, 0);
|
||||||
@@ -189,34 +155,21 @@ DECLARE_STORE_PANEL(sse, float)
|
|||||||
DECLARE_STORE_PANEL(512, float)
|
DECLARE_STORE_PANEL(512, float)
|
||||||
{
|
{
|
||||||
MAT_KERNEL(float) zero;
|
MAT_KERNEL(float) zero;
|
||||||
<<<<<<< HEAD
|
|
||||||
MAT_KERNEL(float) *k[4][4];
|
|
||||||
=======
|
|
||||||
MAT_KERNEL(float) * k[4][4];
|
MAT_KERNEL(float) * k[4][4];
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|
||||||
for (int kc = 0; kc < 4; ++kc) {
|
for (int kc = 0; kc < 4; ++kc) {
|
||||||
for (int kr = 0; kr < 4; ++kr) {
|
for (int kr = 0; kr < 4; ++kr) {
|
||||||
const int col = col_index + kc;
|
const int col = col_index + kc;
|
||||||
const int row = row_index + kr;
|
const int row = row_index + kr;
|
||||||
k[kc][kr] = (col < col_length && row < row_length) ?
|
k[kc][kr] = (col < col_length && row < row_length) ?
|
||||||
<<<<<<< HEAD
|
|
||||||
(matrix + (col * row_length + row)) :
|
|
||||||
=======
|
|
||||||
(matrix + (row * col_length + col)) :
|
(matrix + (row * col_length + col)) :
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
&zero;
|
&zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int pc = 0; pc < 16; ++pc) {
|
for (int pc = 0; pc < 16; ++pc) {
|
||||||
<<<<<<< HEAD
|
|
||||||
const int blk_col = pc >> 2; /* which kernel column block (0..3) */
|
const int blk_col = pc >> 2; /* which kernel column block (0..3) */
|
||||||
const int kc_col = pc & 3; /* column inside a 4x4 kernel */
|
const int kc_col = pc & 3; /* column inside a 4x4 kernel */
|
||||||
=======
|
|
||||||
const int blk_col = pc >> 2; /* which kernel column block (0..3) */
|
|
||||||
const int kc_col = pc & 3; /* column inside a 4x4 kernel */
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|
||||||
const __m512 col = PANEL_COL_VEC((*panel), pc, 0);
|
const __m512 col = PANEL_COL_VEC((*panel), pc, 0);
|
||||||
|
|
||||||
@@ -234,8 +187,3 @@ DECLARE_STORE_PANEL(512, float)
|
|||||||
k[blk_col][3]->xmm[kc_col] = r3;
|
k[blk_col][3]->xmm[kc_col] = r3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
|
|||||||
@@ -65,23 +65,11 @@ void load_intrinsic_sse(sn_intrinsic *context)
|
|||||||
context->city_hash_simplify = city_hash_simplify_sse;
|
context->city_hash_simplify = city_hash_simplify_sse;
|
||||||
context->factorial_simd = factorial_simd_sse;
|
context->factorial_simd = factorial_simd_sse;
|
||||||
context->index_pair = index_pair_sse;
|
context->index_pair = index_pair_sse;
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
context->f32_clear_panel = PNL_PROC(float, sse, clear);
|
|
||||||
context->f32_build_panel = BUILD_PANEL(sse, float);
|
|
||||||
context->f32_buffer_add = BUF_PROC(float, sse, add);
|
|
||||||
context->f32_panel_fma = PNL_PROC(float, sse, fma);
|
|
||||||
=======
|
|
||||||
context->f32_buffer_add = BUF_PROC(float, sse, add);
|
|
||||||
context->f32_panel_fma = KER_PROC(float, sse, fma);
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
context->f32_store_panel = STORE_PANEL(sse, float);
|
context->f32_store_panel = STORE_PANEL(sse, float);
|
||||||
context->f32_clear_panel = PNL_PROC(float, sse, clear);
|
context->f32_clear_panel = PNL_PROC(float, sse, clear);
|
||||||
context->f32_build_panel = BUILD_PANEL(sse, float);
|
context->f32_build_panel = BUILD_PANEL(sse, float);
|
||||||
context->f32_buffer_add = BUF_PROC(float, sse, add);
|
context->f32_buffer_add = BUF_PROC(float, sse, add);
|
||||||
context->f32_panel_fma = PNL_PROC(float, sse, fma);
|
context->f32_panel_fma = PNL_PROC(float, sse, fma);
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
context->f32_buffer_fill = BUF_PROC(float, sse, fill);
|
context->f32_buffer_fill = BUF_PROC(float, sse, fill);
|
||||||
context->variant = BUF_PROC(float, sse, scalar_mul);
|
context->variant = BUF_PROC(float, sse, scalar_mul);
|
||||||
context->f32_buffer_sub = BUF_PROC(float, sse, sub);
|
context->f32_buffer_sub = BUF_PROC(float, sse, sub);
|
||||||
@@ -95,23 +83,11 @@ void load_intrinsic_avx(sn_intrinsic *context)
|
|||||||
context->city_hash_simplify = city_hash_simplify_sse;
|
context->city_hash_simplify = city_hash_simplify_sse;
|
||||||
context->factorial_simd = factorial_simd_sse;
|
context->factorial_simd = factorial_simd_sse;
|
||||||
context->index_pair = index_pair_sse;
|
context->index_pair = index_pair_sse;
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
context->f32_clear_panel = PNL_PROC(float, avx, clear);
|
|
||||||
context->f32_build_panel = BUILD_PANEL(avx, float);
|
|
||||||
context->f32_buffer_add = BUF_PROC(float, avx, add);
|
|
||||||
context->f32_panel_fma = PNL_PROC(float, avx, fma);
|
|
||||||
=======
|
|
||||||
context->f32_buffer_add = BUF_PROC(float, avx, add);
|
|
||||||
context->f32_panel_fma = KER_PROC(float, sse, fma);
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
context->f32_store_panel = STORE_PANEL(avx, float);
|
context->f32_store_panel = STORE_PANEL(avx, float);
|
||||||
context->f32_clear_panel = PNL_PROC(float, avx, clear);
|
context->f32_clear_panel = PNL_PROC(float, avx, clear);
|
||||||
context->f32_build_panel = BUILD_PANEL(avx, float);
|
context->f32_build_panel = BUILD_PANEL(avx, float);
|
||||||
context->f32_buffer_add = BUF_PROC(float, avx, add);
|
context->f32_buffer_add = BUF_PROC(float, avx, add);
|
||||||
context->f32_panel_fma = PNL_PROC(float, avx, fma);
|
context->f32_panel_fma = PNL_PROC(float, avx, fma);
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
context->f32_buffer_fill = BUF_PROC(float, avx, fill);
|
context->f32_buffer_fill = BUF_PROC(float, avx, fill);
|
||||||
context->variant = BUF_PROC(float, avx, scalar_mul);
|
context->variant = BUF_PROC(float, avx, scalar_mul);
|
||||||
context->f32_buffer_sub = BUF_PROC(float, avx, sub);
|
context->f32_buffer_sub = BUF_PROC(float, avx, sub);
|
||||||
@@ -125,23 +101,11 @@ void load_intrinsic_512(sn_intrinsic *context)
|
|||||||
context->city_hash_simplify = city_hash_simplify_sse;
|
context->city_hash_simplify = city_hash_simplify_sse;
|
||||||
context->factorial_simd = factorial_simd_sse;
|
context->factorial_simd = factorial_simd_sse;
|
||||||
context->index_pair = index_pair_sse;
|
context->index_pair = index_pair_sse;
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
context->f32_clear_panel = PNL_PROC(float, sse, clear);
|
|
||||||
context->f32_build_panel = BUILD_PANEL(512, float);
|
|
||||||
context->f32_buffer_add = BUF_PROC(float, 512, add);
|
|
||||||
context->f32_panel_fma = PNL_PROC(float, 512, fma);
|
|
||||||
=======
|
|
||||||
context->f32_buffer_add = BUF_PROC(float, 512, add);
|
|
||||||
context->f32_panel_fma = KER_PROC(float, sse, fma);
|
|
||||||
>>>>>>> 7bcb460a3994dda40f24cae0044b5a36f4f16515
|
|
||||||
=======
|
|
||||||
context->f32_store_panel = STORE_PANEL(512, float);
|
context->f32_store_panel = STORE_PANEL(512, float);
|
||||||
context->f32_clear_panel = PNL_PROC(float, 512, clear);
|
context->f32_clear_panel = PNL_PROC(float, 512, clear);
|
||||||
context->f32_build_panel = BUILD_PANEL(512, float);
|
context->f32_build_panel = BUILD_PANEL(512, float);
|
||||||
context->f32_buffer_add = BUF_PROC(float, 512, add);
|
context->f32_buffer_add = BUF_PROC(float, 512, add);
|
||||||
context->f32_panel_fma = PNL_PROC(float, 512, fma);
|
context->f32_panel_fma = PNL_PROC(float, 512, fma);
|
||||||
>>>>>>> stgsharp-dev/giga
|
|
||||||
context->f32_buffer_fill = BUF_PROC(float, 512, fill);
|
context->f32_buffer_fill = BUF_PROC(float, 512, fill);
|
||||||
context->variant = BUF_PROC(float, 512, scalar_mul);
|
context->variant = BUF_PROC(float, 512, scalar_mul);
|
||||||
context->f32_buffer_sub = BUF_PROC(float, 512, sub);
|
context->f32_buffer_sub = BUF_PROC(float, 512, sub);
|
||||||
|
|||||||
Reference in New Issue
Block a user