← Back to C-Kernel-Engine Docs Doxygen Source Documentation
ckernel_registry.h File Reference
#include "ckernel_ir.h"

Go to the source code of this file.

Functions

int ck_ir_validate_supported (const CKIRGraph *graph)
 
int ck_op_supported (CKOpType op)
 

Function Documentation

◆ ck_ir_validate_supported()

int ck_ir_validate_supported ( const CKIRGraph graph)

Definition at line 42 of file ckernel_registry.c.

43 {
44  if (!graph || !graph->nodes || graph->num_nodes <= 0) {
45  return -1;
46  }
47 
48  for (int i = 0; i < graph->num_nodes; ++i) {
49  CKOpType op = graph->nodes[i].op;
50  if (!ck_op_supported(op)) {
51  fprintf(stderr,
52  "Unsupported op in IR: %s (layer=%u node=%u)\n",
53  ck_op_name(op),
54  (unsigned)graph->nodes[i].id.layer,
55  (unsigned)graph->nodes[i].id.node);
56  return -1;
57  }
58  }
59  return 0;
60 }
CKOpType
Definition: ckernel_ir.h:35
int ck_op_supported(CKOpType op)
static const char * ck_op_name(CKOpType op)
CKIRNode * nodes
Definition: ckernel_ir.h:75
int num_nodes
Definition: ckernel_ir.h:74
CKOpType op
Definition: ckernel_ir.h:65
CKKernelId id
Definition: ckernel_ir.h:64
uint16_t node
Definition: ckernel_ir.h:55
uint16_t layer
Definition: ckernel_ir.h:54

References ck_op_name(), ck_op_supported(), CKIRNode::id, CKKernelId::layer, CKKernelId::node, CKIRGraph::nodes, CKIRGraph::num_nodes, and CKIRNode::op.

Referenced by ck_codegen_emit_runtime().

◆ ck_op_supported()

int ck_op_supported ( CKOpType  op)

Definition at line 26 of file ckernel_registry.c.

27 {
28  switch (op) {
29  case CK_OP_RMSNORM:
30  case CK_OP_LINEAR_QKV:
31  case CK_OP_ATTENTION:
32  case CK_OP_ADD:
33  case CK_OP_LINEAR:
34  case CK_OP_SPLIT:
35  case CK_OP_SWIGLU:
36  return 1;
37  default:
38  return 0;
39  }
40 }
@ CK_OP_SWIGLU
Definition: ckernel_ir.h:42
@ CK_OP_ADD
Definition: ckernel_ir.h:39
@ CK_OP_SPLIT
Definition: ckernel_ir.h:41
@ CK_OP_LINEAR_QKV
Definition: ckernel_ir.h:37
@ CK_OP_LINEAR
Definition: ckernel_ir.h:40
@ CK_OP_RMSNORM
Definition: ckernel_ir.h:36
@ CK_OP_ATTENTION
Definition: ckernel_ir.h:38

References CK_OP_ADD, CK_OP_ATTENTION, CK_OP_LINEAR, CK_OP_LINEAR_QKV, CK_OP_RMSNORM, CK_OP_SPLIT, and CK_OP_SWIGLU.

Referenced by ck_ir_validate_supported().