decide to use L4 to solve numa and pack problem for large compute.

This commit is contained in:
Youmu Liu
2026-03-02 17:33:03 +08:00
parent 67fbbde449
commit 7e3ed8b0fd
9 changed files with 192 additions and 86 deletions
+45 -50
View File
@@ -4,7 +4,8 @@
#include "StgSharpNative.h"
#include "sn_intrinsic.h"
#include "sn_intrincontext.x86.h"
#include "sn_intrinsic.std.h"
#include "sn_intrinsic.context.x86.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <intrin.h>
@@ -51,24 +52,22 @@ void load_intrinsic_sse(sn_intrinsic *context, SIMDID id)
context->factorial_simd = factorial_simd_sse;
context->index_pair = index_pair_sse;
context->mat[F32].buffer_add = BUF_PROC(float, sse, , add);
context->mat[F32].buffer_fill = BUF_PROC(float, sse, , fill);
context->mat[F32].buffer_scalar_mul = BUF_PROC(float, sse, , scalar_mul);
context->mat[F32].buffer_sub = BUF_PROC(float, sse, , sub);
context->mat[F32].buffer_transpose = KER_PROC(float, sse, , transpose);
context->mat[F32].clear_panel = PNL_PROC(float, sse, , clear);
context->mat[F32].ker_fma = KER_PROC(float, sse, , fma);
context->mat[F32].ker_tile_fma = KERTILE_PROC(float, sse, , fma);
context->mat[F32].buffer_add = STD_MK_PROC_NAME(float, sse, , add);
context->mat[F32].buffer_fill = STD_MK_PROC_NAME(float, sse, , fill);
context->mat[F32].buffer_scalar_mul = STD_MK_PROC_NAME(float, sse, , scalar_mul);
context->mat[F32].buffer_sub = STD_MK_PROC_NAME(float, sse, , sub);
context->mat[F32].buffer_transpose = STD_MK_PROC_NAME(float, sse, , transpose);
context->mat[F32].ker_fma = STD_MK_PROC_NAME(float, sse, , fma);
context->mat[F32].ker_tile_fma = STD_MK_PROC_NAME(float, sse, , fma);
context->mat[F32].pivot = NULL;
context->mat[F64].buffer_add = BUF_PROC(double, sse, , add);
context->mat[F64].buffer_fill = BUF_PROC(double, sse, , fill);
context->mat[F64].buffer_scalar_mul = BUF_PROC(double, sse, , scalar_mul);
context->mat[F64].buffer_sub = BUF_PROC(double, sse, , sub);
context->mat[F64].buffer_add = STD_MK_PROC_NAME(double, sse, , add);
context->mat[F64].buffer_fill = STD_MK_PROC_NAME(double, sse, , fill);
context->mat[F64].buffer_scalar_mul = STD_MK_PROC_NAME(double, sse, , scalar_mul);
context->mat[F64].buffer_sub = STD_MK_PROC_NAME(double, sse, , sub);
context->mat[F64].buffer_transpose = NULL;
context->mat[F64].clear_panel = PNL_PROC(double, sse, , clear);
context->mat[F64].ker_fma = KER_PROC(double, sse, , fma);
context->mat[F64].ker_tile_fma = KERTILE_PROC(double, sse, , fma);
context->mat[F64].ker_fma = STD_MK_PROC_NAME(double, sse, , fma);
context->mat[F64].ker_tile_fma = STD_MK_PROC_NAME(double, sse, , fma);
context->mat[F64].pivot = NULL;
context->vec_f32_normalize_3 = f32_normalize;
@@ -84,28 +83,26 @@ void load_intrinsic_avx(sn_intrinsic *context, SIMDID id)
context->factorial_simd = factorial_simd_sse;
context->index_pair = index_pair_sse;
context->mat[F32].buffer_add = BUF_PROC(float, avx, , add);
context->mat[F32].buffer_fill = BUF_PROC(float, avx, , fill);
context->mat[F32].buffer_scalar_mul = BUF_PROC(float, avx, , scalar_mul);
context->mat[F32].buffer_sub = BUF_PROC(float, avx, , sub);
context->mat[F32].buffer_transpose = KER_PROC(float, avx, , transpose);
context->mat[F32].clear_panel = PNL_PROC(float, avx, , clear);
context->mat[F32].ker_fma = is_fma ? KER_PROC(float, avx, , fma) :
KER_PROC(float, avx, _fma, fma);
context->mat[F32].ker_tile_fma = is_fma ? KERTILE_PROC(float, avx, , fma) :
KERTILE_PROC(float, avx, _fma, fma);
context->mat[F32].buffer_add = STD_MK_PROC_NAME(float, avx, , add);
context->mat[F32].buffer_fill = STD_MK_PROC_NAME(float, avx, , fill);
context->mat[F32].buffer_scalar_mul = STD_MK_PROC_NAME(float, avx, , scalar_mul);
context->mat[F32].buffer_sub = STD_MK_PROC_NAME(float, avx, , sub);
context->mat[F32].buffer_transpose = STD_MK_PROC_NAME(float, avx, , transpose);
context->mat[F32].ker_fma = is_fma ? STD_MK_PROC_NAME(float, avx, , fma) :
STD_MK_PROC_NAME(float, avx, _fma, fma);
context->mat[F32].ker_tile_fma = is_fma ? STD_MK_PROC_NAME(float, avx, , fma) :
STD_MK_PROC_NAME(float, avx, _fma, fma);
context->mat[F32].pivot = NULL;
context->mat[F64].buffer_add = BUF_PROC(double, avx, , add);
context->mat[F64].buffer_fill = BUF_PROC(double, avx, , fill);
context->mat[F64].buffer_scalar_mul = BUF_PROC(double, avx, , scalar_mul);
context->mat[F64].buffer_sub = BUF_PROC(double, avx, , sub);
context->mat[F64].buffer_add = STD_MK_PROC_NAME(double, avx, , add);
context->mat[F64].buffer_fill = STD_MK_PROC_NAME(double, avx, , fill);
context->mat[F64].buffer_scalar_mul = STD_MK_PROC_NAME(double, avx, , scalar_mul);
context->mat[F64].buffer_sub = STD_MK_PROC_NAME(double, avx, , sub);
context->mat[F64].buffer_transpose = NULL;
context->mat[F64].clear_panel = PNL_PROC(double, avx, , clear);
context->mat[F64].ker_fma = is_fma ? KER_PROC(double, avx, , fma) :
KER_PROC(double, avx, _fma, fma);
context->mat[F64].ker_tile_fma = is_fma ? KERTILE_PROC(double, avx, , fma) :
KERTILE_PROC(double, avx, _fma, fma);
context->mat[F64].ker_fma = is_fma ? STD_MK_PROC_NAME(double, avx, , fma) :
STD_MK_PROC_NAME(double, avx, _fma, fma);
context->mat[F64].ker_tile_fma = is_fma ? STD_MK_PROC_NAME(double, avx, , fma) :
STD_MK_PROC_NAME(double, avx, _fma, fma);
context->mat[F64].pivot = NULL;
context->vec_f32_normalize_3 = f32_normalize;
@@ -117,24 +114,22 @@ void load_intrinsic_512(sn_intrinsic *context, SIMDID id)
context->factorial_simd = factorial_simd_sse;
context->index_pair = index_pair_sse;
context->mat[F32].buffer_add = BUF_PROC(float, 512, , add);
context->mat[F32].buffer_fill = BUF_PROC(float, 512, , fill);
context->mat[F32].buffer_scalar_mul = BUF_PROC(float, 512, , scalar_mul);
context->mat[F32].buffer_sub = BUF_PROC(float, 512, , sub);
context->mat[F32].buffer_transpose = KER_PROC(float, 512, , transpose);
context->mat[F32].clear_panel = PNL_PROC(float, 512, , clear);
context->mat[F32].ker_fma = KER_PROC(float, 512, , fma);
context->mat[F32].ker_tile_fma = KERTILE_PROC(float, 512, , fma);
context->mat[F32].buffer_add = STD_MK_PROC_NAME(float, 512, , add);
context->mat[F32].buffer_fill = STD_MK_PROC_NAME(float, 512, , fill);
context->mat[F32].buffer_scalar_mul = STD_MK_PROC_NAME(float, 512, , scalar_mul);
context->mat[F32].buffer_sub = STD_MK_PROC_NAME(float, 512, , sub);
context->mat[F32].buffer_transpose = STD_MK_PROC_NAME(float, 512, , transpose);
context->mat[F32].ker_fma = STD_MK_PROC_NAME(float, 512, , fma);
context->mat[F32].ker_tile_fma = STD_MK_PROC_NAME(float, 512, , fma);
context->mat[F32].pivot = NULL;
context->mat[F64].buffer_add = BUF_PROC(double, 512, , add);
context->mat[F64].buffer_fill = BUF_PROC(double, 512, , fill);
context->mat[F64].buffer_scalar_mul = BUF_PROC(double, 512, , scalar_mul);
context->mat[F64].buffer_sub = BUF_PROC(double, 512, , sub);
context->mat[F64].buffer_add = STD_MK_PROC_NAME(double, 512, , add);
context->mat[F64].buffer_fill = STD_MK_PROC_NAME(double, 512, , fill);
context->mat[F64].buffer_scalar_mul = STD_MK_PROC_NAME(double, 512, , scalar_mul);
context->mat[F64].buffer_sub = STD_MK_PROC_NAME(double, 512, , sub);
context->mat[F64].buffer_transpose = NULL;
context->mat[F64].clear_panel = PNL_PROC(double, 512, , clear);
context->mat[F64].ker_fma = KER_PROC(double, 512, , fma);
context->mat[F64].ker_tile_fma = KERTILE_PROC(double, 512, , fma);
context->mat[F64].ker_fma = STD_MK_PROC_NAME(double, 512, , fma);
context->mat[F64].ker_tile_fma = STD_MK_PROC_NAME(double, 512, , fma);
context->mat[F64].pivot = NULL;
context->vec_f32_normalize_3 = f32_normalize;