← Back to C-Kernel-Engine Docs Doxygen Source Documentation
 
Loading...
Searching...
No Matches
v6.5/test_generated/ck-kernel-inference.h
Go to the documentation of this file.
1/**
2 * @file ck-kernel-inference.h
3 * @brief AUTO-GENERATED: qwen2_0.5b_decode Memory Layout
4 *
5 * Generated: 2026-01-12T04:06:36.660353 UTC
6 * Total Memory: 3.57 GB
7 *
8 * DO NOT EDIT - Regenerate with build_ir_v3.py
9 */
10
11#ifndef GENERATED_QWEN2_0_5B_DECODE_H
12#define GENERATED_QWEN2_0_5B_DECODE_H
13
14#include <stddef.h>
15#include <stdint.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/* ============================================================================
22 * MODEL CONFIGURATION
23 * ============================================================================ */
24
25#define QWEN2_0_5B_DECODE_EMBED_DIM 896
26#define QWEN2_0_5B_DECODE_NUM_HEADS 14
27#define QWEN2_0_5B_DECODE_NUM_KV_HEADS 2
28#define QWEN2_0_5B_DECODE_HEAD_DIM 64
29#define QWEN2_0_5B_DECODE_INTERMEDIATE 4864
30#define QWEN2_0_5B_DECODE_NUM_LAYERS 24
31#define QWEN2_0_5B_DECODE_VOCAB_SIZE 151936
32#define QWEN2_0_5B_DECODE_MAX_SEQ_LEN 131072
33#define QWEN2_0_5B_DECODE_NUM_MERGES 0
34#define QWEN2_0_5B_DECODE_TOTAL_VOCAB_BYTES 0
35#define QWEN2_0_5B_DECODE_DTYPE_BYTES 4
36
37#define QWEN2_0_5B_DECODE_TOTAL_BYTES 3573889600ULL
38#define QWEN2_0_5B_DECODE_WEIGHT_BYTES 317683328ULL
39#define QWEN2_0_5B_DECODE_ACTIVATION_BYTES 3256169984ULL
40
41#define QWEN2_0_5B_DECODE_MAGIC 0x434B454EUL
42#define QWEN2_0_5B_DECODE_CANARY_VALUE 0xDEADBEEFUL
43#define QWEN2_0_5B_DECODE_CANARY_SIZE 64
44
45/* ============================================================================
46 * HEADER OFFSETS
47 * ============================================================================ */
48
49typedef struct {
50 size_t token_emb; /* [151936, 1024] */
51 size_t vocab_offsets; /* [151936] */
52 size_t vocab_strings; /* [0] */
53 size_t vocab_merges; /* [0, 3] */
54 size_t embedded_input; /* [1, 1024] */
56
58 .token_emb = 0x00000080,
59 .vocab_offsets = 0x053760C0,
60 .vocab_strings = 0x0538AF40,
61 .vocab_merges = 0x0538AF80,
62 .embedded_input = 0x0538AFC0,
63};
64
65/* ============================================================================
66 * LAYER OFFSETS
67 * ============================================================================ */
68
69typedef struct {
70 size_t ln1_gamma; /* [1024] */
71 size_t ln1_out; /* [1, 1024] */
72 size_t wq; /* [14, 64, 1024] */
73 size_t bq; /* [14, 64] */
74 size_t wk; /* [2, 64, 1024] */
75 size_t bk; /* [2, 64] */
76 size_t wv; /* [2, 64, 1024] */
77 size_t bv; /* [2, 64] */
78 size_t q; /* [14, 1, 64] */
79 size_t k; /* [2, 131072, 64] */
80 size_t v; /* [2, 131072, 64] */
81 size_t wo; /* [14, 1024, 64] */
82 size_t proj_tmp; /* [1, 1024] */
83 size_t proj_scratch; /* [1, 1024] */
84 size_t residual1; /* [1, 1024] */
85 size_t ln2_gamma; /* [1024] */
86 size_t ln2_out; /* [1, 1024] */
87 size_t w1; /* [9728, 1024] */
88 size_t w2; /* [1024, 4864] */
89 size_t mlp_out; /* [1, 1024] */
90 size_t output; /* [1, 1024] */
92
94 [0] = {
95 .ln1_gamma = 0x0538C080,
96 .ln1_out = 0x0538C300,
97 .wq = 0x0538D340,
98 .bq = 0x0540B380,
99 .wk = 0x0540B600,
100 .bk = 0x0541D640,
101 .wv = 0x0541D740,
102 .bv = 0x0542F780,
103 .q = 0x0542F880,
104 .k = 0x054306C0,
105 .v = 0x09430700,
106 .wo = 0x0D430740,
107 .proj_tmp = 0x0D4AE780,
108 .proj_scratch = 0x0D4AF7C0,
109 .residual1 = 0x0D4B0800,
110 .ln2_gamma = 0x0D4B1840,
111 .ln2_out = 0x0D4B1AC0,
112 .w1 = 0x0D4B2B00,
113 .w2 = 0x0DA0AB40,
114 .mlp_out = 0x0DCB6B80,
115 .output = 0x0DCB7BC0,
116 },
117 [1] = {
118 .ln1_gamma = 0x0DCB8C80,
119 .ln1_out = 0x0DCB8F00,
120 .wq = 0x0DCB9F40,
121 .bq = 0x0DD37F80,
122 .wk = 0x0DD38200,
123 .bk = 0x0DD4A240,
124 .wv = 0x0DD4A340,
125 .bv = 0x0DD5C380,
126 .q = 0x0DD5C480,
127 .k = 0x0DD5D2C0,
128 .v = 0x11D5D300,
129 .wo = 0x15D5D340,
130 .proj_tmp = 0x15DDB380,
131 .proj_scratch = 0x15DDC3C0,
132 .residual1 = 0x15DDD400,
133 .ln2_gamma = 0x15DDE440,
134 .ln2_out = 0x15DDE6C0,
135 .w1 = 0x15DDF700,
136 .w2 = 0x16337740,
137 .mlp_out = 0x165E3780,
138 .output = 0x165E47C0,
139 },
140 [2] = {
141 .ln1_gamma = 0x165E5880,
142 .ln1_out = 0x165E5B00,
143 .wq = 0x165E6B40,
144 .bq = 0x16664B80,
145 .wk = 0x16664E00,
146 .bk = 0x16676E40,
147 .wv = 0x16676F40,
148 .bv = 0x16688F80,
149 .q = 0x16689080,
150 .k = 0x16689EC0,
151 .v = 0x1A689F00,
152 .wo = 0x1E689F40,
153 .proj_tmp = 0x1E707F80,
154 .proj_scratch = 0x1E708FC0,
155 .residual1 = 0x1E70A000,
156 .ln2_gamma = 0x1E70B040,
157 .ln2_out = 0x1E70B2C0,
158 .w1 = 0x1E70C300,
159 .w2 = 0x1EC64340,
160 .mlp_out = 0x1EF10380,
161 .output = 0x1EF113C0,
162 },
163 [3] = {
164 .ln1_gamma = 0x1EF12480,
165 .ln1_out = 0x1EF12700,
166 .wq = 0x1EF13740,
167 .bq = 0x1EF91780,
168 .wk = 0x1EF91A00,
169 .bk = 0x1EFA3A40,
170 .wv = 0x1EFA3B40,
171 .bv = 0x1EFB5B80,
172 .q = 0x1EFB5C80,
173 .k = 0x1EFB6AC0,
174 .v = 0x22FB6B00,
175 .wo = 0x26FB6B40,
176 .proj_tmp = 0x27034B80,
177 .proj_scratch = 0x27035BC0,
178 .residual1 = 0x27036C00,
179 .ln2_gamma = 0x27037C40,
180 .ln2_out = 0x27037EC0,
181 .w1 = 0x27038F00,
182 .w2 = 0x27590F40,
183 .mlp_out = 0x2783CF80,
184 .output = 0x2783DFC0,
185 },
186 [4] = {
187 .ln1_gamma = 0x2783F080,
188 .ln1_out = 0x2783F300,
189 .wq = 0x27840340,
190 .bq = 0x278BE380,
191 .wk = 0x278BE600,
192 .bk = 0x278D0640,
193 .wv = 0x278D0740,
194 .bv = 0x278E2780,
195 .q = 0x278E2880,
196 .k = 0x278E36C0,
197 .v = 0x2B8E3700,
198 .wo = 0x2F8E3740,
199 .proj_tmp = 0x2F961780,
200 .proj_scratch = 0x2F9627C0,
201 .residual1 = 0x2F963800,
202 .ln2_gamma = 0x2F964840,
203 .ln2_out = 0x2F964AC0,
204 .w1 = 0x2F965B00,
205 .w2 = 0x2FEBDB40,
206 .mlp_out = 0x30169B80,
207 .output = 0x3016ABC0,
208 },
209 [5] = {
210 .ln1_gamma = 0x3016BC80,
211 .ln1_out = 0x3016BF00,
212 .wq = 0x3016CF40,
213 .bq = 0x301EAF80,
214 .wk = 0x301EB200,
215 .bk = 0x301FD240,
216 .wv = 0x301FD340,
217 .bv = 0x3020F380,
218 .q = 0x3020F480,
219 .k = 0x302102C0,
220 .v = 0x34210300,
221 .wo = 0x38210340,
222 .proj_tmp = 0x3828E380,
223 .proj_scratch = 0x3828F3C0,
224 .residual1 = 0x38290400,
225 .ln2_gamma = 0x38291440,
226 .ln2_out = 0x382916C0,
227 .w1 = 0x38292700,
228 .w2 = 0x387EA740,
229 .mlp_out = 0x38A96780,
230 .output = 0x38A977C0,
231 },
232 [6] = {
233 .ln1_gamma = 0x38A98880,
234 .ln1_out = 0x38A98B00,
235 .wq = 0x38A99B40,
236 .bq = 0x38B17B80,
237 .wk = 0x38B17E00,
238 .bk = 0x38B29E40,
239 .wv = 0x38B29F40,
240 .bv = 0x38B3BF80,
241 .q = 0x38B3C080,
242 .k = 0x38B3CEC0,
243 .v = 0x3CB3CF00,
244 .wo = 0x40B3CF40,
245 .proj_tmp = 0x40BBAF80,
246 .proj_scratch = 0x40BBBFC0,
247 .residual1 = 0x40BBD000,
248 .ln2_gamma = 0x40BBE040,
249 .ln2_out = 0x40BBE2C0,
250 .w1 = 0x40BBF300,
251 .w2 = 0x41117340,
252 .mlp_out = 0x413C3380,
253 .output = 0x413C43C0,
254 },
255 [7] = {
256 .ln1_gamma = 0x413C5480,
257 .ln1_out = 0x413C5700,
258 .wq = 0x413C6740,
259 .bq = 0x41444780,
260 .wk = 0x41444A00,
261 .bk = 0x41456A40,
262 .wv = 0x41456B40,
263 .bv = 0x41468B80,
264 .q = 0x41468C80,
265 .k = 0x41469AC0,
266 .v = 0x45469B00,
267 .wo = 0x49469B40,
268 .proj_tmp = 0x494E7B80,
269 .proj_scratch = 0x494E8BC0,
270 .residual1 = 0x494E9C00,
271 .ln2_gamma = 0x494EAC40,
272 .ln2_out = 0x494EAEC0,
273 .w1 = 0x494EBF00,
274 .w2 = 0x49A43F40,
275 .mlp_out = 0x49CEFF80,
276 .output = 0x49CF0FC0,
277 },
278 [8] = {
279 .ln1_gamma = 0x49CF2080,
280 .ln1_out = 0x49CF2300,
281 .wq = 0x49CF3340,
282 .bq = 0x49D71380,
283 .wk = 0x49D71600,
284 .bk = 0x49D83640,
285 .wv = 0x49D83740,
286 .bv = 0x49D95780,
287 .q = 0x49D95880,
288 .k = 0x49D966C0,
289 .v = 0x4DD96700,
290 .wo = 0x51D96740,
291 .proj_tmp = 0x51E14780,
292 .proj_scratch = 0x51E157C0,
293 .residual1 = 0x51E16800,
294 .ln2_gamma = 0x51E17840,
295 .ln2_out = 0x51E17AC0,
296 .w1 = 0x51E18B00,
297 .w2 = 0x52370B40,
298 .mlp_out = 0x5261CB80,
299 .output = 0x5261DBC0,
300 },
301 [9] = {
302 .ln1_gamma = 0x5261EC80,
303 .ln1_out = 0x5261EF00,
304 .wq = 0x5261FF40,
305 .bq = 0x5269DF80,
306 .wk = 0x5269E200,
307 .bk = 0x526B0240,
308 .wv = 0x526B0340,
309 .bv = 0x526C2380,
310 .q = 0x526C2480,
311 .k = 0x526C32C0,
312 .v = 0x566C3300,
313 .wo = 0x5A6C3340,
314 .proj_tmp = 0x5A741380,
315 .proj_scratch = 0x5A7423C0,
316 .residual1 = 0x5A743400,
317 .ln2_gamma = 0x5A744440,
318 .ln2_out = 0x5A7446C0,
319 .w1 = 0x5A745700,
320 .w2 = 0x5AC9D740,
321 .mlp_out = 0x5AF49780,
322 .output = 0x5AF4A7C0,
323 },
324 [10] = {
325 .ln1_gamma = 0x5AF4B880,
326 .ln1_out = 0x5AF4BB00,
327 .wq = 0x5AF4CB40,
328 .bq = 0x5AFCAB80,
329 .wk = 0x5AFCAE00,
330 .bk = 0x5AFDCE40,
331 .wv = 0x5AFDCF40,
332 .bv = 0x5AFEEF80,
333 .q = 0x5AFEF080,
334 .k = 0x5AFEFEC0,
335 .v = 0x5EFEFF00,
336 .wo = 0x62FEFF40,
337 .proj_tmp = 0x6306DF80,
338 .proj_scratch = 0x6306EFC0,
339 .residual1 = 0x63070000,
340 .ln2_gamma = 0x63071040,
341 .ln2_out = 0x630712C0,
342 .w1 = 0x63072300,
343 .w2 = 0x635CA340,
344 .mlp_out = 0x63876380,
345 .output = 0x638773C0,
346 },
347 [11] = {
348 .ln1_gamma = 0x63878480,
349 .ln1_out = 0x63878700,
350 .wq = 0x63879740,
351 .bq = 0x638F7780,
352 .wk = 0x638F7A00,
353 .bk = 0x63909A40,
354 .wv = 0x63909B40,
355 .bv = 0x6391BB80,
356 .q = 0x6391BC80,
357 .k = 0x6391CAC0,
358 .v = 0x6791CB00,
359 .wo = 0x6B91CB40,
360 .proj_tmp = 0x6B99AB80,
361 .proj_scratch = 0x6B99BBC0,
362 .residual1 = 0x6B99CC00,
363 .ln2_gamma = 0x6B99DC40,
364 .ln2_out = 0x6B99DEC0,
365 .w1 = 0x6B99EF00,
366 .w2 = 0x6BEF6F40,
367 .mlp_out = 0x6C1A2F80,
368 .output = 0x6C1A3FC0,
369 },
370 [12] = {
371 .ln1_gamma = 0x6C1A5080,
372 .ln1_out = 0x6C1A5300,
373 .wq = 0x6C1A6340,
374 .bq = 0x6C224380,
375 .wk = 0x6C224600,
376 .bk = 0x6C236640,
377 .wv = 0x6C236740,
378 .bv = 0x6C248780,
379 .q = 0x6C248880,
380 .k = 0x6C2496C0,
381 .v = 0x70249700,
382 .wo = 0x74249740,
383 .proj_tmp = 0x742C7780,
384 .proj_scratch = 0x742C87C0,
385 .residual1 = 0x742C9800,
386 .ln2_gamma = 0x742CA840,
387 .ln2_out = 0x742CAAC0,
388 .w1 = 0x742CBB00,
389 .w2 = 0x74823B40,
390 .mlp_out = 0x74ACFB80,
391 .output = 0x74AD0BC0,
392 },
393 [13] = {
394 .ln1_gamma = 0x74AD1C80,
395 .ln1_out = 0x74AD1F00,
396 .wq = 0x74AD2F40,
397 .bq = 0x74B50F80,
398 .wk = 0x74B51200,
399 .bk = 0x74B63240,
400 .wv = 0x74B63340,
401 .bv = 0x74B75380,
402 .q = 0x74B75480,
403 .k = 0x74B762C0,
404 .v = 0x78B76300,
405 .wo = 0x7CB76340,
406 .proj_tmp = 0x7CBF4380,
407 .proj_scratch = 0x7CBF53C0,
408 .residual1 = 0x7CBF6400,
409 .ln2_gamma = 0x7CBF7440,
410 .ln2_out = 0x7CBF76C0,
411 .w1 = 0x7CBF8700,
412 .w2 = 0x7D150740,
413 .mlp_out = 0x7D3FC780,
414 .output = 0x7D3FD7C0,
415 },
416 [14] = {
417 .ln1_gamma = 0x7D3FE880,
418 .ln1_out = 0x7D3FEB00,
419 .wq = 0x7D3FFB40,
420 .bq = 0x7D47DB80,
421 .wk = 0x7D47DE00,
422 .bk = 0x7D48FE40,
423 .wv = 0x7D48FF40,
424 .bv = 0x7D4A1F80,
425 .q = 0x7D4A2080,
426 .k = 0x7D4A2EC0,
427 .v = 0x814A2F00,
428 .wo = 0x854A2F40,
429 .proj_tmp = 0x85520F80,
430 .proj_scratch = 0x85521FC0,
431 .residual1 = 0x85523000,
432 .ln2_gamma = 0x85524040,
433 .ln2_out = 0x855242C0,
434 .w1 = 0x85525300,
435 .w2 = 0x85A7D340,
436 .mlp_out = 0x85D29380,
437 .output = 0x85D2A3C0,
438 },
439 [15] = {
440 .ln1_gamma = 0x85D2B480,
441 .ln1_out = 0x85D2B700,
442 .wq = 0x85D2C740,
443 .bq = 0x85DAA780,
444 .wk = 0x85DAAA00,
445 .bk = 0x85DBCA40,
446 .wv = 0x85DBCB40,
447 .bv = 0x85DCEB80,
448 .q = 0x85DCEC80,
449 .k = 0x85DCFAC0,
450 .v = 0x89DCFB00,
451 .wo = 0x8DDCFB40,
452 .proj_tmp = 0x8DE4DB80,
453 .proj_scratch = 0x8DE4EBC0,
454 .residual1 = 0x8DE4FC00,
455 .ln2_gamma = 0x8DE50C40,
456 .ln2_out = 0x8DE50EC0,
457 .w1 = 0x8DE51F00,
458 .w2 = 0x8E3A9F40,
459 .mlp_out = 0x8E655F80,
460 .output = 0x8E656FC0,
461 },
462 [16] = {
463 .ln1_gamma = 0x8E658080,
464 .ln1_out = 0x8E658300,
465 .wq = 0x8E659340,
466 .bq = 0x8E6D7380,
467 .wk = 0x8E6D7600,
468 .bk = 0x8E6E9640,
469 .wv = 0x8E6E9740,
470 .bv = 0x8E6FB780,
471 .q = 0x8E6FB880,
472 .k = 0x8E6FC6C0,
473 .v = 0x926FC700,
474 .wo = 0x966FC740,
475 .proj_tmp = 0x9677A780,
476 .proj_scratch = 0x9677B7C0,
477 .residual1 = 0x9677C800,
478 .ln2_gamma = 0x9677D840,
479 .ln2_out = 0x9677DAC0,
480 .w1 = 0x9677EB00,
481 .w2 = 0x96CD6B40,
482 .mlp_out = 0x96F82B80,
483 .output = 0x96F83BC0,
484 },
485 [17] = {
486 .ln1_gamma = 0x96F84C80,
487 .ln1_out = 0x96F84F00,
488 .wq = 0x96F85F40,
489 .bq = 0x97003F80,
490 .wk = 0x97004200,
491 .bk = 0x97016240,
492 .wv = 0x97016340,
493 .bv = 0x97028380,
494 .q = 0x97028480,
495 .k = 0x970292C0,
496 .v = 0x9B029300,
497 .wo = 0x9F029340,
498 .proj_tmp = 0x9F0A7380,
499 .proj_scratch = 0x9F0A83C0,
500 .residual1 = 0x9F0A9400,
501 .ln2_gamma = 0x9F0AA440,
502 .ln2_out = 0x9F0AA6C0,
503 .w1 = 0x9F0AB700,
504 .w2 = 0x9F603740,
505 .mlp_out = 0x9F8AF780,
506 .output = 0x9F8B07C0,
507 },
508 [18] = {
509 .ln1_gamma = 0x9F8B1880,
510 .ln1_out = 0x9F8B1B00,
511 .wq = 0x9F8B2B40,
512 .bq = 0x9F930B80,
513 .wk = 0x9F930E00,
514 .bk = 0x9F942E40,
515 .wv = 0x9F942F40,
516 .bv = 0x9F954F80,
517 .q = 0x9F955080,
518 .k = 0x9F955EC0,
519 .v = 0xA3955F00,
520 .wo = 0xA7955F40,
521 .proj_tmp = 0xA79D3F80,
522 .proj_scratch = 0xA79D4FC0,
523 .residual1 = 0xA79D6000,
524 .ln2_gamma = 0xA79D7040,
525 .ln2_out = 0xA79D72C0,
526 .w1 = 0xA79D8300,
527 .w2 = 0xA7F30340,
528 .mlp_out = 0xA81DC380,
529 .output = 0xA81DD3C0,
530 },
531 [19] = {
532 .ln1_gamma = 0xA81DE480,
533 .ln1_out = 0xA81DE700,
534 .wq = 0xA81DF740,
535 .bq = 0xA825D780,
536 .wk = 0xA825DA00,
537 .bk = 0xA826FA40,
538 .wv = 0xA826FB40,
539 .bv = 0xA8281B80,
540 .q = 0xA8281C80,
541 .k = 0xA8282AC0,
542 .v = 0xAC282B00,
543 .wo = 0xB0282B40,
544 .proj_tmp = 0xB0300B80,
545 .proj_scratch = 0xB0301BC0,
546 .residual1 = 0xB0302C00,
547 .ln2_gamma = 0xB0303C40,
548 .ln2_out = 0xB0303EC0,
549 .w1 = 0xB0304F00,
550 .w2 = 0xB085CF40,
551 .mlp_out = 0xB0B08F80,
552 .output = 0xB0B09FC0,
553 },
554 [20] = {
555 .ln1_gamma = 0xB0B0B080,
556 .ln1_out = 0xB0B0B300,
557 .wq = 0xB0B0C340,
558 .bq = 0xB0B8A380,
559 .wk = 0xB0B8A600,
560 .bk = 0xB0B9C640,
561 .wv = 0xB0B9C740,
562 .bv = 0xB0BAE780,
563 .q = 0xB0BAE880,
564 .k = 0xB0BAF6C0,
565 .v = 0xB4BAF700,
566 .wo = 0xB8BAF740,
567 .proj_tmp = 0xB8C2D780,
568 .proj_scratch = 0xB8C2E7C0,
569 .residual1 = 0xB8C2F800,
570 .ln2_gamma = 0xB8C30840,
571 .ln2_out = 0xB8C30AC0,
572 .w1 = 0xB8C31B00,
573 .w2 = 0xB9189B40,
574 .mlp_out = 0xB9435B80,
575 .output = 0xB9436BC0,
576 },
577 [21] = {
578 .ln1_gamma = 0xB9437C80,
579 .ln1_out = 0xB9437F00,
580 .wq = 0xB9438F40,
581 .bq = 0xB94B6F80,
582 .wk = 0xB94B7200,
583 .bk = 0xB94C9240,
584 .wv = 0xB94C9340,
585 .bv = 0xB94DB380,
586 .q = 0xB94DB480,
587 .k = 0xB94DC2C0,
588 .v = 0xBD4DC300,
589 .wo = 0xC14DC340,
590 .proj_tmp = 0xC155A380,
591 .proj_scratch = 0xC155B3C0,
592 .residual1 = 0xC155C400,
593 .ln2_gamma = 0xC155D440,
594 .ln2_out = 0xC155D6C0,
595 .w1 = 0xC155E700,
596 .w2 = 0xC1AB6740,
597 .mlp_out = 0xC1D62780,
598 .output = 0xC1D637C0,
599 },
600 [22] = {
601 .ln1_gamma = 0xC1D64880,
602 .ln1_out = 0xC1D64B00,
603 .wq = 0xC1D65B40,
604 .bq = 0xC1DE3B80,
605 .wk = 0xC1DE3E00,
606 .bk = 0xC1DF5E40,
607 .wv = 0xC1DF5F40,
608 .bv = 0xC1E07F80,
609 .q = 0xC1E08080,
610 .k = 0xC1E08EC0,
611 .v = 0xC5E08F00,
612 .wo = 0xC9E08F40,
613 .proj_tmp = 0xC9E86F80,
614 .proj_scratch = 0xC9E87FC0,
615 .residual1 = 0xC9E89000,
616 .ln2_gamma = 0xC9E8A040,
617 .ln2_out = 0xC9E8A2C0,
618 .w1 = 0xC9E8B300,
619 .w2 = 0xCA3E3340,
620 .mlp_out = 0xCA68F380,
621 .output = 0xCA6903C0,
622 },
623 [23] = {
624 .ln1_gamma = 0xCA691480,
625 .ln1_out = 0xCA691700,
626 .wq = 0xCA692740,
627 .bq = 0xCA710780,
628 .wk = 0xCA710A00,
629 .bk = 0xCA722A40,
630 .wv = 0xCA722B40,
631 .bv = 0xCA734B80,
632 .q = 0xCA734C80,
633 .k = 0xCA735AC0,
634 .v = 0xCE735B00,
635 .wo = 0xD2735B40,
636 .proj_tmp = 0xD27B3B80,
637 .proj_scratch = 0xD27B4BC0,
638 .residual1 = 0xD27B5C00,
639 .ln2_gamma = 0xD27B6C40,
640 .ln2_out = 0xD27B6EC0,
641 .w1 = 0xD27B7F00,
642 .w2 = 0xD2D0FF40,
643 .mlp_out = 0xD2FBBF80,
644 .output = 0xD2FBCFC0,
645 },
646};
647
648#define QWEN2_0_5B_DECODE_LAYER_STRIDE 0x0892CC00ULL
649
650/* ============================================================================
651 * FOOTER OFFSETS
652 * ============================================================================ */
653
654typedef struct {
655 size_t final_ln_weight; /* [1024] */
656 size_t final_output; /* [1, 1024] */
657 size_t lm_head_weight; /* [151936, 1024] */
658 size_t logits; /* [1, 151936] */
660
662 .final_ln_weight = 0xD2FBE080,
663 .final_output = 0xD2FBE300,
664 .lm_head_weight = 0x00000080, /* TIED to token_emb */
665 .logits = 0xD2FBF340,
666};
667
668/* ============================================================================
669 * GLOBAL OFFSETS
670 * ============================================================================ */
671
672typedef struct {
673 size_t rope_cos_cache; /* [131072, 32] */
674 size_t rope_sin_cache; /* [131072, 32] */
676
678 .rope_cos_cache = 0xD30539C0,
679 .rope_sin_cache = 0xD4053A00,
680};
681
682/* ============================================================================
683 * CANARY OFFSETS
684 * ============================================================================ */
685
686typedef struct {
687 size_t offset;
688 const char *name;
690
692 {0x00000040, "header_start"},
693 {0x05376080, "token_emb_end"},
694 {0x0538AF00, "vocab_offsets_end"},
695 {0x0538AF40, "vocab_strings_end"},
696 {0x0538AF80, "vocab_merges_end"},
697 {0x0538BFC0, "embedded_input_end"},
698 {0x0538C000, "header_end"},
699 {0x0538C040, "layer_0_start"},
700 {0x0538C2C0, "layer.0.ln1_gamma_end"},
701 {0x0538D300, "layer.0.ln1_out_end"},
702 {0x0540B340, "layer.0.wq_end"},
703 {0x0540B5C0, "layer.0.bq_end"},
704 {0x0541D600, "layer.0.wk_end"},
705 {0x0541D700, "layer.0.bk_end"},
706 {0x0542F740, "layer.0.wv_end"},
707 {0x0542F840, "layer.0.bv_end"},
708 {0x05430680, "layer.0.q_end"},
709 {0x094306C0, "layer.0.k_end"},
710 {0x0D430700, "layer.0.v_end"},
711 {0x0D4AE740, "layer.0.wo_end"},
712 {0x0D4AF780, "layer.0.proj_tmp_end"},
713 {0x0D4B07C0, "layer.0.proj_scratch_end"},
714 {0x0D4B1800, "layer.0.residual1_end"},
715 {0x0D4B1A80, "layer.0.ln2_gamma_end"},
716 {0x0D4B2AC0, "layer.0.ln2_out_end"},
717 {0x0DA0AB00, "layer.0.w1_end"},
718 {0x0DCB6B40, "layer.0.w2_end"},
719 {0x0DCB7B80, "layer.0.mlp_out_end"},
720 {0x0DCB8BC0, "layer.0.output_end"},
721 {0x0DCB8C00, "layer_0_end"},
722 {0x0DCB8C40, "layer_1_start"},
723 {0x0DCB8EC0, "layer.1.ln1_gamma_end"},
724 {0x0DCB9F00, "layer.1.ln1_out_end"},
725 {0x0DD37F40, "layer.1.wq_end"},
726 {0x0DD381C0, "layer.1.bq_end"},
727 {0x0DD4A200, "layer.1.wk_end"},
728 {0x0DD4A300, "layer.1.bk_end"},
729 {0x0DD5C340, "layer.1.wv_end"},
730 {0x0DD5C440, "layer.1.bv_end"},
731 {0x0DD5D280, "layer.1.q_end"},
732 {0x11D5D2C0, "layer.1.k_end"},
733 {0x15D5D300, "layer.1.v_end"},
734 {0x15DDB340, "layer.1.wo_end"},
735 {0x15DDC380, "layer.1.proj_tmp_end"},
736 {0x15DDD3C0, "layer.1.proj_scratch_end"},
737 {0x15DDE400, "layer.1.residual1_end"},
738 {0x15DDE680, "layer.1.ln2_gamma_end"},
739 {0x15DDF6C0, "layer.1.ln2_out_end"},
740 {0x16337700, "layer.1.w1_end"},
741 {0x165E3740, "layer.1.w2_end"},
742 {0x165E4780, "layer.1.mlp_out_end"},
743 {0x165E57C0, "layer.1.output_end"},
744 {0x165E5800, "layer_1_end"},
745 {0x165E5840, "layer_2_start"},
746 {0x165E5AC0, "layer.2.ln1_gamma_end"},
747 {0x165E6B00, "layer.2.ln1_out_end"},
748 {0x16664B40, "layer.2.wq_end"},
749 {0x16664DC0, "layer.2.bq_end"},
750 {0x16676E00, "layer.2.wk_end"},
751 {0x16676F00, "layer.2.bk_end"},
752 {0x16688F40, "layer.2.wv_end"},
753 {0x16689040, "layer.2.bv_end"},
754 {0x16689E80, "layer.2.q_end"},
755 {0x1A689EC0, "layer.2.k_end"},
756 {0x1E689F00, "layer.2.v_end"},
757 {0x1E707F40, "layer.2.wo_end"},
758 {0x1E708F80, "layer.2.proj_tmp_end"},
759 {0x1E709FC0, "layer.2.proj_scratch_end"},
760 {0x1E70B000, "layer.2.residual1_end"},
761 {0x1E70B280, "layer.2.ln2_gamma_end"},
762 {0x1E70C2C0, "layer.2.ln2_out_end"},
763 {0x1EC64300, "layer.2.w1_end"},
764 {0x1EF10340, "layer.2.w2_end"},
765 {0x1EF11380, "layer.2.mlp_out_end"},
766 {0x1EF123C0, "layer.2.output_end"},
767 {0x1EF12400, "layer_2_end"},
768 {0x1EF12440, "layer_3_start"},
769 {0x1EF126C0, "layer.3.ln1_gamma_end"},
770 {0x1EF13700, "layer.3.ln1_out_end"},
771 {0x1EF91740, "layer.3.wq_end"},
772 {0x1EF919C0, "layer.3.bq_end"},
773 {0x1EFA3A00, "layer.3.wk_end"},
774 {0x1EFA3B00, "layer.3.bk_end"},
775 {0x1EFB5B40, "layer.3.wv_end"},
776 {0x1EFB5C40, "layer.3.bv_end"},
777 {0x1EFB6A80, "layer.3.q_end"},
778 {0x22FB6AC0, "layer.3.k_end"},
779 {0x26FB6B00, "layer.3.v_end"},
780 {0x27034B40, "layer.3.wo_end"},
781 {0x27035B80, "layer.3.proj_tmp_end"},
782 {0x27036BC0, "layer.3.proj_scratch_end"},
783 {0x27037C00, "layer.3.residual1_end"},
784 {0x27037E80, "layer.3.ln2_gamma_end"},
785 {0x27038EC0, "layer.3.ln2_out_end"},
786 {0x27590F00, "layer.3.w1_end"},
787 {0x2783CF40, "layer.3.w2_end"},
788 {0x2783DF80, "layer.3.mlp_out_end"},
789 {0x2783EFC0, "layer.3.output_end"},
790 {0x2783F000, "layer_3_end"},
791 {0x2783F040, "layer_4_start"},
792 {0x2783F2C0, "layer.4.ln1_gamma_end"},
793 {0x27840300, "layer.4.ln1_out_end"},
794 {0x278BE340, "layer.4.wq_end"},
795 {0x278BE5C0, "layer.4.bq_end"},
796 {0x278D0600, "layer.4.wk_end"},
797 {0x278D0700, "layer.4.bk_end"},
798 {0x278E2740, "layer.4.wv_end"},
799 {0x278E2840, "layer.4.bv_end"},
800 {0x278E3680, "layer.4.q_end"},
801 {0x2B8E36C0, "layer.4.k_end"},
802 {0x2F8E3700, "layer.4.v_end"},
803 {0x2F961740, "layer.4.wo_end"},
804 {0x2F962780, "layer.4.proj_tmp_end"},
805 {0x2F9637C0, "layer.4.proj_scratch_end"},
806 {0x2F964800, "layer.4.residual1_end"},
807 {0x2F964A80, "layer.4.ln2_gamma_end"},
808 {0x2F965AC0, "layer.4.ln2_out_end"},
809 {0x2FEBDB00, "layer.4.w1_end"},
810 {0x30169B40, "layer.4.w2_end"},
811 {0x3016AB80, "layer.4.mlp_out_end"},
812 {0x3016BBC0, "layer.4.output_end"},
813 {0x3016BC00, "layer_4_end"},
814 {0x3016BC40, "layer_5_start"},
815 {0x3016BEC0, "layer.5.ln1_gamma_end"},
816 {0x3016CF00, "layer.5.ln1_out_end"},
817 {0x301EAF40, "layer.5.wq_end"},
818 {0x301EB1C0, "layer.5.bq_end"},
819 {0x301FD200, "layer.5.wk_end"},
820 {0x301FD300, "layer.5.bk_end"},
821 {0x3020F340, "layer.5.wv_end"},
822 {0x3020F440, "layer.5.bv_end"},
823 {0x30210280, "layer.5.q_end"},
824 {0x342102C0, "layer.5.k_end"},
825 {0x38210300, "layer.5.v_end"},
826 {0x3828E340, "layer.5.wo_end"},
827 {0x3828F380, "layer.5.proj_tmp_end"},
828 {0x382903C0, "layer.5.proj_scratch_end"},
829 {0x38291400, "layer.5.residual1_end"},
830 {0x38291680, "layer.5.ln2_gamma_end"},
831 {0x382926C0, "layer.5.ln2_out_end"},
832 {0x387EA700, "layer.5.w1_end"},
833 {0x38A96740, "layer.5.w2_end"},
834 {0x38A97780, "layer.5.mlp_out_end"},
835 {0x38A987C0, "layer.5.output_end"},
836 {0x38A98800, "layer_5_end"},
837 {0x38A98840, "layer_6_start"},
838 {0x38A98AC0, "layer.6.ln1_gamma_end"},
839 {0x38A99B00, "layer.6.ln1_out_end"},
840 {0x38B17B40, "layer.6.wq_end"},
841 {0x38B17DC0, "layer.6.bq_end"},
842 {0x38B29E00, "layer.6.wk_end"},
843 {0x38B29F00, "layer.6.bk_end"},
844 {0x38B3BF40, "layer.6.wv_end"},
845 {0x38B3C040, "layer.6.bv_end"},
846 {0x38B3CE80, "layer.6.q_end"},
847 {0x3CB3CEC0, "layer.6.k_end"},
848 {0x40B3CF00, "layer.6.v_end"},
849 {0x40BBAF40, "layer.6.wo_end"},
850 {0x40BBBF80, "layer.6.proj_tmp_end"},
851 {0x40BBCFC0, "layer.6.proj_scratch_end"},
852 {0x40BBE000, "layer.6.residual1_end"},
853 {0x40BBE280, "layer.6.ln2_gamma_end"},
854 {0x40BBF2C0, "layer.6.ln2_out_end"},
855 {0x41117300, "layer.6.w1_end"},
856 {0x413C3340, "layer.6.w2_end"},
857 {0x413C4380, "layer.6.mlp_out_end"},
858 {0x413C53C0, "layer.6.output_end"},
859 {0x413C5400, "layer_6_end"},
860 {0x413C5440, "layer_7_start"},
861 {0x413C56C0, "layer.7.ln1_gamma_end"},
862 {0x413C6700, "layer.7.ln1_out_end"},
863 {0x41444740, "layer.7.wq_end"},
864 {0x414449C0, "layer.7.bq_end"},
865 {0x41456A00, "layer.7.wk_end"},
866 {0x41456B00, "layer.7.bk_end"},
867 {0x41468B40, "layer.7.wv_end"},
868 {0x41468C40, "layer.7.bv_end"},
869 {0x41469A80, "layer.7.q_end"},
870 {0x45469AC0, "layer.7.k_end"},
871 {0x49469B00, "layer.7.v_end"},
872 {0x494E7B40, "layer.7.wo_end"},
873 {0x494E8B80, "layer.7.proj_tmp_end"},
874 {0x494E9BC0, "layer.7.proj_scratch_end"},
875 {0x494EAC00, "layer.7.residual1_end"},
876 {0x494EAE80, "layer.7.ln2_gamma_end"},
877 {0x494EBEC0, "layer.7.ln2_out_end"},
878 {0x49A43F00, "layer.7.w1_end"},
879 {0x49CEFF40, "layer.7.w2_end"},
880 {0x49CF0F80, "layer.7.mlp_out_end"},
881 {0x49CF1FC0, "layer.7.output_end"},
882 {0x49CF2000, "layer_7_end"},
883 {0x49CF2040, "layer_8_start"},
884 {0x49CF22C0, "layer.8.ln1_gamma_end"},
885 {0x49CF3300, "layer.8.ln1_out_end"},
886 {0x49D71340, "layer.8.wq_end"},
887 {0x49D715C0, "layer.8.bq_end"},
888 {0x49D83600, "layer.8.wk_end"},
889 {0x49D83700, "layer.8.bk_end"},
890 {0x49D95740, "layer.8.wv_end"},
891 {0x49D95840, "layer.8.bv_end"},
892 {0x49D96680, "layer.8.q_end"},
893 {0x4DD966C0, "layer.8.k_end"},
894 {0x51D96700, "layer.8.v_end"},
895 {0x51E14740, "layer.8.wo_end"},
896 {0x51E15780, "layer.8.proj_tmp_end"},
897 {0x51E167C0, "layer.8.proj_scratch_end"},
898 {0x51E17800, "layer.8.residual1_end"},
899 {0x51E17A80, "layer.8.ln2_gamma_end"},
900 {0x51E18AC0, "layer.8.ln2_out_end"},
901 {0x52370B00, "layer.8.w1_end"},
902 {0x5261CB40, "layer.8.w2_end"},
903 {0x5261DB80, "layer.8.mlp_out_end"},
904 {0x5261EBC0, "layer.8.output_end"},
905 {0x5261EC00, "layer_8_end"},
906 {0x5261EC40, "layer_9_start"},
907 {0x5261EEC0, "layer.9.ln1_gamma_end"},
908 {0x5261FF00, "layer.9.ln1_out_end"},
909 {0x5269DF40, "layer.9.wq_end"},
910 {0x5269E1C0, "layer.9.bq_end"},
911 {0x526B0200, "layer.9.wk_end"},
912 {0x526B0300, "layer.9.bk_end"},
913 {0x526C2340, "layer.9.wv_end"},
914 {0x526C2440, "layer.9.bv_end"},
915 {0x526C3280, "layer.9.q_end"},
916 {0x566C32C0, "layer.9.k_end"},
917 {0x5A6C3300, "layer.9.v_end"},
918 {0x5A741340, "layer.9.wo_end"},
919 {0x5A742380, "layer.9.proj_tmp_end"},
920 {0x5A7433C0, "layer.9.proj_scratch_end"},
921 {0x5A744400, "layer.9.residual1_end"},
922 {0x5A744680, "layer.9.ln2_gamma_end"},
923 {0x5A7456C0, "layer.9.ln2_out_end"},
924 {0x5AC9D700, "layer.9.w1_end"},
925 {0x5AF49740, "layer.9.w2_end"},
926 {0x5AF4A780, "layer.9.mlp_out_end"},
927 {0x5AF4B7C0, "layer.9.output_end"},
928 {0x5AF4B800, "layer_9_end"},
929 {0x5AF4B840, "layer_10_start"},
930 {0x5AF4BAC0, "layer.10.ln1_gamma_end"},
931 {0x5AF4CB00, "layer.10.ln1_out_end"},
932 {0x5AFCAB40, "layer.10.wq_end"},
933 {0x5AFCADC0, "layer.10.bq_end"},
934 {0x5AFDCE00, "layer.10.wk_end"},
935 {0x5AFDCF00, "layer.10.bk_end"},
936 {0x5AFEEF40, "layer.10.wv_end"},
937 {0x5AFEF040, "layer.10.bv_end"},
938 {0x5AFEFE80, "layer.10.q_end"},
939 {0x5EFEFEC0, "layer.10.k_end"},
940 {0x62FEFF00, "layer.10.v_end"},
941 {0x6306DF40, "layer.10.wo_end"},
942 {0x6306EF80, "layer.10.proj_tmp_end"},
943 {0x6306FFC0, "layer.10.proj_scratch_end"},
944 {0x63071000, "layer.10.residual1_end"},
945 {0x63071280, "layer.10.ln2_gamma_end"},
946 {0x630722C0, "layer.10.ln2_out_end"},
947 {0x635CA300, "layer.10.w1_end"},
948 {0x63876340, "layer.10.w2_end"},
949 {0x63877380, "layer.10.mlp_out_end"},
950 {0x638783C0, "layer.10.output_end"},
951 {0x63878400, "layer_10_end"},
952 {0x63878440, "layer_11_start"},
953 {0x638786C0, "layer.11.ln1_gamma_end"},
954 {0x63879700, "layer.11.ln1_out_end"},
955 {0x638F7740, "layer.11.wq_end"},
956 {0x638F79C0, "layer.11.bq_end"},
957 {0x63909A00, "layer.11.wk_end"},
958 {0x63909B00, "layer.11.bk_end"},
959 {0x6391BB40, "layer.11.wv_end"},
960 {0x6391BC40, "layer.11.bv_end"},
961 {0x6391CA80, "layer.11.q_end"},
962 {0x6791CAC0, "layer.11.k_end"},
963 {0x6B91CB00, "layer.11.v_end"},
964 {0x6B99AB40, "layer.11.wo_end"},
965 {0x6B99BB80, "layer.11.proj_tmp_end"},
966 {0x6B99CBC0, "layer.11.proj_scratch_end"},
967 {0x6B99DC00, "layer.11.residual1_end"},
968 {0x6B99DE80, "layer.11.ln2_gamma_end"},
969 {0x6B99EEC0, "layer.11.ln2_out_end"},
970 {0x6BEF6F00, "layer.11.w1_end"},
971 {0x6C1A2F40, "layer.11.w2_end"},
972 {0x6C1A3F80, "layer.11.mlp_out_end"},
973 {0x6C1A4FC0, "layer.11.output_end"},
974 {0x6C1A5000, "layer_11_end"},
975 {0x6C1A5040, "layer_12_start"},
976 {0x6C1A52C0, "layer.12.ln1_gamma_end"},
977 {0x6C1A6300, "layer.12.ln1_out_end"},
978 {0x6C224340, "layer.12.wq_end"},
979 {0x6C2245C0, "layer.12.bq_end"},
980 {0x6C236600, "layer.12.wk_end"},
981 {0x6C236700, "layer.12.bk_end"},
982 {0x6C248740, "layer.12.wv_end"},
983 {0x6C248840, "layer.12.bv_end"},
984 {0x6C249680, "layer.12.q_end"},
985 {0x702496C0, "layer.12.k_end"},
986 {0x74249700, "layer.12.v_end"},
987 {0x742C7740, "layer.12.wo_end"},
988 {0x742C8780, "layer.12.proj_tmp_end"},
989 {0x742C97C0, "layer.12.proj_scratch_end"},
990 {0x742CA800, "layer.12.residual1_end"},
991 {0x742CAA80, "layer.12.ln2_gamma_end"},
992 {0x742CBAC0, "layer.12.ln2_out_end"},
993 {0x74823B00, "layer.12.w1_end"},
994 {0x74ACFB40, "layer.12.w2_end"},
995 {0x74AD0B80, "layer.12.mlp_out_end"},
996 {0x74AD1BC0, "layer.12.output_end"},
997 {0x74AD1C00, "layer_12_end"},
998 {0x74AD1C40, "layer_13_start"},
999 {0x74AD1EC0, "layer.13.ln1_gamma_end"},
1000 {0x74AD2F00, "layer.13.ln1_out_end"},
1001 {0x74B50F40, "layer.13.wq_end"},
1002 {0x74B511C0, "layer.13.bq_end"},
1003 {0x74B63200, "layer.13.wk_end"},
1004 {0x74B63300, "layer.13.bk_end"},
1005 {0x74B75340, "layer.13.wv_end"},
1006 {0x74B75440, "layer.13.bv_end"},
1007 {0x74B76280, "layer.13.q_end"},
1008 {0x78B762C0, "layer.13.k_end"},
1009 {0x7CB76300, "layer.13.v_end"},
1010 {0x7CBF4340, "layer.13.wo_end"},
1011 {0x7CBF5380, "layer.13.proj_tmp_end"},
1012 {0x7CBF63C0, "layer.13.proj_scratch_end"},
1013 {0x7CBF7400, "layer.13.residual1_end"},
1014 {0x7CBF7680, "layer.13.ln2_gamma_end"},
1015 {0x7CBF86C0, "layer.13.ln2_out_end"},
1016 {0x7D150700, "layer.13.w1_end"},
1017 {0x7D3FC740, "layer.13.w2_end"},
1018 {0x7D3FD780, "layer.13.mlp_out_end"},
1019 {0x7D3FE7C0, "layer.13.output_end"},
1020 {0x7D3FE800, "layer_13_end"},
1021 {0x7D3FE840, "layer_14_start"},
1022 {0x7D3FEAC0, "layer.14.ln1_gamma_end"},
1023 {0x7D3FFB00, "layer.14.ln1_out_end"},
1024 {0x7D47DB40, "layer.14.wq_end"},
1025 {0x7D47DDC0, "layer.14.bq_end"},
1026 {0x7D48FE00, "layer.14.wk_end"},
1027 {0x7D48FF00, "layer.14.bk_end"},
1028 {0x7D4A1F40, "layer.14.wv_end"},
1029 {0x7D4A2040, "layer.14.bv_end"},
1030 {0x7D4A2E80, "layer.14.q_end"},
1031 {0x814A2EC0, "layer.14.k_end"},
1032 {0x854A2F00, "layer.14.v_end"},
1033 {0x85520F40, "layer.14.wo_end"},
1034 {0x85521F80, "layer.14.proj_tmp_end"},
1035 {0x85522FC0, "layer.14.proj_scratch_end"},
1036 {0x85524000, "layer.14.residual1_end"},
1037 {0x85524280, "layer.14.ln2_gamma_end"},
1038 {0x855252C0, "layer.14.ln2_out_end"},
1039 {0x85A7D300, "layer.14.w1_end"},
1040 {0x85D29340, "layer.14.w2_end"},
1041 {0x85D2A380, "layer.14.mlp_out_end"},
1042 {0x85D2B3C0, "layer.14.output_end"},
1043 {0x85D2B400, "layer_14_end"},
1044 {0x85D2B440, "layer_15_start"},
1045 {0x85D2B6C0, "layer.15.ln1_gamma_end"},
1046 {0x85D2C700, "layer.15.ln1_out_end"},
1047 {0x85DAA740, "layer.15.wq_end"},
1048 {0x85DAA9C0, "layer.15.bq_end"},
1049 {0x85DBCA00, "layer.15.wk_end"},
1050 {0x85DBCB00, "layer.15.bk_end"},
1051 {0x85DCEB40, "layer.15.wv_end"},
1052 {0x85DCEC40, "layer.15.bv_end"},
1053 {0x85DCFA80, "layer.15.q_end"},
1054 {0x89DCFAC0, "layer.15.k_end"},
1055 {0x8DDCFB00, "layer.15.v_end"},
1056 {0x8DE4DB40, "layer.15.wo_end"},
1057 {0x8DE4EB80, "layer.15.proj_tmp_end"},
1058 {0x8DE4FBC0, "layer.15.proj_scratch_end"},
1059 {0x8DE50C00, "layer.15.residual1_end"},
1060 {0x8DE50E80, "layer.15.ln2_gamma_end"},
1061 {0x8DE51EC0, "layer.15.ln2_out_end"},
1062 {0x8E3A9F00, "layer.15.w1_end"},
1063 {0x8E655F40, "layer.15.w2_end"},
1064 {0x8E656F80, "layer.15.mlp_out_end"},
1065 {0x8E657FC0, "layer.15.output_end"},
1066 {0x8E658000, "layer_15_end"},
1067 {0x8E658040, "layer_16_start"},
1068 {0x8E6582C0, "layer.16.ln1_gamma_end"},
1069 {0x8E659300, "layer.16.ln1_out_end"},
1070 {0x8E6D7340, "layer.16.wq_end"},
1071 {0x8E6D75C0, "layer.16.bq_end"},
1072 {0x8E6E9600, "layer.16.wk_end"},
1073 {0x8E6E9700, "layer.16.bk_end"},
1074 {0x8E6FB740, "layer.16.wv_end"},
1075 {0x8E6FB840, "layer.16.bv_end"},
1076 {0x8E6FC680, "layer.16.q_end"},
1077 {0x926FC6C0, "layer.16.k_end"},
1078 {0x966FC700, "layer.16.v_end"},
1079 {0x9677A740, "layer.16.wo_end"},
1080 {0x9677B780, "layer.16.proj_tmp_end"},
1081 {0x9677C7C0, "layer.16.proj_scratch_end"},
1082 {0x9677D800, "layer.16.residual1_end"},
1083 {0x9677DA80, "layer.16.ln2_gamma_end"},
1084 {0x9677EAC0, "layer.16.ln2_out_end"},
1085 {0x96CD6B00, "layer.16.w1_end"},
1086 {0x96F82B40, "layer.16.w2_end"},
1087 {0x96F83B80, "layer.16.mlp_out_end"},
1088 {0x96F84BC0, "layer.16.output_end"},
1089 {0x96F84C00, "layer_16_end"},
1090 {0x96F84C40, "layer_17_start"},
1091 {0x96F84EC0, "layer.17.ln1_gamma_end"},
1092 {0x96F85F00, "layer.17.ln1_out_end"},
1093 {0x97003F40, "layer.17.wq_end"},
1094 {0x970041C0, "layer.17.bq_end"},
1095 {0x97016200, "layer.17.wk_end"},
1096 {0x97016300, "layer.17.bk_end"},
1097 {0x97028340, "layer.17.wv_end"},
1098 {0x97028440, "layer.17.bv_end"},
1099 {0x97029280, "layer.17.q_end"},
1100 {0x9B0292C0, "layer.17.k_end"},
1101 {0x9F029300, "layer.17.v_end"},
1102 {0x9F0A7340, "layer.17.wo_end"},
1103 {0x9F0A8380, "layer.17.proj_tmp_end"},
1104 {0x9F0A93C0, "layer.17.proj_scratch_end"},
1105 {0x9F0AA400, "layer.17.residual1_end"},
1106 {0x9F0AA680, "layer.17.ln2_gamma_end"},
1107 {0x9F0AB6C0, "layer.17.ln2_out_end"},
1108 {0x9F603700, "layer.17.w1_end"},
1109 {0x9F8AF740, "layer.17.w2_end"},
1110 {0x9F8B0780, "layer.17.mlp_out_end"},
1111 {0x9F8B17C0, "layer.17.output_end"},
1112 {0x9F8B1800, "layer_17_end"},
1113 {0x9F8B1840, "layer_18_start"},
1114 {0x9F8B1AC0, "layer.18.ln1_gamma_end"},
1115 {0x9F8B2B00, "layer.18.ln1_out_end"},
1116 {0x9F930B40, "layer.18.wq_end"},
1117 {0x9F930DC0, "layer.18.bq_end"},
1118 {0x9F942E00, "layer.18.wk_end"},
1119 {0x9F942F00, "layer.18.bk_end"},
1120 {0x9F954F40, "layer.18.wv_end"},
1121 {0x9F955040, "layer.18.bv_end"},
1122 {0x9F955E80, "layer.18.q_end"},
1123 {0xA3955EC0, "layer.18.k_end"},
1124 {0xA7955F00, "layer.18.v_end"},
1125 {0xA79D3F40, "layer.18.wo_end"},
1126 {0xA79D4F80, "layer.18.proj_tmp_end"},
1127 {0xA79D5FC0, "layer.18.proj_scratch_end"},
1128 {0xA79D7000, "layer.18.residual1_end"},
1129 {0xA79D7280, "layer.18.ln2_gamma_end"},
1130 {0xA79D82C0, "layer.18.ln2_out_end"},
1131 {0xA7F30300, "layer.18.w1_end"},
1132 {0xA81DC340, "layer.18.w2_end"},
1133 {0xA81DD380, "layer.18.mlp_out_end"},
1134 {0xA81DE3C0, "layer.18.output_end"},
1135 {0xA81DE400, "layer_18_end"},
1136 {0xA81DE440, "layer_19_start"},
1137 {0xA81DE6C0, "layer.19.ln1_gamma_end"},
1138 {0xA81DF700, "layer.19.ln1_out_end"},
1139 {0xA825D740, "layer.19.wq_end"},
1140 {0xA825D9C0, "layer.19.bq_end"},
1141 {0xA826FA00, "layer.19.wk_end"},
1142 {0xA826FB00, "layer.19.bk_end"},
1143 {0xA8281B40, "layer.19.wv_end"},
1144 {0xA8281C40, "layer.19.bv_end"},
1145 {0xA8282A80, "layer.19.q_end"},
1146 {0xAC282AC0, "layer.19.k_end"},
1147 {0xB0282B00, "layer.19.v_end"},
1148 {0xB0300B40, "layer.19.wo_end"},
1149 {0xB0301B80, "layer.19.proj_tmp_end"},
1150 {0xB0302BC0, "layer.19.proj_scratch_end"},
1151 {0xB0303C00, "layer.19.residual1_end"},
1152 {0xB0303E80, "layer.19.ln2_gamma_end"},
1153 {0xB0304EC0, "layer.19.ln2_out_end"},
1154 {0xB085CF00, "layer.19.w1_end"},
1155 {0xB0B08F40, "layer.19.w2_end"},
1156 {0xB0B09F80, "layer.19.mlp_out_end"},
1157 {0xB0B0AFC0, "layer.19.output_end"},
1158 {0xB0B0B000, "layer_19_end"},
1159 {0xB0B0B040, "layer_20_start"},
1160 {0xB0B0B2C0, "layer.20.ln1_gamma_end"},
1161 {0xB0B0C300, "layer.20.ln1_out_end"},
1162 {0xB0B8A340, "layer.20.wq_end"},
1163 {0xB0B8A5C0, "layer.20.bq_end"},
1164 {0xB0B9C600, "layer.20.wk_end"},
1165 {0xB0B9C700, "layer.20.bk_end"},
1166 {0xB0BAE740, "layer.20.wv_end"},
1167 {0xB0BAE840, "layer.20.bv_end"},
1168 {0xB0BAF680, "layer.20.q_end"},
1169 {0xB4BAF6C0, "layer.20.k_end"},
1170 {0xB8BAF700, "layer.20.v_end"},
1171 {0xB8C2D740, "layer.20.wo_end"},
1172 {0xB8C2E780, "layer.20.proj_tmp_end"},
1173 {0xB8C2F7C0, "layer.20.proj_scratch_end"},
1174 {0xB8C30800, "layer.20.residual1_end"},
1175 {0xB8C30A80, "layer.20.ln2_gamma_end"},
1176 {0xB8C31AC0, "layer.20.ln2_out_end"},
1177 {0xB9189B00, "layer.20.w1_end"},
1178 {0xB9435B40, "layer.20.w2_end"},
1179 {0xB9436B80, "layer.20.mlp_out_end"},
1180 {0xB9437BC0, "layer.20.output_end"},
1181 {0xB9437C00, "layer_20_end"},
1182 {0xB9437C40, "layer_21_start"},
1183 {0xB9437EC0, "layer.21.ln1_gamma_end"},
1184 {0xB9438F00, "layer.21.ln1_out_end"},
1185 {0xB94B6F40, "layer.21.wq_end"},
1186 {0xB94B71C0, "layer.21.bq_end"},
1187 {0xB94C9200, "layer.21.wk_end"},
1188 {0xB94C9300, "layer.21.bk_end"},
1189 {0xB94DB340, "layer.21.wv_end"},
1190 {0xB94DB440, "layer.21.bv_end"},
1191 {0xB94DC280, "layer.21.q_end"},
1192 {0xBD4DC2C0, "layer.21.k_end"},
1193 {0xC14DC300, "layer.21.v_end"},
1194 {0xC155A340, "layer.21.wo_end"},
1195 {0xC155B380, "layer.21.proj_tmp_end"},
1196 {0xC155C3C0, "layer.21.proj_scratch_end"},
1197 {0xC155D400, "layer.21.residual1_end"},
1198 {0xC155D680, "layer.21.ln2_gamma_end"},
1199 {0xC155E6C0, "layer.21.ln2_out_end"},
1200 {0xC1AB6700, "layer.21.w1_end"},
1201 {0xC1D62740, "layer.21.w2_end"},
1202 {0xC1D63780, "layer.21.mlp_out_end"},
1203 {0xC1D647C0, "layer.21.output_end"},
1204 {0xC1D64800, "layer_21_end"},
1205 {0xC1D64840, "layer_22_start"},
1206 {0xC1D64AC0, "layer.22.ln1_gamma_end"},
1207 {0xC1D65B00, "layer.22.ln1_out_end"},
1208 {0xC1DE3B40, "layer.22.wq_end"},
1209 {0xC1DE3DC0, "layer.22.bq_end"},
1210 {0xC1DF5E00, "layer.22.wk_end"},
1211 {0xC1DF5F00, "layer.22.bk_end"},
1212 {0xC1E07F40, "layer.22.wv_end"},
1213 {0xC1E08040, "layer.22.bv_end"},
1214 {0xC1E08E80, "layer.22.q_end"},
1215 {0xC5E08EC0, "layer.22.k_end"},
1216 {0xC9E08F00, "layer.22.v_end"},
1217 {0xC9E86F40, "layer.22.wo_end"},
1218 {0xC9E87F80, "layer.22.proj_tmp_end"},
1219 {0xC9E88FC0, "layer.22.proj_scratch_end"},
1220 {0xC9E8A000, "layer.22.residual1_end"},
1221 {0xC9E8A280, "layer.22.ln2_gamma_end"},
1222 {0xC9E8B2C0, "layer.22.ln2_out_end"},
1223 {0xCA3E3300, "layer.22.w1_end"},
1224 {0xCA68F340, "layer.22.w2_end"},
1225 {0xCA690380, "layer.22.mlp_out_end"},
1226 {0xCA6913C0, "layer.22.output_end"},
1227 {0xCA691400, "layer_22_end"},
1228 {0xCA691440, "layer_23_start"},
1229 {0xCA6916C0, "layer.23.ln1_gamma_end"},
1230 {0xCA692700, "layer.23.ln1_out_end"},
1231 {0xCA710740, "layer.23.wq_end"},
1232 {0xCA7109C0, "layer.23.bq_end"},
1233 {0xCA722A00, "layer.23.wk_end"},
1234 {0xCA722B00, "layer.23.bk_end"},
1235 {0xCA734B40, "layer.23.wv_end"},
1236 {0xCA734C40, "layer.23.bv_end"},
1237 {0xCA735A80, "layer.23.q_end"},
1238 {0xCE735AC0, "layer.23.k_end"},
1239 {0xD2735B00, "layer.23.v_end"},
1240 {0xD27B3B40, "layer.23.wo_end"},
1241 {0xD27B4B80, "layer.23.proj_tmp_end"},
1242 {0xD27B5BC0, "layer.23.proj_scratch_end"},
1243 {0xD27B6C00, "layer.23.residual1_end"},
1244 {0xD27B6E80, "layer.23.ln2_gamma_end"},
1245 {0xD27B7EC0, "layer.23.ln2_out_end"},
1246 {0xD2D0FF00, "layer.23.w1_end"},
1247 {0xD2FBBF40, "layer.23.w2_end"},
1248 {0xD2FBCF80, "layer.23.mlp_out_end"},
1249 {0xD2FBDFC0, "layer.23.output_end"},
1250 {0xD2FBE000, "layer_23_end"},
1251 {0xD2FBE040, "footer_start"},
1252 {0xD2FBE2C0, "final_ln_weight_end"},
1253 {0xD2FBF300, "final_output_end"},
1254 {0xD3053940, "logits_end"},
1255 {0xD3053980, "footer_end"},
1256 {0xD40539C0, "rope_cos_cache_end"},
1257 {0xD5053A00, "rope_sin_cache_end"},
1258};
1259#define QWEN2_0_5B_DECODE_CANARY_COUNT 566
1260
1261/* ============================================================================
1262 * MODEL STRUCT
1263 * ============================================================================ */
1264
1265typedef struct {
1266 void *base;
1269
1270/* ============================================================================
1271 * ACCESSOR MACROS
1272 * ============================================================================ */
1273
1274#define QWEN2_0_5B_DECODE_PTR(model, offset) \
1275 ((float*)((char*)(model)->base + (offset)))
1276
1277#define QWEN2_0_5B_DECODE_PTR_BF16(model, offset) \
1278 ((uint16_t*)((char*)(model)->base + (offset)))
1279
1280#define QWEN2_0_5B_DECODE_LAYER(layer_id) \
1281 (&QWEN2_0_5B_DECODE_LAYERS[layer_id])
1282
1283/* ============================================================================
1284 * API
1285 * ============================================================================ */
1286
1290void qwen2_0_5b_decode_forward(QWEN2_0_5B_DECODEModel *model, const int *tokens, int num_tokens);
1291void qwen2_0_5b_decode_decode(QWEN2_0_5B_DECODEModel *model, const int *token, int token_index);
1292
1293#ifdef __cplusplus
1294}
1295#endif
1296
1297#endif /* GENERATED_QWEN2_0_5B_DECODE_H */
const char * token
Definition tokenizer.h:307
int qwen2_0_5b_decode_verify_canaries(QWEN2_0_5B_DECODEModel *model)
static const QWEN2_0_5B_DECODEFooterOffsets QWEN2_0_5B_DECODE_FOOTER
int qwen2_0_5b_decode_model_allocate(QWEN2_0_5B_DECODEModel *model)
static const QWEN2_0_5B_DECODELayerOffsets QWEN2_0_5B_DECODE_LAYERS[24]
void qwen2_0_5b_decode_decode(QWEN2_0_5B_DECODEModel *model, const int *token, int token_index)
static const QWEN2_0_5B_DECODEGlobalOffsets QWEN2_0_5B_DECODE_GLOBALS
void qwen2_0_5b_decode_forward(QWEN2_0_5B_DECODEModel *model, const int *tokens, int num_tokens)
void qwen2_0_5b_decode_model_free(QWEN2_0_5B_DECODEModel *model)
static const QWEN2_0_5B_DECODEHeaderOffsets QWEN2_0_5B_DECODE_HEADER
static const QWEN2_0_5B_DECODECanary QWEN2_0_5B_DECODE_CANARIES[]