back to matrix, but trouble in combining L4 predict with matrixparallelqueue

This commit is contained in:
Youmu Liu
2026-03-20 20:04:45 +08:00
parent 48c308ae3c
commit 0ac7b2b71f
5 changed files with 113 additions and 15 deletions
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixParallelQueue"
// 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
@@ -42,14 +42,13 @@ namespace StgSharp.Mathematics.Numeric
internal unsafe class MatrixParallelQueue
{
private static ConcurrentStack<MatrixParallelQueue> _recycle = [];
private MatrixParallelTask* _package;
private static readonly ConcurrentStack<MatrixParallelQueue> _recycle = [];
private ulong _cursor;
private ulong _maxCount;
private MatrixParallelQueue() { }
public MatrixParallelTask* Package => _package;
public MatrixParallelTask* BaseTask { get; private set; }
public MatrixElementType ElementType { get; private set; }
@@ -58,12 +57,13 @@ namespace StgSharp.Mathematics.Numeric
public static MatrixParallelQueue Rent(
MatrixElementType elementType,
MatrixIntrinsicHandle handle,
MatrixParallelTask* pack)
MatrixParallelTask* pack
)
{
if (!_recycle.TryPop(out MatrixParallelQueue? queue)) {
queue = new MatrixParallelQueue();
}
queue._package = pack;
queue.BaseTask = pack;
queue._maxCount = ((ulong)pack->CommonX) * ((ulong)pack->CommonY);
queue._cursor = 0;
queue.ElementType = elementType;
@@ -71,13 +71,17 @@ namespace StgSharp.Mathematics.Numeric
return queue;
}
public static void Return(MatrixParallelQueue queue)
public static void Return(
MatrixParallelQueue queue
)
{
_recycle.Push(queue);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Steal(MatrixParallelTask* task)
public bool Steal(
MatrixParallelTask* task
)
{
// TODO 使用提取的内容填充task
throw new NotImplementedException();