MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / ggml_vec_dot_f32

Function ggml_vec_dot_f32

ggml/src/ggml-cpu/vec.cpp:11–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9ggml_fp16_t ggml_table_gelu_quick_f16[1 << 16];
10
11void ggml_vec_dot_f32(int n, float * GGML_RESTRICT s, size_t bs, const float * GGML_RESTRICT x, size_t bx, const float * GGML_RESTRICT y, size_t by, int nrc) {
12 assert(nrc == 1);
13 GGML_UNUSED(nrc);
14 GGML_UNUSED(bx);
15 GGML_UNUSED(by);
16 GGML_UNUSED(bs);
17
18#if defined(GGML_SIMD)
19 float sumf = 0.0f;
20
21 #if defined(__ARM_FEATURE_SVE)
22 const int sve_register_length = ggml_cpu_get_sve_cnt() * 8;
23 const int ggml_f32_epr = sve_register_length / 32;//8;//svcntw(); // SVE128:4, SVE256:8, SVE512:16
24 const int ggml_f32_step = 8 * ggml_f32_epr; // choose 8 SVE registers
25
26 const int np = (n & ~(ggml_f32_step - 1));
27 svfloat32_t sum1 = svdup_n_f32(0.0f);
28 svfloat32_t sum2 = svdup_n_f32(0.0f);
29 svfloat32_t sum3 = svdup_n_f32(0.0f);
30 svfloat32_t sum4 = svdup_n_f32(0.0f);
31 svfloat32_t sum5 = svdup_n_f32(0.0f);
32 svfloat32_t sum6 = svdup_n_f32(0.0f);
33 svfloat32_t sum7 = svdup_n_f32(0.0f);
34 svfloat32_t sum8 = svdup_n_f32(0.0f);
35 svfloat32_t ax1,ax2,ax3,ax4,ax5,ax6,ax7,ax8;
36 svfloat32_t ay1,ay2,ay3,ay4,ay5,ay6,ay7,ay8;
37 for (int i = 0; i < np; i += ggml_f32_step) {
38 ax1 = GGML_F32_VEC_LOAD(x + i);
39 ay1 = GGML_F32_VEC_LOAD(y + i);
40 sum1 = GGML_F32_VEC_FMA(sum1, ax1, ay1);
41
42 ax2 = GGML_F32_VEC_LOAD(x + i + 1*ggml_f32_epr);
43 ay2 = GGML_F32_VEC_LOAD(y + i + 1*ggml_f32_epr);
44 sum2 = GGML_F32_VEC_FMA(sum2, ax2, ay2);
45
46 ax3 = GGML_F32_VEC_LOAD(x + i + 2*ggml_f32_epr);
47 ay3 = GGML_F32_VEC_LOAD(y + i + 2*ggml_f32_epr);
48 sum3 = GGML_F32_VEC_FMA(sum3, ax3, ay3);
49
50 ax4 = GGML_F32_VEC_LOAD(x + i + 3*ggml_f32_epr);
51 ay4 = GGML_F32_VEC_LOAD(y + i + 3*ggml_f32_epr);
52 sum4 = GGML_F32_VEC_FMA(sum4, ax4, ay4);
53
54 ax5 = GGML_F32_VEC_LOAD(x + i + 4*ggml_f32_epr);
55 ay5 = GGML_F32_VEC_LOAD(y + i + 4*ggml_f32_epr);
56 sum5 = GGML_F32_VEC_FMA(sum5, ax5, ay5);
57
58 ax6 = GGML_F32_VEC_LOAD(x + i + 5*ggml_f32_epr);
59 ay6 = GGML_F32_VEC_LOAD(y + i + 5*ggml_f32_epr);
60 sum6 = GGML_F32_VEC_FMA(sum6, ax6, ay6);
61
62 ax7 = GGML_F32_VEC_LOAD(x + i + 6*ggml_f32_epr);
63 ay7 = GGML_F32_VEC_LOAD(y + i + 6*ggml_f32_epr);
64 sum7 = GGML_F32_VEC_FMA(sum7, ax7, ay7);
65
66 ax8 = GGML_F32_VEC_LOAD(x + i + 7*ggml_f32_epr);
67 ay8 = GGML_F32_VEC_LOAD(y + i + 7*ggml_f32_epr);
68 sum8 = GGML_F32_VEC_FMA(sum8, ax8, ay8);

Calls 1

ggml_cpu_get_sve_cntFunction · 0.85

Tested by

no test coverage detected