remove mat panel, mat_task goes on span like

This commit is contained in:
Youmu Liu
2026-06-10 18:10:52 +08:00
parent 0356f5aff8
commit 09c1cace48
8 changed files with 717 additions and 207 deletions
+49 -32
View File
@@ -65,11 +65,37 @@ typedef union uint64_u {
typedef struct mat_kernel mat_kernel;
typedef struct mat_panel mat_panel;
typedef union M128{
#if SN_IS_ARCH(x86_64)
__m128 m128;
#endif
float f32[4];
double f64[2];
int32_t i32[4];
int64_t i64[2];
}M128;
typedef union scalar_pack {
uint64_t data[8];
} scalar_pack;
typedef union M256{
#if SN_IS_ARCH(x86_64)
__m256 m256;
#endif
float f32[8];
double f64[4];
int32_t i32[8];
int64_t i64[4];
}M256;
typedef union M512{
#if SN_IS_ARCH(x86_64)
__m512 m512;
#endif
uint64_t u64[8];
uint32_t u32[16];
float f32[16];
double f64[8];
int32_t i32[16];
int64_t i64[8];
}M512;
typedef struct sn_L4_cache_head {
uint64_t reverse_mask_0;
@@ -81,42 +107,33 @@ typedef struct sn_L4_cache_head {
typedef struct sn_L4_handle {
void *ptr;
sn_L4_cache_head head;
sn_L4_cache_head* head;
} sn_L4_handle;
typedef struct matrix_task_pack {
typedef struct matrix_task {
sn_L4_handle buffer_0;
sn_L4_handle buffer_1;
sn_L4_handle buffer_2;
sn_L4_handle buffer_3;
uint64_t reverse_0;
uint64_t reverse_1;
uint64_t reverse_2;
uint64_t reverse_3;
uint64_t reverse_4;
uint64_t reverse_5;
uint64_t reverse_6;
uint64_t reverse_7;
union {
struct {
int offset_0;
int count_0;
int offset_1;
int count_1;
int offset_2;
int count_2;
int offset_3;
int count_3;
uint64_t reverse;
M128 scalar_pack;
};
M512 profile;
};
} matrix_task_pack;
typedef struct matrix_task {
void *mat_0;
void *mat_1;
void *mat_2;
void *scalar;
int32_t x;
int32_t y;
int32_t z;
int32_t common_x;
int32_t common_y;
int32_t common_z;
uint32_t mask;
uint32_t reverse;
scalar_pack padding;
} matrix_task;
#define MAT_TASK(T) matrix_task_pack
#define MAT_TASK(T) matrix_task
#if defined(__cplusplus)
static_assert(sizeof(matrix_task) == 128, "matrix_parallel_task_package size mismatch");
@@ -128,7 +145,7 @@ typedef void(SN_DECL *UNI_MK_PROC)(matrix_task *task);
typedef void(SN_DECL *UNI_SK_PROC)(mat_kernel const *left, mat_kernel const *right,
mat_kernel *restrict ans, uint64_t scalar);
typedef void(SN_DECL *VECTORNORMALIZEPROC)(sn_vec_f32 *source, sn_vec_f32 *target);
typedef void(SN_DECL *VECTORNORMALIZEPROC)(VEC_SEGMENT(float) *source, VEC_SEGMENT(float) *target);
typedef void(SN_DECL *DOTPROC)(void *transpose, __m128 *vector, __m128 *ans);
typedef uint64_t(SN_DECL *FACTORIALROC)(int n);