code wiki / (root) / nx_f32_qwen_encoder.nx

nx_f32_qwen_encoder.nx

buildroot/runtime/nx_f32_qwen_encoder.nx

11068 B233 linesdepth 9pulls 13 transitivereach 0 importersview sourcekind tooltopic f32
docsdependenciesstructsconstsfunctions

about

nx_f32_qwen_encoder.nx -- stack the sovereign Qwen layer into the FULL encoder forward. sd-server -> Nishi migration: the text encoder is n_layers of nx_f32_qwen_layer applied in sequence (Qwen3-4B = 36 layers). This drives that stack (ping-pong buffers). Output = the final hidden states = the real prompt embeddings that feed the DiT (cap_embedder) AND, exposed as chat, the companion -- the shared-LLM reuse, sovereign. This is the encoder analogue of nx_f32_rectflow_denoise (which stacks the DiT block). Real use passes per-layer weights; this gate loops one weight set to prove the stack mechanism. license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_f32_qwen_layer.nx nx_f32_qwen_encoder.nx

imports: nx_syscalls.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f32_qwen_layer.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_i32_to_f32 nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_qwen_encoder sys_mmap ↻ nx_f32_qwen_layer nx_f32_qwen_layer_qk sys_mmap ↻ nx_i32_to_f32 ↻ nx_f32_rmsnorm nx_i32_to_f32 ↻ nx_f32_sqrt nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_exp_field ↻ nx_f32_mant_field ↻ _f32_isqrt qw_linear nx_f32_add nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_mul nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ qw_head_norm sys_mmap ↻ nx_f32_rmsnorm ↻ nx_f32_gqa_attention sys_mmap ↻

structs

none

consts

14const K_MAGIC_1000000: i64 = 1000000

functions

16func nx_f32_qwen_encoder(x: *i64, n_tokens: i64, hidden: i64, n_q_heads: i64, n_kv_heads: i64, head_dim: i64, ffn_dim: i64,
called by 1: main calls 2: sys_mmapnx_f32_qwen_layer
54func nx_f32_qwen_encoder_layers(x: *i64, n_tokens: i64, hidden: i64, n_q_heads: i64, n_kv_heads: i64, head_dim: i64, ffn_dim: i64,
called by 1: main calls 2: sys_mmapnx_f32_qwen_layer
82func main() -> i64