new compute kernel design, less mem read delay

This commit is contained in:
Nitload
2026-04-07 01:04:05 +08:00
parent d702b3224c
commit 12a216d404
47 changed files with 225 additions and 145 deletions
+17 -19
View File
@@ -2,30 +2,33 @@
#define SN_INTRINSIC_CallCONV_STD
#include "sn_internal.h"
#include "sn_target.h"
#include "sn_intrinsic.h"
#ifndef static_assert
#define static_assert _Static_assert
#endif
#define SN_STD_TARGET_ATTR(T_arch, T_feature) SN_STD_TARGET_ATTR_IMPL(T_arch, T_feature)
#define SN_STD_TARGET_ATTR_IMPL(T_arch, T_feature) SN_X86_TARGET_ATTR_##T_arch##T_feature
#define MK_PROC_NAME_STD(T_type, T_arch, T_feature, T_op) \
T_type##_multi_kernel_proc_##T_op##_##T_arch##_##T_feature
#define GET_MK_PROC_STD(T_type, T_arch, T_feature, T_op) \
MK_PROC_NAME_STD(T_type, T_arch, T_feature, T_op)
((UNI_MK_PROC)MK_PROC_NAME_STD(T_type, T_arch, T_feature, T_op))
#define SN_MK_PROC_DECL(T_type, P_name) INTERNAL void SN_DECL P_name(MAT_TASK(T_type) const *task)
#define SN_MK_PROC_DECL_STD(T_type, T_arch, T_feature, T_op) \
INTERNAL void SN_DECL MK_PROC_NAME_STD(T_type, T_arch, T_feature, \
T_op)(MAT_TASK(T_type) const *task)
#define SN_MK_PROC_DECL_STD(T_type, T_arch, T_feature, T_op) \
INTERNAL NOINLINE SN_STD_TARGET_ATTR(T_arch, T_feature) void SN_DECL \
MK_PROC_NAME_STD(T_type, T_arch, T_feature, T_op)(MAT_TASK(T_type) const *task)
#define SK_PROC_NAME_STD(T_type, T_arch, T_feature, T_op) \
T_type##_single_kernel_proc_##T_op##_##T_arch##_##T_feature
#define GET_SK_PROC_STD(T_type, T_arch, T_feature, T_op) \
SK_PROC_NAME_STD(T_type, T_arch, T_feature, T_op)
#define SN_SK_PROC_DECL_STD(T_type, T_arch, T_feature, T_op) \
INTERNAL void SN_DECL SK_PROC_NAME_STD(T_type, T_arch, T_feature, \
T_op)(sn_mat_kernel_opaque const *left_ptr, \
sn_mat_kernel_opaque const *right_ptr, \
sn_mat_kernel_opaque *restrict ans_ptr, \
uint64_t scalar)
((UNI_SK_PROC)SK_PROC_NAME_STD(T_type, T_arch, T_feature, T_op))
#define SN_SK_PROC_DECL_STD(T_type, T_arch, T_feature, T_op) \
INTERNAL NOINLINE SN_STD_TARGET_ATTR(T_arch, T_feature) void SN_DECL \
SK_PROC_NAME_STD(T_type, T_arch, T_feature, T_op)( \
MAT_KERNEL(T_type) const *left, MAT_KERNEL(T_type) const *right, \
MAT_KERNEL(T_type) *restrict ans, uint64_t scalar)
#define _SN_STD__PROBE_0 0
#define _SN_STD__PROBE_1 1
@@ -103,12 +106,7 @@
_SN_MK_EXPAND_PARAM(param); \
_SN_MK_EXPAND_MEM(mem)
#define __sk_param_std(T) \
typedef MAT_KERNEL(T) SN_MAT_KERNEL_LOCAL; \
SN_MAT_KERNEL_LOCAL const *left = \
(SN_MAT_KERNEL_LOCAL const *)(left_ptr); \
SN_MAT_KERNEL_LOCAL const *right = \
(SN_MAT_KERNEL_LOCAL const *)(right_ptr); \
SN_MAT_KERNEL_LOCAL *restrict ans = \
(SN_MAT_KERNEL_LOCAL *)(ans_ptr)
#define __sk_param_std(T) \
typedef MAT_KERNEL(T) SN_MAT_KERNEL_LOCAL; \
(void)scalar
#endif // !SN_INTRINSIC_PARAM_EXPAND