Daily update on 20251230-224423 by Nitload Youmu. Additional Message : Adding compute support for mat<double>. Import all opengl core profile fucntions
Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -49,7 +49,7 @@ namespace StgSharp.HighPerformance
|
||||
{
|
||||
ReadOnlySpan<char> nameSpan = Name.AsSpan();
|
||||
fixed (char* cptr = nameSpan) {
|
||||
return NativeIntrinsic.Intrinsic.city_hash_simplify(cptr, Name.Length);
|
||||
return NativeIntrinsic.Context.city_hash_simplify(cptr, Name.Length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,17 +61,9 @@ namespace StgSharp.HighPerformance
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int ElementSideLength<T>() where T : unmanaged, INumber<T>
|
||||
{
|
||||
return Math.Max(8, AlignmentBytes / sizeof(T));
|
||||
return PanelSideLength<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>();
|
||||
@@ -115,28 +107,43 @@ namespace StgSharp.HighPerformance
|
||||
[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;
|
||||
return PanelSideFromBits<T>(256) / 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;
|
||||
return PanelSideFromBits<T>(512) / 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;
|
||||
return PanelSideFromBits<T>(128) / 4;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static int PanelSideFromBits<T>(int vectorBits) where T : unmanaged, INumber<T>
|
||||
{
|
||||
int elemBits = sizeof(T) * 8;
|
||||
|
||||
// Q = max(4, vectorBits/64, vectorBits/elemBits)
|
||||
int by64 = vectorBits / 64;
|
||||
int byElem = vectorBits / elemBits;
|
||||
int side = Math.Max(4, Math.Max(by64, byElem));
|
||||
return side;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static int PanelSideLength<T>() where T : unmanaged, INumber<T>
|
||||
{
|
||||
return NativeIntrinsic.IntrinsicLevel switch
|
||||
{
|
||||
IntrinsicLevel.SSE => PanelSideFromBits<T>(128),
|
||||
IntrinsicLevel.AVX2 => PanelSideFromBits<T>(256),
|
||||
IntrinsicLevel.AVX512 => PanelSideFromBits<T>(512),
|
||||
_ => 0
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="UnsafeCompute"
|
||||
// Project: StgSharp
|
||||
@@ -35,19 +35,19 @@ namespace StgSharp.HighPerformance
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe int CityHashSimplify(char* span, int length)
|
||||
{
|
||||
return NativeIntrinsic.Intrinsic.city_hash_simplify(span, length);
|
||||
return NativeIntrinsic.Context.city_hash_simplify(span, length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe int CityHashSimplify(char* span, int begin, int length)
|
||||
{
|
||||
return NativeIntrinsic.Intrinsic.city_hash_simplify(span + begin, length);
|
||||
return NativeIntrinsic.Context.city_hash_simplify(span + begin, length);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe int IndexOfCharPair(char* source, int pairValue, int length)
|
||||
{
|
||||
return NativeIntrinsic.Intrinsic.index_pair(source, pairValue, length);
|
||||
return NativeIntrinsic.Context.index_pair(source, pairValue, length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user