daily commit on 0916
This commit is contained in:
@@ -32,6 +32,7 @@ using StgSharp.HighPerformance.Memory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -40,21 +41,31 @@ namespace StgSharp.Mathematics
|
||||
internal static unsafe class MatrixParallelFactory
|
||||
{
|
||||
|
||||
private static readonly SlabAllocator<ScalarPacket> _scalarAllocator = SlabAllocator<ScalarPacket>.Create(64, SlabBufferLayout.Chunked, true);
|
||||
private static SlabAllocator<ScalarPacket> _scalarAllocator ;
|
||||
|
||||
private static readonly SlabAllocator<MatrixParallelTaskPackage> _wrapAllocator = SlabAllocator<MatrixParallelTaskPackage>.Create(64, SlabBufferLayout.Chunked, true);
|
||||
private static SlabAllocator<MatrixParallelTaskPackage> _wrapAllocator ;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static MatrixParallelTaskPackage* CreateBaseTask()
|
||||
{
|
||||
MatrixParallelTaskPackage* p = (MatrixParallelTaskPackage*)_wrapAllocator.Allocate();
|
||||
return p;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ScalarPacket* CreateScalarPacket()
|
||||
{
|
||||
ScalarPacket* p = (ScalarPacket*)_scalarAllocator.Allocate();
|
||||
return p;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Release(ScalarPacket* source)
|
||||
{
|
||||
_scalarAllocator.Free((nuint)source);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Release(MatrixParallelTaskPackage* source)
|
||||
{
|
||||
if (source->Scalar != null) {
|
||||
@@ -63,5 +74,12 @@ namespace StgSharp.Mathematics
|
||||
_wrapAllocator.Free((nuint)source);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void Init()
|
||||
{
|
||||
_scalarAllocator = SlabAllocator<ScalarPacket>.Create(64, SlabBufferLayout.Chunked, true);
|
||||
_wrapAllocator = SlabAllocator<MatrixParallelTaskPackage>.Create(64, SlabBufferLayout.Chunked, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user