merge to main stream

This commit is contained in:
Nitload
2026-03-19 22:03:30 +08:00
20 changed files with 361 additions and 174 deletions
+57
View File
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Root Type="DevExpress.CodeAnalysis.CodeCleanUp.CodeCleanUpOptions">
<Options Language="C#">
<Providers>
<Item Id="{ef51c8cb-e48a-498f-98b2-eadda592c4c7}" />
<Item Id="{C47B114F-EEAE-46FC-9562-454E8F9196C0}" />
<Item Id="{20943A7B-2B32-4727-8E9D-61CB5B5F2A0D}" />
<Item Id="{528bdd86-5882-4b4c-b717-e0ec33958bd7}" />
<Item Id="{40c971cf-ebeb-419d-a559-6183d8d0d6a4}" />
<Item Id="{00bb41b3-3de9-458a-93c1-1f126253eab0}" />
<Item Id="{4B42E272-EE39-4E83-924C-B2458D827DE3}" />
<Item Id="{0e6b7b2c-84e6-4eee-83d1-6149282c8501}">
<Enabled>False</Enabled>
<ApplyOnSave>False</ApplyOnSave>
</Item>
<Item Id="{8e24f031-d25c-4ddb-86a5-c28f8fc354eb}" />
<Item Id="{03781427-dea7-45b0-9eef-81abe2961a61}" />
<Item Id="{37bde68f-a39d-4791-adba-8ad7b2952ab0}" />
<Item Id="{d2f76d4e-97a9-4031-a7a2-23f192201426}" />
<Item Id="{bb96a982-bed0-4d8f-93a7-1e1ce7493e96}" />
<Item Id="{3824f6f0-fee1-4847-94ff-1efa133ba199}" />
<Item Id="{e950f01e-2b15-4da5-8176-cafe3cc883d9}" />
<Item Id="{12f6d456-d2ec-407e-aa44-2b74d7c56e9c}" />
<Item Id="{d24bd9c7-7686-4101-9ec1-f61c19af8d2e}" />
<Item Id="{f804e36e-414f-409c-9b90-63b7727745a7}" />
<Item Id="{ffa114f4-9122-46e4-96c8-655d54c904e6}" />
<Item Id="{5d712912-91ed-4728-ba16-ac1821b702ca}" />
<Item Id="{4216ef39-52bd-4e7f-92a7-673406f92bc8}" />
<Item Id="{f410df1e-6e44-4854-a3f0-14bb756113f9}" />
<Item Id="{ab07124b-0893-4a2d-b6f5-39bfa9f10148}" />
<Item Id="{163af547-186c-4fa1-9a3e-b9b0a1ceec32}" />
<Item Id="{73a73e0e-5575-4c34-a97b-a942c6da1f90}" />
<Item Id="{f7752b2b-7ba5-43ec-b0f7-7f45c21c1c23}" />
<Item Id="{9dab2827-57cc-40e9-a330-a0626261453e}" />
<Item Id="{6bf7cfc1-1332-4bec-982e-c2d0968237cd}">
<Enabled>True</Enabled>
<ApplyOnSave>True</ApplyOnSave>
</Item>
<Item Id="{7e640eab-b585-47a5-afdc-0f110357cebb}" />
<Item Id="{44ac74a7-dba7-45aa-b2ca-8094b85cb9c9}" />
<Item Id="{2cd1441b-9e0f-4e39-bd8c-8aaa6e2a1728}" />
<Item Id="{41388575-074b-49f2-b3bc-9d28b212bd1a}" />
<Item Id="{4fa0bfa3-0a7e-471b-9933-3a379bdd5bd7}" />
<Item Id="{1f88209e-45e2-40b9-a235-1df251df05dd}">
<Enabled>True</Enabled>
<ApplyOnSave>True</ApplyOnSave>
</Item>
<Item Id="{086b0e70-893d-4b97-a6cf-d366ddbae573}" />
<Item Id="{4771fd98-4357-4780-b479-a7a875fec011}" />
<Item Id="{174C98E6-48C4-42D0-BC30-35EDE6377C9B}">
<Enabled>True</Enabled>
<ApplyOnSave>True</ApplyOnSave>
</Item>
<Item Id="{53ccb10f-f7af-40a6-9472-d05054672052}" />
</Providers>
</Options>
</Root>
@@ -32,7 +32,7 @@ using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Mathematics
namespace StgSharp.HighPerformance.ProcessorAbstraction
{
/// <summary>
/// Abstraction for a wide SIMD register or equivalent packed numeric storage. Provides raw
@@ -36,7 +36,7 @@ using System.Runtime.Intrinsics.X86;
using System.Text;
namespace StgSharp.Mathematics
namespace StgSharp.HighPerformance.ProcessorAbstraction
{
[StructLayout(LayoutKind.Explicit, Pack = 16)]
public unsafe struct M128 : IRegisterPresentation
@@ -35,7 +35,7 @@ using System.Runtime.Intrinsics;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Mathematics
namespace StgSharp.HighPerformance.ProcessorAbstraction
{
[StructLayout(LayoutKind.Explicit, Pack = 16)]
public unsafe struct M256 : IRegisterPresentation
@@ -35,7 +35,7 @@ using System.Runtime.Intrinsics;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Mathematics
namespace StgSharp.HighPerformance.ProcessorAbstraction
{
[StructLayout(LayoutKind.Explicit, Size = 64, Pack = 64)]
public unsafe struct M512 : IRegisterPresentation
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="M64"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// 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.Intrinsics;
namespace StgSharp.Mathematics
namespace StgSharp.HighPerformance.ProcessorAbstraction
{
[StructLayout(LayoutKind.Explicit, Pack = 8)]
public unsafe struct M64 : IRegisterPresentation
@@ -47,17 +47,21 @@ namespace StgSharp.Mathematics
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]);
}
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();
}
public override bool Equals(object obj)
public override bool Equals(
object obj
)
{
return obj is M64 m64 && this == m64;
}
@@ -68,32 +72,47 @@ namespace StgSharp.Mathematics
}
[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)]);
}
public static bool operator !=(M64 left, M64 right)
public static bool operator !=(
M64 left,
M64 right
)
{
return !(left == right);
}
public static M64 operator <<(M64 value, int shift)
public static M64 operator <<(
M64 value,
int shift
)
{
M64 result = new M64();
result.value = value.value << shift;
return result;
}
public static bool operator ==(M64 left, M64 right)
public static bool operator ==(
M64 left,
M64 right
)
{
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();
result.value = value.value << shift;
return result;
return new()
{
value = value.value << shift
};
}
}
+1 -1
View File
@@ -24,7 +24,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="HighPerformance\RegisterAbstraction\" />
<Folder Include="HighPerformance\ProcessorAbstraction\" />
</ItemGroup>
</Project>
@@ -159,6 +159,14 @@ namespace StgSharp.Mathematics.Internal
scalar);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly nint Get(
MatrixIntrinsicHandle index
)
{
return this[(int)index];
}
}
[InlineArray(MatrixElementType.IntrinsicCount)]
@@ -36,10 +36,10 @@ namespace StgSharp.Mathematics.Internal
internal unsafe struct MatrixParallelTask
{
[FieldOffset(0)]public MatrixKernel* Mat1; // 8
[FieldOffset(0)] public MatrixKernel* Mat1; // 8
[FieldOffset(8)] public MatrixKernel* Mat2; // 8
[FieldOffset(16)] public MatrixKernel* Mat3; // 16
[FieldOffset(40)] public int Common_k;
[FieldOffset(40)] public int CommonK;
[FieldOffset(32)] public int CommonX;
[FieldOffset(36)] public int CommonY;
[FieldOffset(44)] public int i;
@@ -25,6 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance.ProcessorAbstraction;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -0,0 +1,129 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="MatrixCompute.Sequential"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics.Numeric.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using unsafe MkProc = delegate* unmanaged[Cdecl]<StgSharp.Mathematics.Internal.MatrixParallelTask*, void>;
namespace StgSharp.Mathematics.Numeric.Linear
{
public static unsafe partial class MatrixCompute
{
public static void Add(
Matrix<float> left,
Matrix<float> right,
Matrix<float> ans
)
{
ArgumentNullException.ThrowIfNull(left, nameof(left));
ArgumentNullException.ThrowIfNull(right, nameof(right));
ArgumentNullException.ThrowIfNull(ans, nameof(ans));
if ((left.ColumnLength != right.ColumnLength) ||
(left.RowLength != right.RowLength) ||
(left.ColumnLength != ans.ColumnLength) ||
(left.RowLength != ans.RowLength)) {
throw new MatrixDimensionMismatchException<float>(
left, right, ans
);
}
MatrixElementType f32 = MatrixElementType.F32;
long count = ((long)left.KernelColumnLength) * left.KernelRowLength;
MatrixKernel<float>* leftPtr = left.Buffer;
MatrixKernel<float>* rightPtr = right.Buffer;
MatrixKernel<float>* ansPtr = ans.Buffer;
MkProc add = (MkProc)NumericalModule.GlobalContext.
mat_mk[f32.IntrinsicNode].
Get(MatrixIntrinsicHandle.Add);
MatrixParallelTask* t = stackalloc MatrixParallelTask[1];
t->Mat1 = (MatrixKernel*)leftPtr;
t->Mat2 = (MatrixKernel*)rightPtr;
t->Mat3 = (MatrixKernel*)ansPtr;
t->ElementType = MatrixElementType.F64;
t->Scalar.Data<long>(0) = count;
if (count <= 256)
{
add(t);
// .buffer_add(leftPtr, rightPtr, ansPtr, count);
return;
} else if (count <= 1024)
{
MatrixParallelThread[] pool = MatrixParallel.LeadParallel(1);
add(t);
MatrixParallel.ReturnParallelResources(ref pool);
return;
}
MatrixParallelWrap taskGroup = MatrixParallel.ScheduleTask<SequentialPredictor>((nuint)add, t);
taskGroup.LaunchParallel(SleepMode.DeepSleep);
taskGroup.Dispose();
return;
}
private sealed class SequentialPredictor : MatrixPredictor<SequentialPredictor>
{
public override bool Predict(
Span<CacheLinePrediction> node,
out int count
)
{
throw new NotImplementedException();
}
public override void Prefetch(
nuint origin,
ulong policy,
Span<byte> cache
)
{
throw new NotImplementedException();
}
public override void WriteBack(
nuint origin,
ulong policy,
ReadOnlySpan<byte> cache
)
{
throw new NotImplementedException();
}
}
}
}
@@ -25,6 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance.Memory;
using StgSharp.Internal;
using StgSharp.Mathematics;
using System;
@@ -37,7 +38,7 @@ using System.Threading.Tasks;
namespace StgSharp.Mathematics.Numeric
{
public partial class MatrixCompute
public static partial class MatrixCompute
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -45,8 +46,8 @@ namespace StgSharp.Mathematics.Numeric
MatrixKernel<T>* buffer,
int colLength,
int x,
int y)
where T: unmanaged, INumber<T>
int y
) where T : unmanaged, INumber<T>
{
return (MatrixKernel*)(buffer + (colLength * x + y));
}
@@ -26,10 +26,12 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Collections;
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Internal;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
@@ -46,16 +48,10 @@ namespace StgSharp.Mathematics.Numeric
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe MatrixParallelWrap ScheduleTask(
internal static unsafe MatrixParallelWrap ScheduleTask<TTask>(
nuint computeHandle,
MatrixParallelTask* package
)
{
return ScheduleBufferTask(package);
}
private static unsafe MatrixParallelWrap ScheduleBufferTask(
MatrixParallelTask* package
)
) where TTask : IPrefetchPredict
{
/*
int primCount = package->PrimCount;
@@ -67,8 +63,10 @@ namespace StgSharp.Mathematics.Numeric
long recommendCount = /*count / /**/ 1024;
MatrixParallelThread[] pool = LeadParallel((int)recommendCount);
MatrixParallelWrap wrap = new MatrixParallelWrap(pool);
wrap.TaskQueue = MatrixParallelQueue.Rent(package);
MatrixParallelWrap wrap = new(pool)
{
TaskQueue = MatrixParallelQueue.Rent(package)
};
return wrap;
}
@@ -26,6 +26,7 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using Microsoft.VisualBasic.FileIO;
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics.Internal;
using System;
using System.Collections.Concurrent;
@@ -41,6 +42,8 @@ namespace StgSharp.Mathematics.Numeric
internal unsafe class MatrixParallelQueue
{
// TODO 为各种不同的计算策略设计专门的预测器,以适配L4
private static ConcurrentStack<MatrixParallelQueue> _recycle = [];
private MatrixParallelTask* _package;
private ulong _cursor;
@@ -58,7 +61,7 @@ namespace StgSharp.Mathematics.Numeric
queue = new MatrixParallelQueue();
}
queue._package = pack;
queue._maxCount = (ulong)pack->CommonX * (ulong)pack->CommonY;
queue._maxCount = ((ulong)pack->CommonX) * ((ulong)pack->CommonY);
queue._cursor = 0;
return queue;
}
@@ -47,12 +47,12 @@ namespace StgSharp.Mathematics.Numeric
}
public class MatrixParallelWrap : IDisposable
public sealed class MatrixParallelWrap : IDisposable
{
private MatrixParallelThread[] _threads;
private bool _disposed = false;
private int _count;
private bool _disposed;
private readonly CountdownEvent _countdownEvent;
internal MatrixParallelWrap(
MatrixParallelThread[] threadArray
@@ -60,7 +60,7 @@ namespace StgSharp.Mathematics.Numeric
{
_threads = threadArray;
IsMultithread = threadArray.Length > 1;
_count = threadArray.Length;
_countdownEvent = new CountdownEvent(threadArray.Length);
}
public ReadOnlySpan<MatrixParallelThread> Threads
@@ -81,11 +81,8 @@ namespace StgSharp.Mathematics.Numeric
public void Dispose()
{
if (_disposed) {
return;
}
MatrixParallel.ReturnParallelResources(ref _threads);
_disposed = true;
Dispose(true);
GC.SuppressFinalize(this);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -104,19 +101,30 @@ namespace StgSharp.Mathematics.Numeric
public void WaitAllWraps()
{
if (_disposed) {
throw new ObjectDisposedException(typeof(MatrixParallelWrap).Name);
}
SpinWait.SpinUntil(() => Volatile.Read(ref _count) == 0);
ObjectDisposedException.ThrowIf(_disposed, nameof(MatrixParallelWrap));
_countdownEvent.Wait();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void ReportThreadAccomplished()
{
ObjectDisposedException.ThrowIf(_disposed, nameof(MatrixParallelWrap));
_ = _countdownEvent.Signal();
}
private void Dispose(
bool disposing
)
{
if (_disposed) {
throw new ObjectDisposedException(typeof(MatrixParallelWrap).Name);
return;
}
Interlocked.Decrement(ref _count);
if (disposing)
{
MatrixParallel.ReturnParallelResources(ref _threads);
_countdownEvent.Dispose();
}
_disposed = true;
}
}
@@ -0,0 +1,59 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="MatrixPredictor"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Mathematics.Numeric.Runtime
{
public abstract class MatrixPredictor<TSelf> : IPrefetchPredict
where TSelf : MatrixPredictor<TSelf>
{
public abstract bool Predict(
Span<CacheLinePrediction> node,
out int count
);
public abstract void Prefetch(
nuint origin,
ulong policy,
Span<byte> cache
);
public abstract void WriteBack(
nuint origin,
ulong policy,
ReadOnlySpan<byte> cache
);
}
}
@@ -1,117 +0,0 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="MatrixTaskFactory"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Mathematics;
using StgSharp.Mathematics.Internal;
using StgSharp.Mathematics.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using hlsfAllocator = StgSharp.Mathematics.Memory.HybridLayerSegregatedFitAllocator;
namespace StgSharp.Mathematics.Numeric
{
internal static unsafe class MatrixParallelFactory
{
private static hlsfAllocator _intermediateResult;
private static
#if NET9_0_OR_GREATER
Lock
#else
object
#endif
_hlsfLock = new();
private static SlabAllocator<ScalarPacket> _scalarAllocator ;
private static SlabAllocator<MatrixParallelTask> _wrapAllocator;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static MatrixParallelTask* CreateBaseTask()
{
MatrixParallelTask* p = (MatrixParallelTask*)_wrapAllocator.Allocate();
Span<byte> s = new Span<byte>((byte*)p, sizeof(MatrixParallelTask));
s.Fill(0);
return p;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ScalarPacket* CreateScalarPacket()
{
ScalarPacket* p = (ScalarPacket*)_scalarAllocator.Allocate();
return p;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe MatrixParallelTask* FromExistPackage(
MatrixParallelTask* exist
)
{
MatrixParallelTask* ptr = (MatrixParallelTask*)_wrapAllocator.Allocate();
MatrixParallelTask.Copy(exist, ptr);
return ptr;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Release(
ScalarPacket* source
)
{
_scalarAllocator.Free((nuint)source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Release(
MatrixParallelTask* source
)
{
_wrapAllocator.Free((nuint)source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void Init()
{
if (_intermediateResult is null)
{
_intermediateResult = new hlsfAllocator(64 * 16 * 16);
_scalarAllocator = SlabAllocator.Create<ScalarPacket>(64 * 1024, SlabBufferLayout.Chunked);
_wrapAllocator = SlabAllocator.
Create<MatrixParallelTask>(128 * 1024, SlabBufferLayout.Chunked);
}
}
}
}
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<Folder Include="View\" />
<Folder Include="State\" />
<Folder Include="Service\" />
</ItemGroup>
</Project>
+1 -1
View File
@@ -472,4 +472,4 @@ window.Show();
---
*本文档随项目演进持续更新。架构思想的提出与设计版权归 Nitload-NSI 所有。*
*本文档随项目演进持续更新。架构思想的提出与设计版权归 Nitload 所有。*
+16 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.3.11520.95 d18.3
# Visual Studio Version 17
VisualStudioVersion = 17.14.36705.20 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Common", "StgSharp.Common\StgSharp.Common.csproj", "{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}"
ProjectSection(ProjectDependencies) = postProject
@@ -34,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.RegularAnalysis",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Graphics", "StgSharp.Graphics\StgSharp.Graphics.csproj", "{80CD3DDE-0642-451D-82DF-0DE422FC6E34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgSharp.UnserInterface", "StgSharp.UserInterface\StgSharp.UnserInterface.csproj", "{E999C63D-93F8-DE1C-C004-6D7E8172FE68}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
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|x64.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE