redesign matrix design
This commit is contained in:
@@ -96,40 +96,6 @@ static_assert(sizeof(matrix_task) == 128, "matrix_parallel_task_package size mis
|
||||
_Static_assert(sizeof(MAT_TASK(float)) == 128, "matrix_parallel_task_package size mismatch");
|
||||
#endif
|
||||
|
||||
#pragma region matrix buffer operation function type
|
||||
|
||||
typedef void(SN_DECL *BUF_PROC_AS)(mat_kernel *ans, scalar_pack *scalar, int count);
|
||||
typedef void(SN_DECL *BUF_PROC_RAS)(mat_kernel *right, mat_kernel *ans, scalar_pack *scalar,
|
||||
int count);
|
||||
typedef void(SN_DECL *BUF_PROC_LRAS)(mat_kernel *left, mat_kernel *right, mat_kernel *ans,
|
||||
scalar_pack *scalar, int count);
|
||||
typedef void(SN_DECL *BUF_PROC_RA)(mat_kernel *right, mat_kernel *ans, int count);
|
||||
typedef void(SN_DECL *BUF_PROC_LRA)(mat_kernel *left, mat_kernel *right, mat_kernel *ans,
|
||||
int count);
|
||||
|
||||
#define BUF_PROC(T_type, T_arch, T_op_name) T_type##_buf_##T_op_name##_##T_arch
|
||||
|
||||
#define DECLARE_BUF_PROC_ANS_SCALAR(T_type, T_arch, T_op_name) \
|
||||
INTERNAL void SN_DECL BUF_PROC(T_type, T_arch, T_op_name)( \
|
||||
MAT_KERNEL(T_type) *restrict ans, scalar_pack const *scalar, size_t count)
|
||||
#define DECLARE_BUF_PROC_RIGHT_ANS_SCALAR(T_type, T_arch, T_op_name) \
|
||||
INTERNAL void SN_DECL BUF_PROC(T_type, T_arch, T_op_name)( \
|
||||
MAT_KERNEL(T_type) const *right, MAT_KERNEL(T_type) *restrict ans, \
|
||||
scalar_pack const *scalar, int count)
|
||||
#define DECLARE_BUF_PROC_LEFT_RIGHT_ANS_SCALAR(T_type, T_arch, T_op_name) \
|
||||
INTERNAL void SN_DECL BUF_PROC(T_type, T_arch, T_op_name)( \
|
||||
MAT_KERNEL(T_type) const *left, MAT_KERNEL(T_type) const *right, \
|
||||
MAT_KERNEL(T_type) *restrict ans, scalar_pack const *scalar, size_t count)
|
||||
#define DECLARE_BUF_PROC_RIGHT_ANS(T_type, T_arch, T_op_name) \
|
||||
INTERNAL void SN_DECL BUF_PROC(T_type, T_arch, T_op_name)( \
|
||||
MAT_KERNEL(T_type) const *right, MAT_KERNEL(T_type) *restrict ans, size_t count)
|
||||
#define DECLARE_BUF_PROC_LEFT_RIGHT_ANS(T_type, T_arch, T_op_name) \
|
||||
INTERNAL void SN_DECL BUF_PROC(T_type, T_arch, T_op_name)( \
|
||||
MAT_KERNEL(T_type) const *left, MAT_KERNEL(T_type) const *right, \
|
||||
MAT_KERNEL(T_type) *restrict ans, size_t count)
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region matrix panel function type
|
||||
|
||||
typedef void(SN_DECL *PANEL_PROC)(mat_panel *panel, mat_kernel *kernel, int col_length,
|
||||
@@ -176,6 +142,9 @@ typedef void(SN_DECL *KER_PROC_LAS)(mat_kernel *matrix, mat_kernel *ans, scalar_
|
||||
|
||||
#define KER_PROC(T_type, T_arch, T_op_name) T_type##_kernel_##T_op_name##_##T_arch
|
||||
|
||||
#define DECLARE_KER_PROC_ANS_SCALAR(T_type, T_arch, T_op_name) \
|
||||
INTERNAL void SN_DECL KER_PROC(T_type, T_arch, T_op_name)( \
|
||||
MAT_KERNEL(T_type) *restrict ans, scalar_pack const *scalar)
|
||||
#define DECLARE_KER_PROC_LEFT_RIGHT_ANS_SCALAR(T_type, T_arch, T_op_name) \
|
||||
INTERNAL void SN_DECL KER_PROC(T_type, T_arch, T_op_name)( \
|
||||
MAT_KERNEL(T_type) const *left, MAT_KERNEL(T_type) const *right, \
|
||||
@@ -216,25 +185,25 @@ typedef uint64_t(SN_DECL *FACTORIALROC)(int n);
|
||||
|
||||
INTERNAL void f32_normalize(VEC(float) * source, VEC(float) * target);
|
||||
|
||||
DECLARE_BUF_PROC_LEFT_RIGHT_ANS(float, sse, add);
|
||||
DECLARE_BUF_PROC_LEFT_RIGHT_ANS(float, avx, add);
|
||||
DECLARE_BUF_PROC_LEFT_RIGHT_ANS(float, 512, add);
|
||||
DECLARE_KER_PROC_LEFT_RIGHT_ANS(float, sse, add);
|
||||
DECLARE_KER_PROC_LEFT_RIGHT_ANS(float, avx, add);
|
||||
DECLARE_KER_PROC_LEFT_RIGHT_ANS(float, 512, add);
|
||||
|
||||
DECLARE_BUF_PROC_LEFT_RIGHT_ANS(float, sse, sub);
|
||||
DECLARE_BUF_PROC_LEFT_RIGHT_ANS(float, avx, sub);
|
||||
DECLARE_BUF_PROC_LEFT_RIGHT_ANS(float, 512, sub);
|
||||
DECLARE_KER_PROC_LEFT_RIGHT_ANS(float, sse, sub);
|
||||
DECLARE_KER_PROC_LEFT_RIGHT_ANS(float, avx, sub);
|
||||
DECLARE_KER_PROC_LEFT_RIGHT_ANS(float, 512, sub);
|
||||
|
||||
DECLARE_KER_PROC_RIGHT_ANS(float, sse, transpose);
|
||||
DECLARE_KER_PROC_RIGHT_ANS(float, avx, transpose);
|
||||
DECLARE_KER_PROC_RIGHT_ANS(float, 512, transpose);
|
||||
|
||||
DECLARE_BUF_PROC_RIGHT_ANS_SCALAR(float, sse, scalar_mul);
|
||||
DECLARE_BUF_PROC_RIGHT_ANS_SCALAR(float, avx, scalar_mul);
|
||||
DECLARE_BUF_PROC_RIGHT_ANS_SCALAR(float, 512, scalar_mul);
|
||||
DECLARE_KER_PROC_RIGHT_ANS_SCALAR(float, sse, scalar_mul);
|
||||
DECLARE_KER_PROC_RIGHT_ANS_SCALAR(float, avx, scalar_mul);
|
||||
DECLARE_KER_PROC_RIGHT_ANS_SCALAR(float, 512, scalar_mul);
|
||||
|
||||
DECLARE_BUF_PROC_ANS_SCALAR(float, sse, fill);
|
||||
DECLARE_BUF_PROC_ANS_SCALAR(float, avx, fill);
|
||||
DECLARE_BUF_PROC_ANS_SCALAR(float, 512, fill);
|
||||
DECLARE_KER_PROC_ANS_SCALAR(float, sse, fill);
|
||||
DECLARE_KER_PROC_ANS_SCALAR(float, avx, fill);
|
||||
DECLARE_KER_PROC_ANS_SCALAR(float, 512, fill);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@@ -280,6 +249,18 @@ INTERNAL int SN_DECL index_pair_sse(short const *str, uint32_t target, int lengt
|
||||
|
||||
#pragma endregion
|
||||
|
||||
typedef struct sn_mat_enumerator {
|
||||
int CurrentColumn;
|
||||
int CurrentRow;
|
||||
int KernelColumnLength;
|
||||
int KernelRowLength;
|
||||
} sn_mat_enumerator;
|
||||
|
||||
typedef struct sn_mat_boarder {
|
||||
int (*SN_DECL is_in_buffer)(int col, int row, sn_mat_enumerator *enumerator);
|
||||
long (*SN_DECL get_index_offset)(int col, int row, sn_mat_enumerator *wnumerator);
|
||||
} sn_mat_boarder;
|
||||
|
||||
// Mirrors C# IntrinsicContext field order so managed/unmanaged layouts stay in sync.
|
||||
typedef struct sn_intrinsic {
|
||||
HASH city_hash_simplify;
|
||||
|
||||
Reference in New Issue
Block a user