29 const char *func_name,
31 const char *runtime_sym)
33 fprintf(out,
"void %s(void) {\n", func_name);
34 fprintf(out,
" /* %s schedule (no-op placeholders). */\n", label);
35 for (
int i = 0; i < graph->
num_nodes; ++i) {
38 " /* node %d: layer=%d op=%s kernel=%s dtype=%s */\n",
41 node->
op ? node->
op :
"none",
46 const char *buf_name =
"unknown";
51 " /* bind: %s -> %s */\n",
52 bind->
arg ? bind->
arg :
"arg",
55 fprintf(out,
" ck_v2_dispatch_node(%d);\n", i);
57 fprintf(out,
" (void)%s;\n", runtime_sym ? runtime_sym :
"ck_v2_runtime");
58 fprintf(out,
"}\n\n");
63 const char *prefill_runtime,
64 const char *decode_runtime,
65 const char *backward_runtime)
68 prefill_runtime ? prefill_runtime :
"ck_v2_prefill_runtime");
70 decode_runtime ? decode_runtime :
"ck_v2_decode_runtime");
72 backward_runtime ? backward_runtime :
"ck_v2_backward_runtime");
75 "void ck_v2_run_forward(void) {\n"
76 " ck_v2_run_prefill();\n"
static const char * ck_codegen_v2_dtype_name(CKDataType dtype)
void ck_codegen_v2_emit_schedule(FILE *out, const CKIRV2Graph *graph, const char *prefill_runtime, const char *decode_runtime, const char *backward_runtime)
static void emit_schedule_block(FILE *out, const CKIRV2Graph *graph, const char *func_name, const char *label, const char *runtime_sym)
CKDataType
Supported data types in C-Kernel-Engine.
CKIRV2Binding bindings[24]