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
@@ -89,7 +89,7 @@ namespace StgSharp.Mathematics.Numeric.Linear
MkProc op = (MkProc)NumericalModule.GlobalContext.
mat_mk[elementType.IntrinsicNode].
Get(task->ComputeHandle);
if (count <= 256)
if ((count <= 256) || !MatrixParallel.IsParallelMeaningful)
{
op(task);
return;
@@ -101,43 +101,10 @@ namespace StgSharp.Mathematics.Numeric.Linear
return;
}
pool = MatrixParallel.LeadParallel(count / 1024);
MatrixParallelWrap taskGroup = MatrixParallel.ScheduleTask<SequentialPredictor>(pool, task);
MatrixParallelWrap taskGroup = MatrixParallel.ScheduleTask<BufferSequentialPredictor>(pool, task);
taskGroup.LaunchParallel(SleepMode.DeepSleep);
taskGroup.Dispose();
}
private struct SequentialPredictor : IMatrixPredictor<SequentialPredictor>
{
public static PredictPolicy Policy => PredictPolicy.Sequential;
public PredictResult Predict(
Span<CacheLinePrediction> node,
out int count
)
{
throw new NotImplementedException();
}
public void Prefetch(
nuint origin,
ulong policy,
Span<byte> cache
)
{
throw new NotImplementedException();
}
public void WriteBack(
nuint origin,
ulong policy,
ReadOnlySpan<byte> cache
)
{
throw new NotImplementedException();
}
}
}
}