#include "ckernel_ir_v2.h"#include "ckernel_kernel_specs.h"#include <stdlib.h>#include <string.h>#include <stdio.h>Go to the source code of this file.
Functions | |
| int | ck_ir_v2_apply_meta (const char *path, CKIRV2Graph *graph) |
| static int | ck_ir_v2_apply_weight_dtypes (const char *json, const char *end, CKIRV2Graph *graph) |
| int | ck_ir_v2_build_decoder (const CKModelConfig *cfg, CKIRV2Graph *graph) |
| int | ck_ir_v2_build_decoder_backward (const CKIRV2Graph *forward, CKIRV2Graph *backward) |
| static int | ck_ir_v2_copy_buffer_spec (const CKBufferSpec *spec, CKIRV2Buffer *out) |
| static void | ck_ir_v2_copy_shape (CKDimToken *dst, const CKDimToken *src) |
| static int | ck_ir_v2_find_buffer_index (const CKIRV2Graph *graph, const char *name) |
| static const CKKernelSpec * | ck_ir_v2_find_kernel_spec (const char *name) |
| static const char * | ck_ir_v2_find_key (const char *json, const char *key, const char *end) |
| static int | ck_ir_v2_parse_bool (const char *json, const char *key, const char *end, int *out) |
| static CKDataType | ck_ir_v2_parse_dtype (const char *s) |
| static int | ck_ir_v2_parse_string (const char *start, const char *end, char **out) |
| static const char * | ck_ir_v2_select_kernel (const CKKernelSpec *spec, CKDataType dtype, int backward) |
| static const char * | ck_ir_v2_skip_ws (const char *cur, const char *end) |
| static char * | ck_ir_v2_strdup (const char *s) |
| int ck_ir_v2_apply_meta | ( | const char * | path, |
| CKIRV2Graph * | graph | ||
| ) |
Definition at line 220 of file ckernel_ir_v2_builder.c.
References CKIRV2Buffer::alias_of, CKIRV2Graph::buffers, ck_ir_v2_apply_weight_dtypes(), ck_ir_v2_find_buffer_index(), ck_ir_v2_parse_bool(), ck_ir_v2_strdup(), end, CKIRV2Graph::fused_qkv, CKIRV2Graph::gated_mlp, CKIRV2Graph::has_pos_emb, and CKIRV2Graph::tie_word_embeddings.
Referenced by main().
|
static |
Definition at line 174 of file ckernel_ir_v2_builder.c.
References CKIRV2Graph::buffers, ck_ir_v2_find_buffer_index(), ck_ir_v2_find_key(), ck_ir_v2_parse_dtype(), ck_ir_v2_parse_string(), ck_ir_v2_skip_ws(), CKIRV2Buffer::dtype, end, and start.
Referenced by ck_ir_v2_apply_meta().
| int ck_ir_v2_build_decoder | ( | const CKModelConfig * | cfg, |
| CKIRV2Graph * | graph | ||
| ) |
Definition at line 285 of file ckernel_ir_v2_builder.c.
References CKIRV2Binding::arg, CKPlanBinding::arg, CKIRV2Node::bindings, CKPlanStepV2::bindings, CKIRV2Binding::buffer, CKPlanBinding::buffer, CKIRV2Graph::buffers, ck_decoder_buffer_count, ck_decoder_buffers, ck_decoder_forward_plan_v2, ck_decoder_forward_plan_v2_count, CK_DT_FP32, ck_ir_v2_copy_buffer_spec(), ck_ir_v2_find_buffer_index(), ck_ir_v2_find_kernel_spec(), ck_ir_v2_free(), CK_IR_V2_MAX_BINDINGS, ck_ir_v2_select_kernel(), ck_ir_v2_strdup(), CKIRV2Buffer::condition, CKIRV2Node::condition, CKPlanStepV2::condition, CKIRV2Graph::config, CKKernelSpec::default_dtype, CKIRV2Node::flags, CKIRV2Graph::fused_qkv, CKIRV2Graph::gated_mlp, CKIRV2Graph::has_pos_emb, CKIRV2Node::kernel, CKPlanStepV2::kernel, CKIRV2Node::kernel_dtype, CKIRV2Node::layer, CKIRV2Node::n_bindings, CKIRV2Node::n_inputs, CKIRV2Node::n_outputs, CKIRV2Buffer::name, CKIRV2Graph::nodes, CKPlanStepV2::num_bindings, CKIRV2Graph::num_buffers, CKModelConfig::num_layers, CKIRV2Graph::num_nodes, CKIRV2Node::op, and CKIRV2Graph::tie_word_embeddings.
Referenced by main().
| int ck_ir_v2_build_decoder_backward | ( | const CKIRV2Graph * | forward, |
| CKIRV2Graph * | backward | ||
| ) |
Definition at line 356 of file ckernel_ir_v2_builder.c.
References CKIRV2Buffer::alias_of, CKBufferSpec::alias_of, CKIRV2Binding::arg, CKPlanBinding::arg, CKIRV2Node::bindings, CKPlanStepV2::bindings, CKIRV2Binding::buffer, CKPlanBinding::buffer, CKIRV2Graph::buffers, ck_decoder_backward_plan_v2, ck_decoder_backward_plan_v2_count, CK_DT_FP32, ck_ir_v2_copy_buffer_spec(), ck_ir_v2_find_buffer_index(), ck_ir_v2_find_kernel_spec(), ck_ir_v2_free(), CK_IR_V2_MAX_BINDINGS, ck_ir_v2_select_kernel(), ck_ir_v2_strdup(), CKIRV2Buffer::condition, CKIRV2Node::condition, CKBufferSpec::condition, CKPlanStepV2::condition, CKIRV2Graph::config, CKKernelSpec::default_dtype, CKIRV2Buffer::dtype, CKBufferSpec::dtype, CKIRV2Node::flags, CKIRV2Node::kernel, CKPlanStepV2::kernel, CKIRV2Node::kernel_dtype, CKIRV2Node::layer, CKIRV2Node::n_bindings, CKIRV2Node::n_inputs, CKIRV2Node::n_outputs, CKIRV2Buffer::name, CKBufferSpec::name, CKIRV2Graph::nodes, CKPlanStepV2::num_bindings, CKIRV2Graph::num_buffers, CKModelConfig::num_layers, CKIRV2Graph::num_nodes, CKIRV2Node::op, CKIRV2Buffer::optional, CKBufferSpec::optional, CKIRV2Buffer::role, CKBufferSpec::role, CKIRV2Buffer::scope, CKBufferSpec::scope, CKIRV2Buffer::shape, and CKBufferSpec::shape.
Referenced by main().
|
static |
Definition at line 27 of file ckernel_ir_v2_builder.c.
References CKIRV2Buffer::alias_of, CKBufferSpec::alias_of, ck_ir_v2_copy_shape(), ck_ir_v2_strdup(), CKIRV2Buffer::condition, CKBufferSpec::condition, CKIRV2Buffer::dtype, CKBufferSpec::dtype, CKIRV2Buffer::name, CKBufferSpec::name, CKIRV2Buffer::optional, CKBufferSpec::optional, CKIRV2Buffer::role, CKBufferSpec::role, CKIRV2Buffer::scope, CKBufferSpec::scope, CKIRV2Buffer::shape, and CKBufferSpec::shape.
Referenced by ck_ir_v2_build_decoder(), and ck_ir_v2_build_decoder_backward().
|
static |
Definition at line 22 of file ckernel_ir_v2_builder.c.
References CK_IR_V2_MAX_DIMS.
Referenced by ck_ir_v2_copy_buffer_spec().
|
static |
Definition at line 44 of file ckernel_ir_v2_builder.c.
References CKIRV2Graph::buffers, CKIRV2Buffer::name, and CKIRV2Graph::num_buffers.
Referenced by ck_ir_v2_apply_meta(), ck_ir_v2_apply_weight_dtypes(), ck_ir_v2_build_decoder(), and ck_ir_v2_build_decoder_backward().
|
static |
Definition at line 57 of file ckernel_ir_v2_builder.c.
References ck_kernel_spec_count, and ck_kernel_specs.
Referenced by ck_ir_v2_build_decoder(), and ck_ir_v2_build_decoder_backward().
|
static |
Definition at line 91 of file ckernel_ir_v2_builder.c.
References end.
Referenced by ck_ir_v2_apply_weight_dtypes(), and ck_ir_v2_parse_bool().
|
static |
Definition at line 139 of file ckernel_ir_v2_builder.c.
References ck_ir_v2_find_key(), ck_ir_v2_skip_ws(), and end.
Referenced by ck_ir_v2_apply_meta().
|
static |
Definition at line 161 of file ckernel_ir_v2_builder.c.
References CK_DT_BF16, CK_DT_FP16, CK_DT_FP32, CK_DT_Q4_0, CK_DT_Q4_K, CK_DT_Q6_K, and CK_DT_Q8_0.
Referenced by ck_ir_v2_apply_weight_dtypes().
|
static |
Definition at line 112 of file ckernel_ir_v2_builder.c.
Referenced by ck_ir_v2_apply_weight_dtypes().
|
static |
Definition at line 70 of file ckernel_ir_v2_builder.c.
References CKKernelSpec::backward, CK_DT_COUNT, CKKernelSpec::default_dtype, CKKernelSpec::forward, and CKKernelSpec::name.
Referenced by ck_ir_v2_build_decoder(), and ck_ir_v2_build_decoder_backward().
|
static |
Definition at line 104 of file ckernel_ir_v2_builder.c.
References end.
Referenced by ck_ir_v2_apply_weight_dtypes(), and ck_ir_v2_parse_bool().
|
static |
Definition at line 8 of file ckernel_ir_v2_builder.c.
Referenced by ck_ir_v2_apply_meta(), ck_ir_v2_build_decoder(), ck_ir_v2_build_decoder_backward(), and ck_ir_v2_copy_buffer_spec().