hlsf wrong alloc solved
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="MatrixCompute.Basic"
|
||||
// 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
|
||||
@@ -86,7 +86,7 @@ namespace StgSharp.Mathematics.Numeric
|
||||
return ans;
|
||||
}
|
||||
|
||||
public static unsafe void Fill<T>(Matrix<float> ans, T value) where T: unmanaged, INumber<T>
|
||||
public static unsafe void Fill<T>(Matrix<float> ans, T value) where T : unmanaged, INumber<T>
|
||||
{
|
||||
long count = (long)ans.KernelColumnLength * ans.KernelRowLength;
|
||||
ScalarPacket* scalar = MatrixParallelFactory.CreateScalarPacket();
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace StgSharp.Mathematics.Numeric
|
||||
MatrixParallelFactory.Release(p);
|
||||
}
|
||||
|
||||
internal static unsafe void BufferComputeUnaryScalar(MatrixParallelTaskPackage* p)
|
||||
internal static unsafe void BufferComputeUnary(MatrixParallelTaskPackage* p)
|
||||
{
|
||||
int size = p->ElementSize * 16;
|
||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||
@@ -69,6 +69,17 @@ namespace StgSharp.Mathematics.Numeric
|
||||
MatrixParallelFactory.Release(p);
|
||||
}
|
||||
|
||||
internal static unsafe void BufferComputeUnaryScalar(MatrixParallelTaskPackage* p)
|
||||
{
|
||||
int size = p->ElementSize * 16;
|
||||
long count = Unsafe.As<int, long>(ref p->PrimCount);
|
||||
long offset = Unsafe.As<int, long>(ref p->PrimTileOffset) * size;
|
||||
((delegate* unmanaged[Cdecl]< void*, void*, ScalarPacket*, long, void>)p->ComputeHandle)((void*)(p->Right + offset),
|
||||
(void*)(p->Result + offset),
|
||||
p->Scalar, count);
|
||||
MatrixParallelFactory.Release(p);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void Compute_Binary(MatrixParallelTaskPackage* p)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="MatrixParallelThread"
|
||||
// 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
|
||||
@@ -93,6 +93,7 @@ namespace StgSharp.Mathematics.Numeric
|
||||
switch (p->ComputeMode.ParameterStyle)
|
||||
{
|
||||
case MatrixOperationParam.RIGHT_ANS_PARAM:
|
||||
MatrixComputeModel.BufferComputeUnary(p);
|
||||
break;
|
||||
case MatrixOperationParam.LEFT_RIGHT_ANS_PARAM:
|
||||
MatrixComputeModel.BufferComputeBinary(p);
|
||||
|
||||
Reference in New Issue
Block a user