mat queue and mat predictor confuses. i need time to design and organize
This commit is contained in:
@@ -33,6 +33,7 @@ using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices.JavaScript;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -42,12 +43,6 @@ namespace StgSharp.Mathematics.Numeric
|
||||
internal unsafe interface IMatrixParallelQueue<TSelf> where TSelf : IMatrixParallelQueue<TSelf>
|
||||
{
|
||||
|
||||
static abstract TSelf Create(
|
||||
MatrixParallelTask* baseTask,
|
||||
L4 buffer,
|
||||
int numaCount
|
||||
);
|
||||
|
||||
void Return(
|
||||
MatrixParallelTask* task,
|
||||
in L4CacheLine left,
|
||||
@@ -64,32 +59,35 @@ namespace StgSharp.Mathematics.Numeric
|
||||
|
||||
}
|
||||
|
||||
internal sealed unsafe class BufferQueueLeftRightAns : IMatrixParallelQueue<BufferQueueLeftRightAns>
|
||||
internal interface IBufferQueueLeftRightAns : IMatrixParallelQueue<IBufferQueueLeftRightAns> { }
|
||||
|
||||
internal sealed unsafe class BufferQueueLeftRightAns_FullNuma : IMatrixParallelQueue<IBufferQueueLeftRightAns>
|
||||
{
|
||||
|
||||
private MatrixParallelTask* _baseTask;
|
||||
private bool _needNuma;
|
||||
private L4 _buffer;
|
||||
private readonly nuint _byteSize;
|
||||
private readonly nuint _count;
|
||||
private volatile nuint _cursor;
|
||||
private readonly nuint Count;
|
||||
|
||||
private BufferQueueLeftRightAns() { }
|
||||
private volatile nuint _mat1;
|
||||
private volatile nuint _mat2;
|
||||
private volatile nuint _mat3;
|
||||
|
||||
private BufferQueueLeftRightAns(
|
||||
MatrixParallelTask* baseTask
|
||||
private BufferQueueLeftRightAns_FullNuma() { }
|
||||
|
||||
internal BufferQueueLeftRightAns_FullNuma(
|
||||
MatrixParallelTask* baseTask
|
||||
)
|
||||
{
|
||||
_baseTask = baseTask;
|
||||
Count = ((nuint)_baseTask->CommonX) * ((nuint)_baseTask->CommonY);
|
||||
}
|
||||
_count = ((nuint)_baseTask->CommonX) * ((nuint)_baseTask->CommonY);
|
||||
_byteSize = ((nuint)_baseTask->Mat1) + (((nuint)_baseTask->CommonX) * ((nuint)_baseTask->CommonY) * _baseTask->ElementType.Size);
|
||||
|
||||
public static unsafe BufferQueueLeftRightAns Create(
|
||||
MatrixParallelTask* baseTask,
|
||||
L4 buffer,
|
||||
int numaCount
|
||||
)
|
||||
{
|
||||
return new BufferQueueLeftRightAns(baseTask);
|
||||
|
||||
_mat1 = (nuint)_baseTask->Mat1;
|
||||
_mat2 = (nuint)_baseTask->Mat2;
|
||||
_mat3 = (nuint)_baseTask->Mat3;
|
||||
}
|
||||
|
||||
public unsafe void Return(
|
||||
@@ -121,11 +119,11 @@ namespace StgSharp.Mathematics.Numeric
|
||||
}
|
||||
|
||||
private class Predictor(
|
||||
BufferQueueLeftRightAns host
|
||||
BufferQueueLeftRightAns_FullNuma host
|
||||
) : IL4Predict
|
||||
{
|
||||
|
||||
private readonly BufferQueueLeftRightAns _host;
|
||||
private readonly BufferQueueLeftRightAns_FullNuma _host;
|
||||
|
||||
public PredictResult Predict(
|
||||
Span<CacheLineDescription> node,
|
||||
@@ -136,16 +134,16 @@ namespace StgSharp.Mathematics.Numeric
|
||||
nuint mat1 = (nuint)_host._baseTask->Mat1;
|
||||
nuint mat2 = (nuint)_host._baseTask->Mat2;
|
||||
nuint mat3 = (nuint)_host._baseTask->Mat3;
|
||||
nuint _cur = begin * _host._baseTask->ElementType.Size;
|
||||
nuint _cur = 16 * begin * _host._baseTask->ElementType.Size;
|
||||
nuint mat1_cur = ((nuint)_host._baseTask->Mat1) + _cur;
|
||||
nuint mat2_cur = ((nuint)_host._baseTask->Mat2) + _cur;
|
||||
nuint mat3_cur = ((nuint)_host._baseTask->Mat3) + _cur;
|
||||
nuint end = ((nuint)_host._baseTask->Mat1) + (((nuint)_host._baseTask->CommonX) * ((nuint)_host._baseTask->CommonY) * _host._baseTask->ElementType.Size);
|
||||
nuint end = _host._byteSize;
|
||||
nuint mat1_end = ((nuint)_host._baseTask->Mat1) + end;
|
||||
nuint mat2_end = ((nuint)_host._baseTask->Mat2) + end;
|
||||
nuint mat3_end = ((nuint)_host._baseTask->Mat3) + end;
|
||||
|
||||
nuint size = 1024 * 16 * _host._baseTask->ElementType.Size;
|
||||
nuint size = 1024 * 16 * ((nuint)_host._baseTask->ElementType.Size);
|
||||
for (int i = 0; i < node.Length; i += 3)
|
||||
{
|
||||
int cycle = i / 3;
|
||||
|
||||
Reference in New Issue
Block a user