MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / llm_build_context

Method llm_build_context

llama.cpp:4894–4929  ·  view source on GitHub ↗

TODO: consider making the entire interface noexcept

Source from the content-addressed store, hash-verified

4892
4893 // TODO: consider making the entire interface noexcept
4894 llm_build_context(
4895 llama_context & lctx,
4896 const llama_batch & batch,
4897 const llm_build_cb & cb,
4898 bool worst_case) :
4899 model (lctx.model),
4900 hparams (model.hparams),
4901 cparams (lctx.cparams),
4902 batch (batch),
4903 kv_self (lctx.kv_self),
4904 n_embd (hparams.n_embd),
4905 n_layer (hparams.n_layer),
4906 n_ctx (cparams.n_ctx),
4907 n_head (hparams.n_head),
4908 n_head_kv (hparams.n_head_kv),
4909 n_embd_head (hparams.n_embd_head()),
4910 n_embd_gqa (hparams.n_embd_gqa()),
4911 freq_base (cparams.rope_freq_base),
4912 freq_scale (cparams.rope_freq_scale),
4913 ext_factor (cparams.yarn_ext_factor),
4914 attn_factor (cparams.yarn_attn_factor),
4915 beta_fast (cparams.yarn_beta_fast),
4916 beta_slow (cparams.yarn_beta_slow),
4917 norm_eps (hparams.f_norm_eps),
4918 norm_rms_eps (hparams.f_norm_rms_eps),
4919 n_tokens (batch.n_tokens),
4920 n_kv (worst_case ? n_ctx : kv_self.n),
4921 kv_head (worst_case ? n_ctx - n_tokens : kv_self.head),
4922 n_orig_ctx (cparams.n_yarn_orig_ctx),
4923 do_rope_shift (worst_case || kv_self.has_shift),
4924 cb (cb),
4925 buf_compute (lctx.buf_compute) {
4926 GGML_ASSERT(!!kv_self.ctx);
4927
4928 // all initializations should be done in init()
4929 }
4930
4931 void init() {
4932 struct ggml_init_params params = {

Callers

nothing calls this directly

Calls 2

n_embd_headMethod · 0.45
n_embd_gqaMethod · 0.45

Tested by

no test coverage detected