Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.
Python amdapple-siliconcudadeepseekexl3exllamav3glminferencellmllm-inferencelocal-llmnvidiaopenai-apiquantizationqwenrocmstrix-halo
py::class_<BC_MLAttention, std::shared_ptr<BC_MLAttention>>(m, "BC_MLAttention").def
(
py::init<
int,
int,
int,
int,
int,
int,
int,
int,
std::shared_ptr<BC_LinearEXL3>,
std::shared_ptr<BC_LinearEXL3>,
c10::optional<at::Tensor>,
std::shared_ptr<BC_LinearEXL3>,
std::shared_ptr<BC_LinearEXL3>,
at::Tensor,
float,
at::Tensor,
int,
float,
int,
float,
int,
at::Tensor,
at::Tensor,
bool,
at::Tensor,
at::Tensor,
c10::optional<at::Tensor>,
at::Tensor,
at::Tensor
>(),
py::arg("num_q_heads"),
py::arg("hidden_size"),
py::arg("page_size"),
py::arg("kv_lora_rank"),
py::arg("qk_rope_head_dim"),
py::arg("qk_nope_head_dim"),
py::arg("v_head_dim"),
py::arg("q_lora_rank"),
py::arg("q_proj"),
py::arg("q_a_proj"),
py::arg("q_a_norm_w"),
py::arg("kv_a_proj"),
py::arg("o_proj"),
py::arg("kv_norm_w"),
py::arg("norm_eps"),
py::arg("inv_freq"),
py::arg("rope_style"),
py::arg("attn_factor"),
py::arg("rotate_dims"),
py::arg("l4_scaling_beta"),
py::arg("l4_scaling_original"),
py::arg("w_uk_flat"),
py::arg("w_uv_flat"),
py::arg("quant_cache"),
py::arg("cache_ckv"),
py::arg("cache_kpe"),
py::arg("cache_scales"),
py::arg("xh"),
py::arg("h32")
)
.def("set_indexer", &BC_MLAttention::set_indexer,
py::arg("mode"),
py::arg("wq_b"),
py::arg("wk_w"),
py::arg("k_norm_w"),
py::arg("k_norm_b"),
py::arg("weights_w"),
py::arg("kidx"),
py::arg("n_heads"),
py::arg("head_dim"),
py::arg("topk"),
py::arg("kpool") = 0,
py::arg("kpool_tail") = true,
py::arg("gate_w") = py::none(),
py::arg("kpool_ape") = py::none(),
py::arg("kpool_plane") = py::none()
)
.def("needs_configure", &BC_MLAttention::needs_configure)
.def("configure_slot", &BC_MLAttention::configure_slot,
py::arg("bsz"),
py::arg("q_len"),
py::arg("regime"),
py::arg("q_full"),
py::arg("q_a"),
py::arg("ckv_kpe"),
py::arg("ckv"),
py::arg("kpe"),
py::arg("q_pe"),
py::arg("q_lat"),
py::arg("o_lat"),
py::arg("o"),
py::arg("partial_o"),
py::arg("partial_ml"),
py::arg("qtmp"),
py::arg("stmp"),
py::arg("k_stage"),
py::arg("k_absorb"),
py::arg("k_append"),
py::arg("k_split"),
py::arg("k_combine"),
py::arg("k_unfold"),
py::arg("block_n"),
py::arg("splits_cap"),
py::arg("programs"),
py::arg("absorb_gx"),
py::arg("absorb_gy"),
py::arg("unfold_gx")
)
.def("configure_slot_dsa", &BC_MLAttention::configure_slot_dsa,
py::arg("bsz"),
py::arg("q_len"),
py::arg("regime"),
py::arg("x_st"),
py::arg("kidx"),
py::arg("kidx_n"),
py::arg("qidx"),
py::arg("wts"),
py::arg("scores"),
py::arg("indices"),
py::arg("dsa_arr"),
py::arg("dsa_ws_ml"),
py::arg("dsa_ws_acc"),
py::arg("k_idx_norm"),
py::arg("k_plane_append"),
py::arg("k_fewq"),
py::arg("k_dsa_split"),
py::arg("k_dsa_combine"),
py::arg("dsa_hb"),
py::arg("dsa_splits"),
py::arg("fewq_gy"),
py::arg("gidx") = py::none(),
py::arg("pool_idx") = py::none(),
py::arg("k_gate_append") = nullptr,
py::arg("k_pool_update") = nullptr,
py::arg("k_pool_expand") = nullptr
)
.def("run", &BC_MLAttention::run);