8 "/* Auto-generated runtime from CKIRV2Graph.\n"
9 " * This v2 emitter currently writes the schedule and buffer layout\n"
10 " * stubs. Kernel wiring will be layered on as IR v2 grows.\n"
13 "#include <stddef.h>\n"
14 "#include <stdint.h>\n"
15 "#include <stdio.h>\n"
16 "#include <string.h>\n\n");
25 const char *suffix = tag ? tag :
"prefill";
26 fprintf(out,
"typedef struct {\n"
27 " size_t offset_bytes;\n"
28 " size_t size_bytes;\n"
30 "} CKV2BufferLayout;\n\n");
32 fprintf(out,
"static const CKV2BufferLayout ck_v2_%s_buffers[] = {\n", suffix);
36 " { %zu, %zu, %d }, /* %s */\n",
42 fprintf(out,
"};\n\n");
44 fprintf(out,
"static const size_t ck_v2_%s_total_bytes[] = {\n", suffix);
46 fprintf(out,
" %zu%s\n",
50 fprintf(out,
"};\n\n");
52 fprintf(out,
"typedef struct {\n"
53 " const CKV2BufferLayout *buffers;\n"
55 " const size_t *total_bytes;\n"
56 " size_t alignment_bytes;\n"
57 "} CKV2Runtime;\n\n");
59 fprintf(out,
"static const CKV2Runtime ck_v2_%s_runtime = {\n"
60 " ck_v2_%s_buffers,\n"
62 " ck_v2_%s_total_bytes,\n"
void ck_codegen_v2_emit_struct(FILE *out, const CKIRV2Graph *graph, const CKMemPlan *plan, const char *tag)
int ck_codegen_v2_emit_preamble(FILE *out)
#define CK_MEM_PLAN_DEFAULT_ALIGN
size_t total_bytes[CK_MEM_ARENA_COUNT]