← Back to C-Kernel-Engine Docs Doxygen Source Documentation
 
Loading...
Searching...
No Matches
attention_oracle_ggml.h
Go to the documentation of this file.
1#ifndef CK_ATTENTION_ORACLE_GGML_H
2#define CK_ATTENTION_ORACLE_GGML_H
3
4#ifndef CK_ENABLE_LLAMA_CPP_PARITY
5#define CK_ENABLE_LLAMA_CPP_PARITY 0
6#endif
7
8// Strict parity oracles for encoder-style full attention.
9// These are ggml-backed composite helpers, not production CK kernels.
10
11#if CK_ENABLE_LLAMA_CPP_PARITY
13 const float *k_head,
14 const float *v_head,
15 float *out_head,
16 int num_tokens,
17 int head_dim,
18 int aligned_head_dim,
19 float scale);
20
22 const float *k,
23 const float *v,
24 float *output,
25 int num_heads,
26 int num_kv_heads,
27 int num_tokens,
28 int head_dim,
29 int aligned_head_dim,
30 int kv_stride_tokens,
31 float scale);
32#else
33static inline int ck_attention_head_full_ggml_graph_oracle_regular(const float *q_head,
34 const float *k_head,
35 const float *v_head,
36 float *out_head,
37 int num_tokens,
38 int head_dim,
39 int aligned_head_dim,
40 float scale)
41{
42 (void) q_head;
43 (void) k_head;
44 (void) v_head;
45 (void) out_head;
46 (void) num_tokens;
47 (void) head_dim;
48 (void) aligned_head_dim;
49 (void) scale;
50 return 0;
51}
52
53static inline int ck_attention_full_ggml_graph_oracle_multihead(const float *q,
54 const float *k,
55 const float *v,
56 float *output,
57 int num_heads,
58 int num_kv_heads,
59 int num_tokens,
60 int head_dim,
61 int aligned_head_dim,
62 int kv_stride_tokens,
63 float scale)
64{
65 (void) q;
66 (void) k;
67 (void) v;
68 (void) output;
69 (void) num_heads;
70 (void) num_kv_heads;
71 (void) num_tokens;
72 (void) head_dim;
73 (void) aligned_head_dim;
74 (void) kv_stride_tokens;
75 (void) scale;
76 return 0;
77}
78#endif
79
80#endif
static int ck_attention_full_ggml_graph_oracle_multihead(const float *q, const float *k, const float *v, float *output, int num_heads, int num_kv_heads, int num_tokens, int head_dim, int aligned_head_dim, int kv_stride_tokens, float scale)
static int ck_attention_head_full_ggml_graph_oracle_regular(const float *q_head, const float *k_head, const float *v_head, float *out_head, int num_tokens, int head_dim, int aligned_head_dim, float scale)