L4 briefly pass unit test
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ using System.Numerics;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics
|
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Abstraction for a wide SIMD register or equivalent packed numeric storage. Provides raw
|
/// Abstraction for a wide SIMD register or equivalent packed numeric storage. Provides raw
|
||||||
+1
-1
@@ -36,7 +36,7 @@ using System.Runtime.Intrinsics.X86;
|
|||||||
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics
|
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit, Pack = 16)]
|
[StructLayout(LayoutKind.Explicit, Pack = 16)]
|
||||||
public unsafe struct M128 : IRegisterPresentation
|
public unsafe struct M128 : IRegisterPresentation
|
||||||
+1
-1
@@ -35,7 +35,7 @@ using System.Runtime.Intrinsics;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics
|
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit, Pack = 16)]
|
[StructLayout(LayoutKind.Explicit, Pack = 16)]
|
||||||
public unsafe struct M256 : IRegisterPresentation
|
public unsafe struct M256 : IRegisterPresentation
|
||||||
+1
-1
@@ -35,7 +35,7 @@ using System.Runtime.Intrinsics;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics
|
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 64, Pack = 64)]
|
[StructLayout(LayoutKind.Explicit, Size = 64, Pack = 64)]
|
||||||
public unsafe struct M512 : IRegisterPresentation
|
public unsafe struct M512 : IRegisterPresentation
|
||||||
+33
-14
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="M64"
|
// file="M64"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload Space
|
// AuthorGroup: Nitload
|
||||||
// Copyright (c) Nitload Space. All rights reserved.
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Intrinsics;
|
using System.Runtime.Intrinsics;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics
|
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit, Pack = 8)]
|
[StructLayout(LayoutKind.Explicit, Pack = 8)]
|
||||||
public unsafe struct M64 : IRegisterPresentation
|
public unsafe struct M64 : IRegisterPresentation
|
||||||
@@ -47,17 +47,21 @@ namespace StgSharp.Mathematics
|
|||||||
Unsafe.SkipInit(out value);
|
Unsafe.SkipInit(out value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ref T AsRef<T>() where T: unmanaged,INumber<T>
|
public ref T AsRef<T>() where T : unmanaged,INumber<T>
|
||||||
{
|
{
|
||||||
return ref Unsafe.As<byte, T>(ref buffer[0]);
|
return ref Unsafe.As<byte, T>(ref buffer[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BroadCastFrom<T>(T value) where T: unmanaged, INumber<T>
|
public void BroadCastFrom<T>(
|
||||||
|
T value
|
||||||
|
) where T : unmanaged, INumber<T>
|
||||||
{
|
{
|
||||||
vec = Vector64.Create(value).AsSingle();
|
vec = Vector64.Create(value).AsSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(
|
||||||
|
object obj
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return obj is M64 m64 && this == m64;
|
return obj is M64 m64 && this == m64;
|
||||||
}
|
}
|
||||||
@@ -68,32 +72,47 @@ namespace StgSharp.Mathematics
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public ref T Member<T>(int index) where T: unmanaged, INumber<T>
|
public ref T Member<T>(
|
||||||
|
int index
|
||||||
|
) where T : unmanaged, INumber<T>
|
||||||
{
|
{
|
||||||
return ref Unsafe.As<byte, T>(ref buffer[index * sizeof(T)]);
|
return ref Unsafe.As<byte, T>(ref buffer[index * sizeof(T)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator !=(M64 left, M64 right)
|
public static bool operator !=(
|
||||||
|
M64 left,
|
||||||
|
M64 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return !(left == right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static M64 operator <<(M64 value, int shift)
|
public static M64 operator <<(
|
||||||
|
M64 value,
|
||||||
|
int shift
|
||||||
|
)
|
||||||
{
|
{
|
||||||
M64 result = new M64();
|
M64 result = new M64();
|
||||||
result.value = value.value << shift;
|
result.value = value.value << shift;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator ==(M64 left, M64 right)
|
public static bool operator ==(
|
||||||
|
M64 left,
|
||||||
|
M64 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return left.value == right.value;
|
return left.value == right.value;
|
||||||
}
|
}
|
||||||
public static M64 operator >>(M64 value, int shift)
|
public static M64 operator >>(
|
||||||
|
M64 value,
|
||||||
|
int shift
|
||||||
|
)
|
||||||
{
|
{
|
||||||
M64 result = new M64();
|
return new()
|
||||||
result.value = value.value << shift;
|
{
|
||||||
return result;
|
value = value.value << shift
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="HighPerformance\RegisterAbstraction\" />
|
<Folder Include="HighPerformance\ProcessorAbstraction\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
using StgSharp.HighPerformance.ProcessorAbstraction;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using Microsoft.VisualBasic.FileIO;
|
using Microsoft.VisualBasic.FileIO;
|
||||||
|
using StgSharp.HighPerformance.Memory;
|
||||||
using StgSharp.Mathematics.Internal;
|
using StgSharp.Mathematics.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
@@ -41,6 +42,8 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
internal unsafe class MatrixParallelQueue
|
internal unsafe class MatrixParallelQueue
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// TODO 为各种不同的计算策略设计专门的预测器,以适配L4
|
||||||
|
|
||||||
private static ConcurrentStack<MatrixParallelQueue> _recycle = [];
|
private static ConcurrentStack<MatrixParallelQueue> _recycle = [];
|
||||||
private MatrixParallelTask* _package;
|
private MatrixParallelTask* _package;
|
||||||
private ulong _cursor;
|
private ulong _cursor;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
public void WaitAllWraps()
|
public void WaitAllWraps()
|
||||||
{
|
{
|
||||||
if (_disposed) {
|
if (_disposed) {
|
||||||
throw new ObjectDisposedException(typeof(MatrixParallelWrap).Name);
|
throw new ObjectDisposedException(nameof(MatrixParallelWrap));
|
||||||
}
|
}
|
||||||
SpinWait.SpinUntil(() => Volatile.Read(ref _count) == 0);
|
SpinWait.SpinUntil(() => Volatile.Read(ref _count) == 0);
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
internal void ReportThreadAccomplished()
|
internal void ReportThreadAccomplished()
|
||||||
{
|
{
|
||||||
if (_disposed) {
|
if (_disposed) {
|
||||||
throw new ObjectDisposedException(typeof(MatrixParallelWrap).Name);
|
throw new ObjectDisposedException(nameof(MatrixParallelWrap));
|
||||||
}
|
}
|
||||||
Interlocked.Decrement(ref _count);
|
Interlocked.Decrement(ref _count);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="View\" />
|
||||||
|
<Folder Include="State\" />
|
||||||
|
<Folder Include="Service\" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -472,4 +472,4 @@ window.Show();
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
*本文档随项目演进持续更新。架构思想的提出与设计版权归 Nitload-NSI 所有。*
|
*本文档随项目演进持续更新。架构思想的提出与设计版权归 Nitload 所有。*
|
||||||
|
|||||||
+16
-2
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 18
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 18.3.11520.95 d18.3
|
VisualStudioVersion = 17.14.36705.20 d17.14
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Common", "StgSharp.Common\StgSharp.Common.csproj", "{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Common", "StgSharp.Common\StgSharp.Common.csproj", "{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
@@ -34,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.RegularAnalysis",
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Graphics", "StgSharp.Graphics\StgSharp.Graphics.csproj", "{80CD3DDE-0642-451D-82DF-0DE422FC6E34}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Graphics", "StgSharp.Graphics\StgSharp.Graphics.csproj", "{80CD3DDE-0642-451D-82DF-0DE422FC6E34}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgSharp.UnserInterface", "StgSharp.UserInterface\StgSharp.UnserInterface.csproj", "{E999C63D-93F8-DE1C-C004-6D7E8172FE68}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|ARM64 = Debug|ARM64
|
Debug|ARM64 = Debug|ARM64
|
||||||
@@ -152,6 +154,18 @@ Global
|
|||||||
{80CD3DDE-0642-451D-82DF-0DE422FC6E34}.Release|ARM64.Build.0 = Release|ARM64
|
{80CD3DDE-0642-451D-82DF-0DE422FC6E34}.Release|ARM64.Build.0 = Release|ARM64
|
||||||
{80CD3DDE-0642-451D-82DF-0DE422FC6E34}.Release|x64.ActiveCfg = Release|x64
|
{80CD3DDE-0642-451D-82DF-0DE422FC6E34}.Release|x64.ActiveCfg = Release|x64
|
||||||
{80CD3DDE-0642-451D-82DF-0DE422FC6E34}.Release|x64.Build.0 = Release|x64
|
{80CD3DDE-0642-451D-82DF-0DE422FC6E34}.Release|x64.Build.0 = Release|x64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.PerformanceDebug|ARM64.ActiveCfg = PerformanceDebug|ARM64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.PerformanceDebug|ARM64.Build.0 = PerformanceDebug|ARM64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.PerformanceDebug|x64.ActiveCfg = PerformanceDebug|x64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.PerformanceDebug|x64.Build.0 = PerformanceDebug|x64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.Release|ARM64.Build.0 = Release|ARM64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{E999C63D-93F8-DE1C-C004-6D7E8172FE68}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Reference in New Issue
Block a user