better kernel fma
This commit is contained in:
@@ -39,7 +39,7 @@ namespace StgSharp.Internal
|
||||
|
||||
private static readonly IntrinsicContext _intrinsicContext = new();
|
||||
|
||||
public static IntrinsicLevel IntrinsicLevel { get; set; }
|
||||
public static SIMDID IntrinsicMask { get; set; }
|
||||
|
||||
internal static IntrinsicContext Context
|
||||
{
|
||||
@@ -49,39 +49,32 @@ namespace StgSharp.Internal
|
||||
|
||||
internal static void InitIntrinsicContext()
|
||||
{
|
||||
int statCode;
|
||||
ulong statCode = 0;
|
||||
|
||||
fixed (IntrinsicContext* cPtr = &_intrinsicContext) {
|
||||
statCode = LoadIntrinsicFunction(cPtr);
|
||||
}
|
||||
|
||||
switch (statCode)
|
||||
SIMDID id = new()
|
||||
{
|
||||
Mask = statCode
|
||||
};
|
||||
switch (id.MaskByte[1])
|
||||
{
|
||||
case 0:
|
||||
|
||||
Dialogue.PostError(new PlatformNotSupportedException("No SIMD instructions supported on current hardware platform"));
|
||||
Environment.Exit(-1);
|
||||
break;
|
||||
default:
|
||||
IntrinsicLevel = (IntrinsicLevel)statCode;
|
||||
break;
|
||||
}
|
||||
IntrinsicMask = id;
|
||||
}
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "load_intrinsic_function")]
|
||||
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
|
||||
private static partial int LoadIntrinsicFunction(IntrinsicContext* context);
|
||||
|
||||
}
|
||||
|
||||
internal enum IntrinsicLevel : sbyte
|
||||
{
|
||||
|
||||
Non = 0,
|
||||
SSE = 1,
|
||||
AVX2 = 2,
|
||||
AVX512 = 3,
|
||||
NEON = -1
|
||||
private static partial ulong LoadIntrinsicFunction(
|
||||
IntrinsicContext* context
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user