|
ember.cpp 0.1.0
C++ inference engine for Llama-family and paperkiln models (CPU, CUDA, WebAssembly)
|
Namespaces | |
| namespace | cpu |
| namespace | expr |
| namespace | rec |
Classes | |
| struct | DigestResult |
| class | Interpreter |
| struct | Node |
Variables | |
| const char *const | kIrSchemaPieces [] |
| const char *const | patternProperties |
Definition at line 553 of file graph_ir.cpp.
References c, has_ir_builder(), in, Logger::info(), j, k, layernorm, linear, n, name, out, p, rmsnorm, scale, state, GGUFData::tensor_infos_map, GGUFData::tokenizer_tokens, and v.
Referenced by find_ir().
Definition at line 3053 of file graph_ir.cpp.
References cpu_only(), and j.
Referenced by cpu_only(), ember_ir::Interpreter::kv_positions(), ember_ir::Interpreter::load_state(), ember_ir::Interpreter::recurrent_values(), ember_ir::Interpreter::save_state(), and ember_ir::Interpreter::truncate().
Definition at line 463 of file graph_ir.cpp.
References ember_ir::expr::cached(), has_windowed_attention(), j, ember_ir::expr::lower(), n, and sub.
Referenced by ember_ir::Interpreter::init(), and tinyllama::TinyLlamaSession::TinyLlamaSession().
| std::string ember_ir::es_number_string | ( | double | v | ) |
Definition at line 472 of file ir_digest.cpp.
References es_number_string(), j, k, n, out, and v.
Referenced by es_number_string().
Definition at line 525 of file graph_ir.cpp.
References build_ir_from_gguf(), has_ir_builder(), and j.
Referenced by TinyLlamaModel::TinyLlamaModel(), and tinyllama::TinyLlamaSession::TinyLlamaSession().
Definition at line 519 of file graph_ir.cpp.
References j.
Referenced by build_ir_from_gguf(), and find_ir().
Definition at line 257 of file graph_ir.cpp.
Definition at line 245 of file graph_ir.cpp.
Referenced by device_supported().
| void ember_ir::ir_affine_cuda | ( | const float * | x, |
| float * | out, | ||
| size_t | n, | ||
| float | scale, | ||
| float | shift, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 737 of file graph_ir_cuda.cu.
Definition at line 803 of file graph_ir_cuda.cu.
| void ember_ir::ir_binary_cuda | ( | const float * | a, |
| const float * | b, | ||
| float * | out, | ||
| size_t | n, | ||
| int | op, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 809 of file graph_ir_cuda.cu.
| std::vector< std::string > ember_ir::ir_container_errors | ( | const json & | doc, |
| const GGUFData & | gguf | ||
| ) |
Definition at line 1609 of file graph_ir_validate.cpp.
References ir_container_errors(), j, and out.
Referenced by ir_container_errors(), and validate_ir().
| void ember_ir::ir_conv1d_causal_cuda | ( | const float * | x, |
| const float * | w, | ||
| const float * | bias, | ||
| float * | state, | ||
| float * | out, | ||
| int | T, | ||
| int | C, | ||
| int | K, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 838 of file graph_ir_cuda.cu.
| void ember_ir::ir_depth_attend_cuda | ( | const float *const * | sources, |
| int | S, | ||
| const float * | w, | ||
| float * | out, | ||
| int | T, | ||
| int | d, | ||
| float | eps, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 759 of file graph_ir_cuda.cu.
| DigestResult ember_ir::ir_digest | ( | const std::string & | text, |
| bool | prose | ||
| ) |
Definition at line 496 of file ir_digest.cpp.
References j, sha256_hex_bytes(), text, and v.
Definition at line 1592 of file graph_ir_validate.cpp.
References ir_document_errors(), ir_schema_errors(), j, out, and v.
Referenced by ir_document_errors(), and validate_ir().
| void ember_ir::ir_embedding_cuda | ( | const float * | table, |
| const int * | tokens, | ||
| float * | out, | ||
| int | T, | ||
| int | d, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 786 of file graph_ir_cuda.cu.
| void ember_ir::ir_embedding_state_cuda | ( | const float * | table, |
| const float * | state, | ||
| int | vocab, | ||
| const int * | tokens, | ||
| float * | out, | ||
| int | T, | ||
| int | d, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 702 of file graph_ir_cuda.cu.
| void ember_ir::ir_expr_cuda | ( | const std::vector< expr::Stage > & | stages, |
| const float *const * | ins, | ||
| int | n_ins, | ||
| float * | scratch, | ||
| float * | out, | ||
| int | T, | ||
| int | w, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 857 of file graph_ir_cuda.cu.
References code, j, k, ember_ir::expr::kMaxCode, ember_ir::expr::kMaxColumns, ember_ir::expr::Expr::kMaxInputs, n, out, and p.
| size_t ember_ir::ir_expr_scratch_floats | ( | const std::vector< expr::Stage > & | stages, |
| int | T, | ||
| int | w | ||
| ) |
| void ember_ir::ir_gelu_cuda | ( | const float * | x, |
| float * | out, | ||
| size_t | n, | ||
| bool | tanh_form, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 819 of file graph_ir_cuda.cu.
| void ember_ir::ir_kv_compact_cuda | ( | float * | K, |
| float * | V, | ||
| const int * | idx, | ||
| int | w0, | ||
| int | n, | ||
| int | row, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 696 of file graph_ir_cuda.cu.
Referenced by ember_ir::Interpreter::ts_evict_below().
| void ember_ir::ir_layernorm_cuda | ( | const float * | x, |
| const float * | w, | ||
| const float * | b, | ||
| float * | out, | ||
| int | T, | ||
| int | d, | ||
| float | eps, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 797 of file graph_ir_cuda.cu.
| void ember_ir::ir_mla_attention_cuda | ( | const float * | qn, |
| const float * | qr, | ||
| const float * | KV, | ||
| const float * | Kb, | ||
| const float * | Vb, | ||
| float * | out, | ||
| int | T, | ||
| int | start_pos, | ||
| int | H, | ||
| int | r, | ||
| int | dn, | ||
| int | dr, | ||
| int | dv, | ||
| float | scale, | ||
| int | window, | ||
| int | sinks, | ||
| cudaStream_t | stream, | ||
| const int * | dpos | ||
| ) |
Definition at line 995 of file graph_ir_cuda.cu.
| void ember_ir::ir_mor_gate_cuda | ( | const float * | x_in, |
| float * | x, | ||
| const float * | g, | ||
| int | n, | ||
| int | w, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 665 of file graph_ir_cuda.cu.
| void ember_ir::ir_pos_embedding_cuda | ( | const float * | x, |
| const float * | P, | ||
| float * | out, | ||
| int | T, | ||
| int | d, | ||
| int | start_pos, | ||
| cudaStream_t | stream, | ||
| const int * | dpos | ||
| ) |
Definition at line 791 of file graph_ir_cuda.cu.
Definition at line 727 of file graph_ir_cuda.cu.
| void ember_ir::ir_rms_row_cuda | ( | const float * | x, |
| float * | out, | ||
| int | T, | ||
| int | w, | ||
| float | eps, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 754 of file graph_ir_cuda.cu.
| void ember_ir::ir_rope_at_cuda | ( | float * | q, |
| float * | k, | ||
| int | T, | ||
| int | hq, | ||
| int | hk, | ||
| int | hd, | ||
| const int * | pos, | ||
| const float * | freqs, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 671 of file graph_ir_cuda.cu.
| void ember_ir::ir_rope_cuda | ( | float * | q, |
| float * | k, | ||
| int | T, | ||
| int | hq, | ||
| int | hk, | ||
| int | hd, | ||
| int | start_pos, | ||
| const float * | freqs, | ||
| cudaStream_t | stream, | ||
| const int * | dpos | ||
| ) |
Definition at line 824 of file graph_ir_cuda.cu.
| void ember_ir::ir_rope_rows_at_cuda | ( | float * | x, |
| int | T, | ||
| int | heads, | ||
| int | hd, | ||
| int | n_rot, | ||
| bool | neox, | ||
| const int * | pos, | ||
| const float * | freqs, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 677 of file graph_ir_cuda.cu.
| void ember_ir::ir_rope_rows_cuda | ( | float * | x, |
| int | T, | ||
| int | heads, | ||
| int | hd, | ||
| int | n_rot, | ||
| bool | neox, | ||
| int | start_pos, | ||
| const float * | freqs, | ||
| cudaStream_t | stream, | ||
| const int * | dpos | ||
| ) |
| void ember_ir::ir_rows_gather_cuda | ( | const float * | src, |
| const int * | idx, | ||
| float * | dst, | ||
| int | n, | ||
| int | w, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 653 of file graph_ir_cuda.cu.
| void ember_ir::ir_rows_scatter_cuda | ( | const float * | src, |
| const int * | idx, | ||
| float * | dst, | ||
| int | n, | ||
| int | w, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 659 of file graph_ir_cuda.cu.
| void ember_ir::ir_scale_cuda | ( | const float * | x, |
| const float * | g, | ||
| const float * | b, | ||
| float * | out, | ||
| int | T, | ||
| int | w, | ||
| cudaStream_t | stream | ||
| ) |
Definition at line 748 of file graph_ir_cuda.cu.
Definition at line 1583 of file graph_ir_validate.cpp.
References ir_schema_errors(), j, out, and p.
Referenced by ir_document_errors(), and ir_schema_errors().
Definition at line 732 of file graph_ir_cuda.cu.
Definition at line 814 of file graph_ir_cuda.cu.
References j, n, out, and silu_kernel().
| void ember_ir::ir_ssm_scan_cuda | ( | const float * | u, |
| const float * | A, | ||
| const float * | B, | ||
| const float * | C, | ||
| const float * | D, | ||
| float * | s, | ||
| float * | y, | ||
| int | T, | ||
| int | n, | ||
| cudaStream_t | stream | ||
| ) |
| void ember_ir::ir_turn_state_attention_cuda | ( | const float * | q, |
| const float * | K, | ||
| const float * | V, | ||
| float * | out, | ||
| int | T, | ||
| int | row0, | ||
| const int * | codes, | ||
| int | hq, | ||
| int | hkv, | ||
| int | hd, | ||
| float | scale, | ||
| cudaStream_t | stream, | ||
| const int * | drow | ||
| ) |
Definition at line 685 of file graph_ir_cuda.cu.
| void ember_ir::ir_window_attention_cuda | ( | const float * | q, |
| const float * | K, | ||
| const float * | V, | ||
| float * | out, | ||
| int | T, | ||
| int | start_pos, | ||
| int | hq, | ||
| int | hkv, | ||
| int | hd, | ||
| float | scale, | ||
| int | window, | ||
| int | sinks, | ||
| cudaStream_t | stream, | ||
| const int * | dpos, | ||
| float | softcap | ||
| ) |
| void ember_ir::linear_attention_row_cpu | ( | const float * | q, |
| const float * | k, | ||
| const float * | v, | ||
| float * | num, | ||
| float * | den, | ||
| float * | out, | ||
| int | width, | ||
| float | den_floor | ||
| ) |
Definition at line 213 of file graph_ir.cpp.
References c, j, k, out, and v.
Referenced by ember_ir::Interpreter::run_nodes().
| nlohmann::json ember_ir::parse_ir_document | ( | const std::string & | text | ) |
Definition at line 1474 of file graph_ir_validate.cpp.
References j, parse_ir_document(), and text.
Referenced by ember_ir::Interpreter::Interpreter(), parse_ir_document(), and tuned_llama_match().
| std::string ember_ir::sha256_hex_bytes | ( | const std::string & | bytes | ) |
Definition at line 454 of file ir_digest.cpp.
References j, k, off, and out.
Referenced by ir_digest().
| void ember_ir::ssm_scan_row_cpu | ( | const float * | u, |
| const float * | A, | ||
| const float * | B, | ||
| const float * | C, | ||
| float | D, | ||
| float * | s, | ||
| float * | scratch, | ||
| float * | y, | ||
| int | n | ||
| ) |
Definition at line 224 of file graph_ir.cpp.
Referenced by ember_ir::Interpreter::run_nodes().
| bool ember_ir::tuned_llama_match | ( | const std::string & | ir_json, |
| const GGUFData & | gguf, | ||
| std::string * | why | ||
| ) |
Definition at line 440 of file graph_ir.cpp.
References j, parse_ir_document(), parse_model_config_from_gguf(), validate_ir(), and why.
Referenced by TinyLlamaModel::TinyLlamaModel(), and tinyllama::TinyLlamaSession::TinyLlamaSession().
Definition at line 1620 of file graph_ir_validate.cpp.
References ir_container_errors(), ir_document_errors(), j, and validate_ir().
Referenced by ember_ir::Interpreter::Interpreter(), tuned_llama_match(), and validate_ir().
Definition at line 7 of file graph_ir_schema.h.
Definition at line 9 of file graph_ir_schema.h.