MCPcopy Create free account

hub / github.com/0xClandestine/mirror-sd / functions

Functions277 in github.com/0xClandestine/mirror-sd

↓ 39 callersMethodrun_uncached
( &self, py: Python<'_>, inputs: Vec<PyRef<ANETensor>>, outputs: Vec<PyRef<ANE
ane/src/wrapper.rs:213
↓ 23 callersFunctionsample
(logits: mx.array, temperature: float = 0.0)
mirror_sd/dflash.py:133
↓ 19 callersFunctioncosine_sim
(a, b)
scripts/test_qk_isolation.py:30
↓ 17 callersFunction_get_inner_model
(model)
mirror_sd/target.py:181
↓ 13 callersFunctionforward_with_hidden_states
( model, inputs: mx.array, cache=None, capture_layers: Optional[List[int]] = None, compile
mirror_sd/target.py:230
↓ 12 callersMethodwrite_buffer
(&self, py: Python<'_>, buf: &Bound<'_, PyAny>)
ane/src/wrapper.rs:61
↓ 11 callersFunction_section
(title: str)
scripts/bench_ane_profile.py:274
↓ 11 callersFunctionalign_width
(w: int)
mirror_sd/ane_model.py:31
↓ 11 callersFunctionread_ane_tensor_4d
(buf, shape)
scripts/test_qk_isolation.py:103
↓ 10 callersFunction_flat_cache_states
(cache)
mirror_sd/generate.py:40
↓ 10 callersFunctionlm_head_fn
(h)
scripts/bench_ane_pipeline.py:295
↓ 9 callersMethod_make_weight_buf
(self, w_flat, oc, ic, height=1)
mirror_sd/ane_model.py:180
↓ 9 callersFunction_sep
(char="─", width=70)
scripts/bench_ane_profile.py:266
↓ 9 callersFunctionconv1x1_proj
(g: &mut Graph, input: Tensor, weight: Tensor, oc: usize, ic: usize)
ane/src/dflash.rs:137
↓ 9 callersFunctionembed_fn
(ids)
scripts/bench_ane_pipeline.py:293
↓ 9 callersFunctionload_dflash_model
Load a DFlash draft model from a HuggingFace model directory. Args: model_path: Path to local model directory or HuggingFace repo ID
mirror_sd/loader.py:20
↓ 8 callersFunction_make_masks
Create proper fa_mask and ssm_mask for Qwen3.5 models.
mirror_sd/target.py:218
↓ 8 callersFunctionalign_width
(w: usize)
ane/src/wrapper.rs:11
↓ 8 callersFunctiondeinterleave_output
De-interleave ANE Q/K output back to standard format. Input: [B, n_heads, seq, head_dim] in interleaved format Output: [B, n_heads, seq, head_
scripts/test_qk_isolation.py:54
↓ 7 callersMethod_quantize_weight_q8
Quantize [oc, ic] weight to (int8_bytes, fp16_scale_bytes, oc, ic). Symmetric per-output-channel int8: scale = max(|w|, axis=1) / 127.
mirror_sd/ane_model.py:265
↓ 7 callersFunction_sep
(c="─", w=74)
scripts/bench_ane_pipeline.py:71
↓ 7 callersFunction_sep
(c="─", w=72)
scripts/bench_ane_power.py:41
↓ 7 callersFunctionconv1x1_proj_q8
1×1 projection with an int8-quantized constant weight baked into the kernel. `w`: weight in row-major `[oc, ic]` order, pre-quantized to int8 with pe
ane/src/dflash.rs:146
↓ 7 callersMethodfrom_buffer
( py: Python<'_>, batch: usize, channels: usize, height: usize, width:
ane/src/wrapper.rs:43
↓ 7 callersMethodload_weights
(self, draft_model: nn.Module, target_model: nn.Module = None)
mirror_sd/ane_model.py:166
↓ 6 callersMethod_compute_context
(self, target_hidden: mx.array)
mirror_sd/ane_model.py:632
↓ 6 callersFunction_forward_full_attention_layer_compiled
Forward a full-attention layer using compiled function with explicit cache. Only used during verify (hidden_states.shape[1] > 1) when cache is
mirror_sd/target.py:159
↓ 6 callersMethod_make_norm_weight_expanded
(self, weight: mx.array, width: int)
mirror_sd/ane_model.py:152
↓ 6 callersFunction_section
(t)
scripts/bench_ane_pipeline.py:73
↓ 6 callersFunction_section
(t)
scripts/bench_ane_power.py:43
↓ 6 callersMethod_write_padded
(self, padded: mx.array, buf, arr: mx.array)
mirror_sd/ane_model.py:432
↓ 6 callersFunctionrmsnorm
(g: &mut Graph, x: Tensor, weight: Tensor)
ane/src/dflash.rs:58
↓ 5 callersFunction_forward_linear_layer_with_record
Forward through a Qwen3.5 linear attention layer recording rollback data. Replicates GatedDeltaNet.__call__ + DecoderLayer structure but saves
mirror_sd/target.py:338
↓ 5 callersFunctionbuild_target_layer_ids
( num_target_layers: int, num_draft_layers: int )
mirror_sd/dflash.py:108
↓ 5 callersFunctionextract_context_feature
( hidden_states: List[mx.array], layer_ids: List[int], )
mirror_sd/dflash.py:122
↓ 5 callersFunctionget_lm_head
(model)
mirror_sd/target.py:192
↓ 5 callersFunctionis_qwen35
Detect if model has linear attention layers (Qwen3.5 architecture).
mirror_sd/target.py:200
↓ 5 callersMethodmake_cache
(self, sink_size: int = 64, window_size: int = 1024)
mirror_sd/dflash.py:405
↓ 5 callersMethodtrim
Remove the last n positions from the cache. After each draft step, trim(n) removes the noise positions (the speculative draft tokens)
mirror_sd/dflash.py:195
↓ 5 callersMethodupdate_and_fetch
(self, keys: mx.array, values: mx.array)
mirror_sd/dflash.py:168
↓ 4 callersFunction_apply_lm_head
(model, h: mx.array)
mirror_sd/target.py:994
↓ 4 callersMethod_make_per_head_norm_weight
(self, head_weight: mx.array, n_heads: int, width: int)
mirror_sd/ane_model.py:159
↓ 4 callersMethod_read_mlx_2d
(self, buf, seq_len: int, channels: int)
mirror_sd/ane_model.py:441
↓ 4 callersMethod_set_cors_headers
(self)
mirror_sd/server.py:178
↓ 4 callersFunctionapply_rope
Neox (split-half) RoPE: matches mx.fast.rope(traditional=False) used by Qwen3. x_rot = cat(-x[hd/2:], x[:hd/2]) along the W dimension. cos/sin are til
ane/src/dflash.rs:117
↓ 4 callersFunctionformat_prompt
Apply chat template. By default thinking is disabled for DFlash compatibility. Set enable_thinking=True to enable Qwen3/Qwen3.5 thinking mode
mirror_sd/prompt.py:15
↓ 4 callersFunctionget_embed_tokens
(model)
mirror_sd/target.py:188
↓ 4 callersFunctionget_stop_token_ids
Get stop token IDs including EOS and chat-format end tokens.
mirror_sd/prompt.py:42
↓ 4 callersFunctionrmsnorm_per_head
(g: &mut Graph, x: Tensor, weight: Tensor, eps: f32)
ane/src/dflash.rs:77
↓ 4 callersFunctionrun_spec
(target_model, draft_model, input_ids, max_tokens, stop_ids)
scripts/bench_ane_profile.py:292
↓ 4 callersMethodshape
(&self)
ane/src/wrapper.rs:162
↓ 4 callersFunctionspec_generate
( target_model, draft_model, input_ids: mx.array, max_new_tokens: int, stop_token_ids: Opt
mirror_sd/generate.py:366
↓ 3 callersMethod__init__
(self, config: DFlashConfig)
mirror_sd/dflash.py:323
↓ 3 callersMethod_compute_attn_mask
(self, ctx_len: int)
mirror_sd/ane_model.py:529
↓ 3 callersMethod_compute_rope
(self, rope_offset: int, ctx_len: int)
mirror_sd/ane_model.py:484
↓ 3 callersFunction_ctx_rows
(rows)
mirror_sd/benchmarks/view.py:99
↓ 3 callersFunction_header
(title: str)
scripts/bench_ane_profile.py:269
↓ 3 callersMethod_run_layer
(self, k, layer_idx: int)
mirror_sd/ane_model.py:447
↓ 3 callersMethod_run_layer_q8
Run one transformer layer using baked int8 projection weights.
mirror_sd/ane_model.py:346
↓ 3 callersFunction_start_draft
Prepare all ANE buffers on the main thread, then fork a pure-ANE thread. All mx.eval() / Metal calls happen HERE (main thread) before the thr
mirror_sd/generate.py:1391
↓ 3 callersFunction_tps_row
(label, results, ar_tps=None)
scripts/bench_ane_profile.py:458
↓ 3 callersFunctionget_compiled_linear_verify_fn
Get or create a compiled linear attention verify function for a layer. Compiled functions have fixed input shapes (determined by block_size),
mirror_sd/target.py:811
↓ 3 callersMethodread_output
(self)
scripts/bench_ane_profile.py:103
↓ 3 callersMethodrun
( &self, py: Python<'_>, inputs: Vec<PyRef<ANETensor>>, outputs: Vec<PyRef<ANE
ane/src/wrapper.rs:195
↓ 3 callersMethodrun_kernels
(self)
scripts/bench_ane_profile.py:83
↓ 2 callersFunction_acc_row
(label, results)
scripts/bench_ane_profile.py:487
↓ 2 callersMethod_apply_rope
( self, x: mx.array, offset: int = 0, )
mirror_sd/dflash.py:263
↓ 2 callersMethod_do_spec
(self, tokens, max_tokens, temperature, stream_callback=None)
mirror_sd/server.py:56
↓ 2 callersMethod_format_prompt
(self, messages)
mirror_sd/server.py:101
↓ 2 callersFunction_get_attn_dims
Normalize attention head dimensions across Qwen3 / Qwen3.5.
mirror_sd/target.py:41
↓ 2 callersFunction_header
(t)
scripts/bench_ane_pipeline.py:72
↓ 2 callersFunction_header
(t)
scripts/bench_ane_power.py:42
↓ 2 callersFunction_interleave_head_dims_mx
(w: mx.array, n_heads: int, head_dim: int)
mirror_sd/ane_model.py:36
↓ 2 callersFunction_load_config
Load DFlashConfig from a HuggingFace config.json.
mirror_sd/loader.py:59
↓ 2 callersMethod_load_fc_weights
(self, model: nn.Module)
mirror_sd/ane_model.py:194
↓ 2 callersMethod_load_final_norm_weights
(self, model: nn.Module)
mirror_sd/ane_model.py:239
↓ 2 callersMethod_load_lm_head_weights
(self, target_model: nn.Module)
mirror_sd/ane_model.py:242
↓ 2 callersFunction_load_safetensors
Load weights from safetensors files using MLX native loader. Handles both single file and sharded (model-00001-of-000NN.safetensors) formats.
mirror_sd/loader.py:74
↓ 2 callersFunction_prepare
()
scripts/bench_ane_power.py:157
↓ 2 callersFunction_run_timed
Run a single full forward pass, timing every kernel dispatch. Returns dict[kernel_name -> ms].
scripts/bench_ane_power.py:46
↓ 2 callersFunction_timing_row
(label, results)
scripts/bench_ane_profile.py:522
↓ 2 callersFunctioncompile_kernels
( dims: &dflash::DFlashDims, seq_q: usize, ctx_len: usize, softcap: f32, )
ane/src/wrapper.rs:308
↓ 2 callersMethodcompute_loss
Compute position-weighted CE loss on masked positions. Args: input_ids: [B, S] token ids (with MASK tokens at positions to predic
mirror_sd/train.py:75
↓ 2 callersFunctioncosine_sim
(a, b)
scripts/test_ane_e2e.py:19
↓ 2 callersMethoddisable
(self)
scripts/bench_ane_profile.py:64
↓ 2 callersFunctionforward_prefix
( model, inputs: mx.array, cache=None, exit_layer: int = 19, capture_layers: Optional[List
mirror_sd/target.py:951
↓ 2 callersFunctionforward_suffix
( model, h: mx.array, cache=None, start_layer: int = 20, mask=None, capture_layers: Op
mirror_sd/target.py:1236
↓ 2 callersMethodforward_train
Forward pass for training. Returns raw logits (before lm_head).
mirror_sd/train.py:56
↓ 2 callersFunctionforward_verifier_states
Forward pass that returns norm'd hidden states before lm_head. Returns (norm_hidden, embed, hidden_states, rollback_records). norm_hidden is
mirror_sd/target.py:1002
↓ 2 callersMethodload_weights_q8
Load weights as W8A16 int8 and compile per-layer quantized kernels. This replaces load_weights() for the quantized inference path. Af
mirror_sd/ane_model.py:312
↓ 2 callersFunctionmake_4d_norm_weight
(head_weight_list, n_heads, width)
scripts/test_qk_isolation.py:227
↓ 2 callersFunctionparse_bench
(path)
mirror_sd/benchmarks/view.py:20
↓ 2 callersMethodprepare_forward
Write all ANE input buffers on the calling (main) thread. Runs all mx.eval() / Metal operations here so that run_prepared() can be ca
mirror_sd/ane_model.py:538
↓ 2 callersMethodprepare_forward
(self, noise_embedding, precomputed_context, cache, target_hidden)
scripts/bench_ane_profile.py:78
↓ 2 callersFunctionpython_perhead_norm
Apply per-head RMSNorm. q_4d: [B, n_heads, seq, head_dim] norm_weight: [head_dim] Returns: [B, n_heads, seq, head_dim]
scripts/test_qk_isolation.py:74
↓ 2 callersFunctionpython_rmsnorm
(x, weight, eps=1e-6)
scripts/test_qk_isolation.py:69
↓ 2 callersFunctionpython_rope
Apply RoPE (neox/half-rotation style, traditional=False) to [B, n_heads, seq, head_dim].
scripts/test_qk_isolation.py:86
↓ 2 callersMethodread_draft_tokens
Argmax over vocab from b_logits → token ids [1, seq_q]. Only valid when vocab_size was set at construction. Must be called on the mai
mirror_sd/ane_model.py:595
↓ 2 callersMethodread_f32
(&self, py: Python<'_>)
ane/src/wrapper.rs:142
↓ 2 callersMethodread_output
Read b_output into an mx.array. Must be called on the main thread.
mirror_sd/ane_model.py:591
next →1–100 of 277, ranked by callers