Remove hlsf, TLSF.alloc is ok

This commit is contained in:
Youmu Liu
2026-05-11 18:08:35 +08:00
parent 5706c89563
commit b59d414e20
21 changed files with 267 additions and 1514 deletions
@@ -34,6 +34,8 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Tlsf = global::StgSharp.HighPerformance.Memory.TwoLayerSegregatedFitAllocator;
namespace StgSharp.Mathematics.Numeric
{
public unsafe partial class Matrix<T>
@@ -45,7 +47,7 @@ namespace StgSharp.Mathematics.Numeric
int columnLength,
int rowLength,
MatrixLayout layout,
HybridLayerSegregatedFitAllocator allocator
TwoLayerSegregatedFitAllocator allocator
)
{
ArgumentNullException.ThrowIfNull(allocator);
@@ -75,7 +77,7 @@ namespace StgSharp.Mathematics.Numeric
long requiredBytes = kernelCount * MatrixKernel<T>.Size;
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(requiredBytes, nameof(requiredBytes));
HlsfHandle handle = allocator.Alloc((uint)requiredBytes);
Tlsf.Handle handle = allocator.Alloc((uint)requiredBytes);
MatrixStorageHLSF<T> storage = new MatrixStorageHLSF<T>(allocator, handle);
Matrix<T> matrix = new Matrix<T>(MatrixKernelBoarder.Create(layout), new MatrixSize(columnLength,
@@ -35,7 +35,7 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using HLSFAllocator = global::StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocator;
using Tlsf = global::StgSharp.HighPerformance.Memory.TwoLayerSegregatedFitAllocator;
namespace StgSharp.Mathematics.Numeric
{
@@ -53,13 +53,14 @@ namespace StgSharp.Mathematics.Numeric
}
internal class MatrixStorageHLSF<T>(
HLSFAllocator allocator,
HlsfHandle handle
Tlsf allocator,
Tlsf.Handle handle
) : MatrixStorage<T> where T : unmanaged, INumber<T>
{
internal readonly HLSFAllocator _allocator = allocator;
internal readonly HlsfHandle _handle = handle;
internal readonly Tlsf.Handle _handle = handle;
internal readonly Tlsf _allocator = allocator;
protected internal override unsafe T* BufferPointer => (T*)_handle.Pointer;