add simd id and cpu id
This commit is contained in:
@@ -54,55 +54,26 @@ namespace StgSharp.Mathematics.Numeric
|
||||
int ansWidth = p->AnsPrimOffset;
|
||||
int ansHeight = p->AnsSecOffset;
|
||||
int commonK = p->LeftPrimOffset;
|
||||
int blocksPerRow = ansWidth / size;
|
||||
if (NativeIntrinsic.Context.mat[f32].build_panel == null)
|
||||
|
||||
// int blocksPerRow = ansWidth / size;
|
||||
|
||||
// in this occasion size must be 1
|
||||
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||
{
|
||||
// in this occasion size must be 1
|
||||
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||
{
|
||||
int i = (int)(c / blocksPerRow);
|
||||
int j = (int)(c % blocksPerRow);
|
||||
MatrixKernel<float>* ansPanel = GetKernelAddressUnsafe((MatrixKernel<float>*)ansBuffer,
|
||||
ansHeight, i, j);
|
||||
NativeIntrinsic.Context.mat[f32].clear_panel((MatrixPanel*)ansPanel);
|
||||
for (int k = 0; k < commonK; k += size) {
|
||||
NativeIntrinsic.Context
|
||||
.mat[f32].panel_fma(
|
||||
int i = (int)(c / ansWidth);
|
||||
int j = (int)(c % ansWidth);
|
||||
MatrixKernel<float>* ansPanel = GetKernelAddressUnsafe((MatrixKernel<float>*)ansBuffer,
|
||||
ansHeight, i, j);
|
||||
NativeIntrinsic.Context.mat[f32].clear_panel((MatrixPanel*)ansPanel);
|
||||
for (int k = 0; k < commonK; k += size) {
|
||||
NativeIntrinsic.Context
|
||||
.mat[f32].kernel_fma(
|
||||
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<float>*)leftBuffer,
|
||||
ansHeight, k, j),
|
||||
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<float>*)rightBuffer,
|
||||
commonK, j, k),
|
||||
(MatrixPanel*)ansPanel);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
MatrixPanel<float>* leftPanel = MatrixPanel.Create<float>();
|
||||
MatrixPanel<float>* rightPanel = MatrixPanel.Create<float>();
|
||||
MatrixPanel<float>* ansPanel = MatrixPanel.Create<float>();
|
||||
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||
{
|
||||
int i = (int)(c / blocksPerRow) * size;
|
||||
int j = (int)(c % blocksPerRow) * size;
|
||||
NativeIntrinsic.Context.mat[f32].clear_panel((MatrixPanel*)ansPanel);
|
||||
for (int k = 0; k < commonK; k += size)
|
||||
{
|
||||
NativeIntrinsic.Context
|
||||
.mat[f32].build_panel((MatrixPanel*)leftPanel, leftBuffer,
|
||||
commonK, ansHeight, k, i);
|
||||
NativeIntrinsic.Context
|
||||
.mat[f32].build_panel((MatrixPanel*)rightPanel, rightBuffer,
|
||||
ansWidth, commonK, j, k);
|
||||
NativeIntrinsic.Context
|
||||
.mat[f32].panel_fma((MatrixPanel*)leftPanel, (MatrixPanel*)rightPanel, (MatrixPanel*)ansPanel);
|
||||
}
|
||||
NativeIntrinsic.Context
|
||||
.mat[f32].store_panel((MatrixPanel*)ansPanel, ansBuffer,
|
||||
ansWidth, ansHeight, j, i);
|
||||
}
|
||||
MatrixPanel.Destroy(leftPanel);
|
||||
MatrixPanel.Destroy(rightPanel);
|
||||
MatrixPanel.Destroy(ansPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +82,8 @@ namespace StgSharp.Mathematics.Numeric
|
||||
)
|
||||
{
|
||||
int f64 = (int)MatrixElementType.F64;
|
||||
int size = MatrixPanel.KernelSideCount<double>();
|
||||
|
||||
// int size = 1;
|
||||
MatrixKernel* leftBuffer = (MatrixKernel*)p->Left;
|
||||
MatrixKernel* rightBuffer = (MatrixKernel*)p->Right;
|
||||
MatrixKernel* ansBuffer = (MatrixKernel*)p->Answer;
|
||||
@@ -120,55 +92,24 @@ namespace StgSharp.Mathematics.Numeric
|
||||
int ansWidth = p->AnsPrimOffset;
|
||||
int ansHeight = p->AnsSecOffset;
|
||||
int commonK = p->LeftPrimOffset;
|
||||
int blocksPerRow = ansWidth / size;
|
||||
if (NativeIntrinsic.Context.mat[f64].build_panel == null)
|
||||
|
||||
// in this occasion size must be 1
|
||||
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||
{
|
||||
// in this occasion size must be 1
|
||||
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||
{
|
||||
int i = (int)(c / blocksPerRow);
|
||||
int j = (int)(c % blocksPerRow);
|
||||
MatrixKernel<double>* ansPanel = GetKernelAddressUnsafe((MatrixKernel<double>*)ansBuffer,
|
||||
ansHeight, i, j);
|
||||
NativeIntrinsic.Context.mat[f64].clear_panel((MatrixPanel*)ansPanel);
|
||||
for (int k = 0; k < commonK; k += size) {
|
||||
NativeIntrinsic.Context
|
||||
.mat[f64].panel_fma(
|
||||
int i = (int)(c / ansWidth);
|
||||
int j = (int)(c % ansWidth);
|
||||
MatrixKernel<double>* ansPanel = GetKernelAddressUnsafe((MatrixKernel<double>*)ansBuffer,
|
||||
ansHeight, i, j);
|
||||
NativeIntrinsic.Context.mat[f64].clear_panel((MatrixPanel*)ansPanel);
|
||||
for (int k = 0; k < commonK; k += 1) {
|
||||
NativeIntrinsic.Context
|
||||
.mat[f64].kernel_fma(
|
||||
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<double>*)leftBuffer,
|
||||
ansHeight, k, j),
|
||||
(MatrixPanel*)GetKernelAddressUnsafe((MatrixKernel<double>*)rightBuffer,
|
||||
commonK, j, k),
|
||||
(MatrixPanel*)ansPanel);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
MatrixPanel<double>* leftPanel = MatrixPanel.Create<double>();
|
||||
MatrixPanel<double>* rightPanel = MatrixPanel.Create<double>();
|
||||
MatrixPanel<double>* ansPanel = MatrixPanel.Create<double>();
|
||||
for (long c = offsetRef; c < offsetRef + lengthRef; c++)
|
||||
{
|
||||
int i = (int)(c / blocksPerRow) * size;
|
||||
int j = (int)(c % blocksPerRow) * size;
|
||||
NativeIntrinsic.Context.mat[f64].clear_panel((MatrixPanel*)ansPanel);
|
||||
for (int k = 0; k < commonK; k += size)
|
||||
{
|
||||
NativeIntrinsic.Context
|
||||
.mat[f64].build_panel((MatrixPanel*)leftPanel, leftBuffer,
|
||||
commonK, ansHeight, k, i);
|
||||
NativeIntrinsic.Context
|
||||
.mat[f64].build_panel((MatrixPanel*)rightPanel, rightBuffer,
|
||||
ansWidth, commonK, j, k);
|
||||
NativeIntrinsic.Context
|
||||
.mat[f64].panel_fma((MatrixPanel*)leftPanel, (MatrixPanel*)rightPanel, (MatrixPanel*)ansPanel);
|
||||
}
|
||||
NativeIntrinsic.Context
|
||||
.mat[f64].store_panel((MatrixPanel*)ansPanel, ansBuffer,
|
||||
ansWidth, ansHeight, j, i);
|
||||
}
|
||||
MatrixPanel.Destroy(leftPanel);
|
||||
MatrixPanel.Destroy(rightPanel);
|
||||
MatrixPanel.Destroy(ansPanel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user