can create and retire matrix thread by numa infomation

This commit is contained in:
Youmu Liu
2026-04-15 18:08:08 +08:00
parent fdf11c729f
commit 2203a46eb7
11 changed files with 160 additions and 123 deletions
@@ -48,7 +48,7 @@ namespace StgSharp.Mathematics.Numeric
}
public unsafe partial class MatrixParallelThread : IDisposable
public unsafe partial class MatrixParallelThread : IEquatable<MatrixParallelThread>, IDisposable
{
private IntrinsicContext* _context;
@@ -122,7 +122,7 @@ namespace StgSharp.Mathematics.Numeric
State = MatrixThreadState.Born;
// Bind OS-thread affinity once when the worker starts running
ThreadHelper.SetThreadAffinity(BindedLogicalCore);
ThreadHelper.BindToLogicalCore(BindedLogicalCore);
_ = Thread.Yield();
if (Simd.Mask != 0)
{
@@ -186,6 +186,13 @@ namespace StgSharp.Mathematics.Numeric
IntrinsicContext* context,
ulong id
);
public bool Equals(
MatrixParallelThread? other
)
{
return (other is not null) && ReferenceEquals(this, other);
}
#pragma warning restore CA5393
}
}