mat kernel turns to be generic
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
System.Exception: Driver Verification Log needs to be created on a 'Release' configuration. The current selected configuration is ''.
|
||||
在 Microsoft.SdvMenuCommand.DriverVerificationLicense..ctor()
|
||||
在 Microsoft.SdvMenuCommand.SdvMenuCommandPackage.StaticToolsLogoMenuItemCallback(Object sender, EventArgs e)
|
||||
@@ -42,7 +42,7 @@ using System.Threading.Tasks;
|
||||
namespace StgSharp.HighPerformance
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 64)]
|
||||
public unsafe struct MatrixKernel
|
||||
public unsafe struct MatrixKernel<T> where T: unmanaged, INumber<T>
|
||||
{
|
||||
|
||||
[FieldOffset(0)] internal fixed byte Buffer[64];
|
||||
@@ -68,11 +68,11 @@ namespace StgSharp.HighPerformance
|
||||
}
|
||||
}
|
||||
|
||||
public static MatrixKernel Fp32Unit
|
||||
public static MatrixKernel<T> Unit
|
||||
{
|
||||
get
|
||||
{
|
||||
MatrixKernel kernel = new(true);
|
||||
MatrixKernel<T> kernel = new(true);
|
||||
kernel.FP32Buffer[0] = 1f;
|
||||
kernel.FP32Buffer[3] = 1f;
|
||||
kernel.FP32Buffer[8] = 1f;
|
||||
@@ -81,7 +81,7 @@ namespace StgSharp.HighPerformance
|
||||
}
|
||||
}
|
||||
|
||||
public ref T UnsafeIndex<T>(int column, int row) where T: unmanaged, INumber<T>
|
||||
public ref T UnsafeIndex(int column, int row)
|
||||
{
|
||||
ref M128 col = ref Unsafe.As<byte, M128>(ref Buffer[0]);
|
||||
col = ref Unsafe.Add(ref col, column);
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="KernelParallel.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. 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 in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Mathematics
|
||||
{
|
||||
internal class KernelParallel { }
|
||||
}
|
||||
@@ -80,7 +80,7 @@ namespace StgSharp.Mathematics
|
||||
|
||||
public static MatrixAllocation DefaultAllocation { get; set; } = MatrixAllocation.GC;
|
||||
|
||||
internal abstract MatrixKernel* Buffer { get; }
|
||||
internal abstract MatrixKernel<T>* Buffer { get; }
|
||||
|
||||
protected internal int KernelColumnLength { get; init; }
|
||||
|
||||
@@ -108,14 +108,14 @@ namespace StgSharp.Mathematics
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public abstract MatrixSegmentEnumeration GetColumnEnumeration();
|
||||
public abstract MatrixSegmentEnumeration<T> GetColumnEnumeration();
|
||||
|
||||
public abstract ref MatrixKernel GetMatrixKernel(int column, int row);
|
||||
public abstract ref MatrixKernel<T> GetMatrixKernel(int column, int row);
|
||||
|
||||
public abstract MatrixSegmentEnumeration GetRowEnumeration();
|
||||
public abstract MatrixSegmentEnumeration<T> GetRowEnumeration();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public abstract MatrixSegmentEnumeration GetSequentialEnumeration();
|
||||
public abstract MatrixSegmentEnumeration<T> GetSequentialEnumeration();
|
||||
|
||||
[Obsolete("This method does not contain boarder check, so be careful on size or use indexer instead.", false)]
|
||||
public abstract ref T UnsafeIndex(int column, int row);
|
||||
@@ -133,36 +133,37 @@ namespace StgSharp.Mathematics
|
||||
|
||||
}
|
||||
|
||||
public readonly unsafe ref struct MatrixSegmentEnumeration(
|
||||
MatrixKernel* source,
|
||||
public readonly unsafe ref struct MatrixSegmentEnumeration<T>(
|
||||
MatrixKernel<T>* source,
|
||||
int stride,
|
||||
int size,
|
||||
int secondaryStride,
|
||||
int secondarySize)
|
||||
where T: unmanaged, INumber<T>
|
||||
{
|
||||
|
||||
private readonly MatrixKernel* _source = source;
|
||||
private readonly MatrixKernel<T>* _source = source;
|
||||
private readonly int _secondarySize = secondarySize;
|
||||
private readonly int _secondaryStride = secondaryStride;
|
||||
|
||||
private readonly int _size = size;
|
||||
private readonly int _stride = stride;
|
||||
|
||||
public Enumerator GetEnumerator()
|
||||
public Enumerator<T> GetEnumerator()
|
||||
{
|
||||
return new Enumerator(in this);
|
||||
return new Enumerator<T>(in this);
|
||||
}
|
||||
|
||||
public ref struct Enumerator(in MatrixSegmentEnumeration enumeration)
|
||||
public ref struct Enumerator<T>(in MatrixSegmentEnumeration<T> enumeration) where T: unmanaged, INumber<T>
|
||||
{
|
||||
|
||||
private MatrixKernel* _current = enumeration._source - enumeration._stride;
|
||||
private readonly MatrixKernel* _end = enumeration._source + enumeration._size;
|
||||
private MatrixKernel<T>* _current = enumeration._source - enumeration._stride;
|
||||
private readonly MatrixKernel<T>* _end = enumeration._source + enumeration._size;
|
||||
private readonly int _secondarySize = enumeration._secondarySize;
|
||||
private readonly int _secondaryStride = enumeration._secondaryStride;
|
||||
private readonly int _stride = enumeration._stride;
|
||||
|
||||
public readonly MatrixSegment Current
|
||||
public readonly MatrixSegment<T> Current
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => new(_current, _secondarySize, _secondaryStride);
|
||||
@@ -178,14 +179,15 @@ namespace StgSharp.Mathematics
|
||||
|
||||
}
|
||||
|
||||
public readonly unsafe ref struct MatrixSegment(MatrixKernel* source, int size, int stride)
|
||||
public readonly unsafe ref struct MatrixSegment<T>(MatrixKernel<T>* source, int size, int stride)
|
||||
where T: unmanaged, INumber<T>
|
||||
{
|
||||
|
||||
private readonly MatrixKernel* _source = source;
|
||||
private readonly MatrixKernel<T>* _source = source;
|
||||
private readonly int _size = size;
|
||||
private readonly int _stride = stride;
|
||||
|
||||
public ref MatrixKernel this[int index]
|
||||
public ref MatrixKernel<T> this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -196,18 +198,18 @@ namespace StgSharp.Mathematics
|
||||
}
|
||||
}
|
||||
|
||||
public Enumerator GetEnumerator()
|
||||
public Enumerator<T> GetEnumerator()
|
||||
{
|
||||
return new Enumerator(_source, _size, _stride);
|
||||
return new Enumerator<T>(_source, _size, _stride);
|
||||
}
|
||||
|
||||
public ref struct Enumerator(MatrixKernel* source, int count, int stride)
|
||||
public ref struct Enumerator<T>(MatrixKernel<T>* source, int count, int stride) where T: unmanaged, INumber<T>
|
||||
{
|
||||
|
||||
private readonly MatrixKernel* _end = source + (count * stride);
|
||||
private readonly MatrixKernel<T>* _end = source + (count * stride);
|
||||
private readonly int _stride = stride;
|
||||
|
||||
public MatrixKernel* Current
|
||||
public MatrixKernel<T>* Current
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get;
|
||||
|
||||
@@ -179,6 +179,7 @@
|
||||
<ClInclude Include="sn-head\khrplatform.h" />
|
||||
<ClInclude Include="sn-head\sn_internal.h" />
|
||||
<ClInclude Include="sn-head\sn_intrinsic.h" />
|
||||
<ClInclude Include="sn-head\sn_matkernel.h" />
|
||||
<ClInclude Include="sn-head\stb_image.h" />
|
||||
<ClInclude Include="sn-head\StgSharpNative.h" />
|
||||
<ClInclude Include="sn-head\wgl.h" />
|
||||
|
||||
@@ -83,6 +83,9 @@
|
||||
<ClInclude Include="glfw\glfw3.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sn-head\sn_matkernel.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="glfw\glfw3.lib">
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
#ifndef SSC_INTRIN
|
||||
#define SSC_INTRIN
|
||||
|
||||
#define SSC_INTRIN_HEAD
|
||||
|
||||
#include "StgSharpNative.h"
|
||||
#include "sn_matkernel.h"
|
||||
#include <immintrin.h>
|
||||
#include <smmintrin.h>
|
||||
|
||||
@@ -39,25 +42,6 @@ typedef union mat_kernel {
|
||||
float m[4][4];
|
||||
} mat_kernel;
|
||||
|
||||
typedef union column_2 {
|
||||
__m256 stream;
|
||||
__m128 column[2];
|
||||
float m[4][2];
|
||||
} __2_columnset;
|
||||
|
||||
typedef union column_3 {
|
||||
__m256 part;
|
||||
__m128 column[3];
|
||||
float m[4][3];
|
||||
} __3_columnset;
|
||||
|
||||
typedef union column_4 {
|
||||
__m512 stream;
|
||||
__m256 half[2];
|
||||
__m128 column[4];
|
||||
float m[4][4];
|
||||
} __4_columnset;
|
||||
|
||||
typedef union scalar_pack {
|
||||
uint64_t data[8];
|
||||
} scalar_pack;
|
||||
@@ -77,34 +61,38 @@ typedef uint64_t(SN_DECL *FACTORIALROC)(int n);
|
||||
|
||||
INTERNAL void normalize(__m128 *source, __m128 *target);
|
||||
|
||||
INTERNAL void SN_DECL kernel_add_sse(mat_kernel const *left, mat_kernel const *right,
|
||||
mat_kernel *ans);
|
||||
INTERNAL void SN_DECL kernel_add_avx(mat_kernel const *left, mat_kernel const *right,
|
||||
mat_kernel *ans);
|
||||
INTERNAL void SN_DECL kernel_add_512(mat_kernel const *left, mat_kernel const *right,
|
||||
mat_kernel *ans);
|
||||
INTERNAL void SN_DECL kernel_sub_sse(mat_kernel const *left, mat_kernel const *right,
|
||||
mat_kernel *ans);
|
||||
INTERNAL void SN_DECL kernel_sub_avx(mat_kernel const *left, mat_kernel const *right,
|
||||
mat_kernel *ans);
|
||||
INTERNAL void SN_DECL kernel_sub_512(mat_kernel const *left, mat_kernel const *right,
|
||||
mat_kernel *ans);
|
||||
INTERNAL void SN_DECL kernel_transpose_sse(mat_kernel const *source, mat_kernel *target);
|
||||
INTERNAL void SN_DECL kernel_transpose_avx(mat_kernel const *source, mat_kernel *target);
|
||||
INTERNAL void SN_DECL kernel_transpose_512(mat_kernel const *source, mat_kernel *target);
|
||||
INTERNAL void SN_DECL kernel_scalar_mul_sse(mat_kernel const *matrix, float const scalar,
|
||||
mat_kernel *ans);
|
||||
INTERNAL void SN_DECL kernel_scalar_mul_avx(mat_kernel const *matrix, float const scalar,
|
||||
mat_kernel *ans);
|
||||
INTERNAL void SN_DECL kernel_scalar_mul_512(mat_kernel const *matrix, float const scalar,
|
||||
mat_kernel *ans);
|
||||
INTERNAL void SN_DECL f32_add_sse(MAT_KERNEL(float) const *left, MAT_KERNEL(float) const *right,
|
||||
MAT_KERNEL(float) * ans);
|
||||
INTERNAL void SN_DECL f32_add_avx(MAT_KERNEL(float) const *left, MAT_KERNEL(float) const *right,
|
||||
MAT_KERNEL(float) * ans);
|
||||
INTERNAL void SN_DECL f32_add_512(MAT_KERNEL(float) const *left, MAT_KERNEL(float) const *right,
|
||||
MAT_KERNEL(float) * ans);
|
||||
INTERNAL void SN_DECL f32_sub_sse(MAT_KERNEL(float) const *left, MAT_KERNEL(float) const *right,
|
||||
MAT_KERNEL(float) * ans);
|
||||
INTERNAL void SN_DECL f32_sub_avx(MAT_KERNEL(float) const *left, MAT_KERNEL(float) const *right,
|
||||
MAT_KERNEL(float) * ans);
|
||||
INTERNAL void SN_DECL f32_sub_512(MAT_KERNEL(float) const *left, MAT_KERNEL(float) const *right,
|
||||
MAT_KERNEL(float) * ans);
|
||||
INTERNAL void SN_DECL f32_transpose_sse(MAT_KERNEL(float) const *source,
|
||||
MAT_KERNEL(float) * target);
|
||||
INTERNAL void SN_DECL f32_transpose_avx(MAT_KERNEL(float) const *source,
|
||||
MAT_KERNEL(float) * target);
|
||||
INTERNAL void SN_DECL f32_transpose_512(MAT_KERNEL(float) const *source,
|
||||
MAT_KERNEL(float) * target);
|
||||
INTERNAL void SN_DECL f32_scalar_mul_sse(MAT_KERNEL(float) const *matrix, float const scalar,
|
||||
MAT_KERNEL(float) * ans);
|
||||
INTERNAL void SN_DECL f32_scalar_mul_avx(MAT_KERNEL(float) const *matrix, float const scalar,
|
||||
MAT_KERNEL(float) * ans);
|
||||
INTERNAL void SN_DECL f32_scalar_mul_512(MAT_KERNEL(float) const *matrix, float const scalar,
|
||||
MAT_KERNEL(float) * ans);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region fma
|
||||
|
||||
INTERNAL void SN_DECL kernel_fma_sse(mat_kernel const *restrict left,
|
||||
mat_kernel const *restrict right, mat_kernel *restrict ans);
|
||||
INTERNAL void SN_DECL kernel_fma_sse(MAT_KERNEL(float) const *restrict left,
|
||||
MAT_KERNEL(float) const *restrict right,
|
||||
MAT_KERNEL(float) *restrict ans);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef SN_MATKERNEL
|
||||
#define SN_MATKERNEL
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
#define ELEMENTSIZE(T) sizeof(T)
|
||||
#define XMMCOUNT(T) sizeof(T) / 16
|
||||
#define YMMCOUNT(T) sizeof(T) / 32
|
||||
#define ZMMCOUNT(T) sizeof(T) / 64
|
||||
|
||||
#define MAT_KERNEL(T) \
|
||||
union { \
|
||||
__m128 xmm[XMMCOUNT(T)]; \
|
||||
__m256 ymm[YMMCOUNT(T)]; \
|
||||
__m512 zmm[ZMMCOUNT(T)]; \
|
||||
T m[16]; \
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "sn_intrinsic.h"
|
||||
|
||||
INTERNAL void SN_DECL kernel_add_sse(mat_kernel *left, mat_kernel *right, mat_kernel *ans)
|
||||
INTERNAL void SN_DECL f32_add_sse(MAT_KERNEL(float) * left, MAT_KERNEL(float) * right,
|
||||
MAT_KERNEL(float) * ans)
|
||||
{
|
||||
register __m128 c0 = _mm_add_ps(left->xmm[0], right->xmm[0]);
|
||||
register __m128 c1 = _mm_add_ps(left->xmm[1], right->xmm[1]);
|
||||
@@ -13,7 +14,8 @@ INTERNAL void SN_DECL kernel_add_sse(mat_kernel *left, mat_kernel *right, mat_ke
|
||||
ans->xmm[3] = c3;
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_add_avx(mat_kernel *left, mat_kernel *right, mat_kernel *ans)
|
||||
INTERNAL void SN_DECL f32_add_avx(MAT_KERNEL(float) * left, MAT_KERNEL(float) * right,
|
||||
MAT_KERNEL(float) * ans)
|
||||
{
|
||||
register __m256 c0 = _mm256_add_ps(left->ymm[0], right->ymm[0]);
|
||||
register __m256 c1 = _mm256_add_ps(left->ymm[1], right->ymm[1]);
|
||||
@@ -21,13 +23,15 @@ INTERNAL void SN_DECL kernel_add_avx(mat_kernel *left, mat_kernel *right, mat_ke
|
||||
ans->ymm[1] = c1;
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_add_512(mat_kernel *left, mat_kernel *right, mat_kernel *ans)
|
||||
INTERNAL void SN_DECL f32_add_512(MAT_KERNEL(float) * left, MAT_KERNEL(float) * right,
|
||||
MAT_KERNEL(float) * ans)
|
||||
{
|
||||
register __m512 c0 = _mm512_add_ps(left->zmm[0], right->zmm[0]);
|
||||
ans->zmm[0] = c0;
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_sub_sse(mat_kernel *left, mat_kernel *right, mat_kernel *ans)
|
||||
INTERNAL void SN_DECL f32_sub_sse(MAT_KERNEL(float) * left, MAT_KERNEL(float) * right,
|
||||
MAT_KERNEL(float) * ans)
|
||||
{
|
||||
register __m128 c0 = _mm_sub_ps(left->xmm[0], right->xmm[0]);
|
||||
register __m128 c1 = _mm_sub_ps(left->xmm[1], right->xmm[1]);
|
||||
@@ -40,7 +44,8 @@ INTERNAL void SN_DECL kernel_sub_sse(mat_kernel *left, mat_kernel *right, mat_ke
|
||||
ans->xmm[3] = c3;
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_sub_avx(mat_kernel *left, mat_kernel *right, mat_kernel *ans)
|
||||
INTERNAL void SN_DECL f32_sub_avx(MAT_KERNEL(float) * left, MAT_KERNEL(float) * right,
|
||||
MAT_KERNEL(float) * ans)
|
||||
{
|
||||
register __m256 c0 = _mm256_sub_ps(left->ymm[0], right->ymm[0]);
|
||||
register __m256 c1 = _mm256_sub_ps(left->ymm[1], right->ymm[1]);
|
||||
@@ -48,14 +53,15 @@ INTERNAL void SN_DECL kernel_sub_avx(mat_kernel *left, mat_kernel *right, mat_ke
|
||||
ans->ymm[1] = c1;
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_sub_512(mat_kernel *left, mat_kernel *right, mat_kernel *ans)
|
||||
INTERNAL void SN_DECL f32_sub_512(MAT_KERNEL(float) * left, MAT_KERNEL(float) * right,
|
||||
MAT_KERNEL(float) * ans)
|
||||
{
|
||||
register __m512 c0 = _mm512_sub_ps(left->zmm[0], right->zmm[0]);
|
||||
ans->zmm[0] = c0;
|
||||
}
|
||||
|
||||
// Matrix transpose implementations
|
||||
INTERNAL void SN_DECL kernel_transpose_sse(mat_kernel *source, mat_kernel *target)
|
||||
INTERNAL void SN_DECL kernel_transpose_sse(MAT_KERNEL(float) * source, MAT_KERNEL(float) * target)
|
||||
{
|
||||
register __m128 col0 = source->xmm[0];
|
||||
register __m128 col1 = source->xmm[1];
|
||||
@@ -72,7 +78,7 @@ INTERNAL void SN_DECL kernel_transpose_sse(mat_kernel *source, mat_kernel *targe
|
||||
target->xmm[3] = _mm_movehl_ps(tmp3, tmp1);
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_transpose_avx(mat_kernel *source, mat_kernel *target)
|
||||
INTERNAL void SN_DECL kernel_transpose_avx(MAT_KERNEL(float) * source, MAT_KERNEL(float) * target)
|
||||
{
|
||||
register __m256 col_low = source->ymm[0];
|
||||
register __m256 col_high = source->ymm[1];
|
||||
@@ -87,7 +93,7 @@ INTERNAL void SN_DECL kernel_transpose_avx(mat_kernel *source, mat_kernel *targe
|
||||
target->ymm[1] = _mm256_shuffle_ps(col_high, col_low, _MM_SHUFFLE(3, 1, 3, 1));
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_transpose_512(mat_kernel *source, mat_kernel *target)
|
||||
INTERNAL void SN_DECL kernel_transpose_512(MAT_KERNEL(float) * source, MAT_KERNEL(float) * target)
|
||||
{
|
||||
register __m512 matrix = source->zmm[0];
|
||||
|
||||
@@ -97,7 +103,8 @@ INTERNAL void SN_DECL kernel_transpose_512(mat_kernel *source, mat_kernel *targe
|
||||
target->zmm[0] = _mm512_permutexvar_ps(transpose_indices, matrix);
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_scalar_mul_sse(mat_kernel *matrix, float scalar, mat_kernel *ans)
|
||||
INTERNAL void SN_DECL kernel_scalar_mul_sse(MAT_KERNEL(float) * matrix, float scalar,
|
||||
MAT_KERNEL(float) * ans)
|
||||
{
|
||||
register __m128 temp = _mm_load_ss(&scalar);
|
||||
register __m128 scalar_vec = _mm_shuffle_ps(temp, temp, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
@@ -113,7 +120,8 @@ INTERNAL void SN_DECL kernel_scalar_mul_sse(mat_kernel *matrix, float scalar, ma
|
||||
ans->xmm[3] = c3;
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_scalar_mul_avx(mat_kernel *matrix, float scalar, mat_kernel *ans)
|
||||
INTERNAL void SN_DECL kernel_scalar_mul_avx(MAT_KERNEL(float) * matrix, float scalar,
|
||||
MAT_KERNEL(float) * ans)
|
||||
{
|
||||
register __m256 scalar_vec = _mm256_broadcast_ss(&scalar);
|
||||
|
||||
@@ -124,7 +132,8 @@ INTERNAL void SN_DECL kernel_scalar_mul_avx(mat_kernel *matrix, float scalar, ma
|
||||
ans->ymm[1] = c1;
|
||||
}
|
||||
|
||||
INTERNAL void SN_DECL kernel_scalar_mul_512(mat_kernel *matrix, float scalar, mat_kernel *ans)
|
||||
INTERNAL void SN_DECL kernel_scalar_mul_512(MAT_KERNEL(float) * matrix, float scalar,
|
||||
MAT_KERNEL(float) * ans)
|
||||
{
|
||||
__m512 scalar_vec = _mm512_broadcastss_ps(_mm_load_ss(&scalar));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "sn_intrinsic.h"
|
||||
|
||||
// ans = left * right(T) + ans
|
||||
INTERNAL void SN_DECL kernel_fma_sse(mat_kernel const *restrict left,
|
||||
INTERNAL void SN_DECL f32_fma_sse(MAT_KERNEL(float) const *restrict left,
|
||||
mat_kernel const *restrict right, mat_kernel *restrict ans)
|
||||
{
|
||||
register __m128 source0 = _mm_load_ps(&left->xmm[0]);
|
||||
|
||||
@@ -66,10 +66,10 @@ void load_intrinsic_sse(sn_intrinsic *context)
|
||||
context->city_hash_simplify = city_hash_simplify_sse;
|
||||
context->factorial_simd = factorial_simd_sse;
|
||||
context->index_pair = index_pair_sse;
|
||||
context->kernel_add = (MATARITHMETIC)kernel_add_sse;
|
||||
context->kernel_add = (MATARITHMETIC)f32_add_sse;
|
||||
context->kernel_fma = (void(*)(void*, void*, void*))kernel_fma_sse;
|
||||
context->kernel_scalar_mul = kernel_scalar_mul_sse;
|
||||
context->kernel_sub = (MATARITHMETIC)kernel_sub_sse;
|
||||
context->kernel_sub = (MATARITHMETIC)f32_sub_sse;
|
||||
context->kernel_transpose = (MATTRANSPOSEPROC)kernel_transpose_sse;
|
||||
context->normalize_3 = normalize;
|
||||
}
|
||||
@@ -79,10 +79,10 @@ void load_intrinsic_avx(sn_intrinsic *context)
|
||||
context->city_hash_simplify = city_hash_simplify_sse;
|
||||
context->factorial_simd = factorial_simd_sse;
|
||||
context->index_pair = index_pair_sse;
|
||||
context->kernel_add = (MATARITHMETIC)kernel_add_avx;
|
||||
context->kernel_add = (MATARITHMETIC)f32_add_avx;
|
||||
context->kernel_fma = (void(*)(void*, void*, void*))kernel_fma_sse;
|
||||
context->kernel_scalar_mul = kernel_scalar_mul_avx;
|
||||
context->kernel_sub = (MATARITHMETIC)kernel_sub_avx;
|
||||
context->kernel_sub = (MATARITHMETIC)f32_sub_avx;
|
||||
context->kernel_transpose = (MATTRANSPOSEPROC)kernel_transpose_avx;
|
||||
context->normalize_3 = normalize;
|
||||
}
|
||||
@@ -92,10 +92,10 @@ void load_intrinsic_512(sn_intrinsic *context)
|
||||
context->city_hash_simplify = city_hash_simplify_sse;
|
||||
context->factorial_simd = factorial_simd_sse;
|
||||
context->index_pair = index_pair_sse;
|
||||
context->kernel_add = (MATARITHMETIC)kernel_add_512;
|
||||
context->kernel_add = (MATARITHMETIC)f32_add_512;
|
||||
context->kernel_fma = (void(*)(void*, void*, void*))kernel_fma_sse;
|
||||
context->kernel_scalar_mul = kernel_scalar_mul_512;
|
||||
context->kernel_sub = (MATARITHMETIC)kernel_sub_512;
|
||||
context->kernel_sub = (MATARITHMETIC)f32_sub_512;
|
||||
context->kernel_transpose = (MATTRANSPOSEPROC)kernel_transpose_512;
|
||||
context->normalize_3 = normalize;
|
||||
}
|
||||
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
clear
|
||||
|
||||
# 设置要查找的文件类型
|
||||
file_types=( "*.cs" "*.c" "*.cpp" "*.h" "*.txt" "*.csproj" "*.vs" "*.vert" "*.frag" "*.sln" "*.vcxproj" "*.json" "*.sh" )
|
||||
|
||||
# 循环遍历每个文件类型,并添加到git
|
||||
for type in "${file_types[@]}"; do
|
||||
|
||||
# 执行find命令,并将输出保存到变量中
|
||||
add_output=$(find . -name "$type" -exec git add '{}' + 2>&1)
|
||||
add_status=$?
|
||||
|
||||
# 检查find命令的退出状态
|
||||
if [ $add_status -ne 0 ]; then
|
||||
# 如果出错,显示保存的输出
|
||||
echo "$add_output"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
clear
|
||||
|
||||
# 提示用户输入commit信息
|
||||
echo "====================== file added ======================"
|
||||
echo "请输入commit信息:"
|
||||
read commit_message
|
||||
|
||||
# 执行git commit命令,并将输出保存到变量中
|
||||
commit_output=$(git commit -m "$commit_message" 2>&1)
|
||||
commit_status=$?
|
||||
|
||||
# 检查git commit命令的退出状态
|
||||
if [ $commit_status -ne 0 ]; then
|
||||
# 如果出错,显示保存的输出
|
||||
echo "$commit_output"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clear
|
||||
|
||||
echo ""
|
||||
echo "================ successfully committed ================="
|
||||
echo ""
|
||||
# 执行git push命令
|
||||
git push CCD_Git local:main
|
||||
git push CCD_Git local:nitload
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Successfully pushed, press enter to quit"
|
||||
read commit_message
|
||||
|
||||
clear
|
||||
exit
|
||||
Binary file not shown.
Reference in New Issue
Block a user