MCPcopy Create free account

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

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

↓ 2 callersFunctionrmsnorm_with_eps
(g: &mut Graph, x: Tensor, weight: Tensor, eps: f32)
ane/src/dflash.rs:62
↓ 2 callersFunctionrun_ar
(target_model, input_ids, max_tokens, stop_ids)
scripts/bench_ane_profile.py:283
↓ 2 callersMethodrun_cached
( &self, py: Python<'_>, inputs: Vec<PyRef<ANETensor>>, outputs: Vec<PyRef<ANE
ane/src/wrapper.rs:231
↓ 2 callersMethodrun_kernels
Execute ANE kernels on already-prepared buffers. No mx ops. Pure ANE (IOSurface + CoreML) — safe to call from a background thread whi
mirror_sd/ane_model.py:564
↓ 2 callersFunctionrun_llama_benchy
(base_url, model_name, depths, pp, tg, runs, tokenizer, save_result, latency_mode="generation")
mirror_sd/benchmarks/llama_benchy.py:49
↓ 2 callersFunctionrun_one
Run one full draft step with fine-grained phase timing. Replicates _start_draft + thread run + post-join sequence exactly. Returns dict[phase
scripts/bench_ane_pipeline.py:89
↓ 2 callersFunctionsave_benchmark
(raw_path, label, args, model_name, model_path, draft_path, cfg=None)
mirror_sd/benchmarks/llama_benchy.py:71
↓ 2 callersFunctionstart
Begin sampling ANE power at 500ms intervals.
scripts/ane_meter.py:55
↓ 2 callersFunctionstart_server
(cmd, url, label)
mirror_sd/benchmarks/llama_benchy.py:171
↓ 2 callersFunctionstop
Stop sampling and return summary stats.
scripts/ane_meter.py:65
↓ 2 callersFunctionstop_server
(proc, label)
mirror_sd/benchmarks/llama_benchy.py:184
↓ 2 callersFunctiontile_kv_heads
( g: &mut Graph, kv: Tensor, kv_heads: usize, gqa_ratio: usize, seq: usize, hd: usize,
ane/src/dflash.rs:92
↓ 1 callersFunction_advance_gated_delta_states
Advance GatedDeltaNet SSM state for a subset of tokens. Starting from initial_state, applies the recurrent update for each token using its (k
mirror_sd/target.py:479
↓ 1 callersFunction_advance_gated_delta_states_python
Python fallback: advance SSM state token-by-token.
mirror_sd/ssm_kernel.py:137
↓ 1 callersMethod_alloc_buffers
(self)
mirror_sd/ane_model.py:112
↓ 1 callersMethod_apply_window
(self)
mirror_sd/dflash.py:179
↓ 1 callersMethod_fetch_cache
(self, tokens)
mirror_sd/server.py:49
↓ 1 callersFunction_find_fa_mask_cache_idx
Find the index of the first KVCache entry for fa_mask creation.
mirror_sd/target.py:208
↓ 1 callersFunction_forward_full_attention_layer_explicit
Forward full-attention layer with explicit KV cache arrays.
mirror_sd/target.py:542
↓ 1 callersFunction_forward_linear_layer_explicit
Forward linear layer with explicit cache inputs, returning all rollback data.
mirror_sd/target.py:492
↓ 1 callersFunction_get_inner_model
(model)
mirror_sd/turboquant.py:145
↓ 1 callersFunction_get_kernel
()
mirror_sd/ssm_kernel.py:78
↓ 1 callersFunction_get_mask_token_id
(tokenizer)
mirror_sd/train.py:513
↓ 1 callersMethod_handle_chat_completions
(self)
mirror_sd/server.py:220
↓ 1 callersMethod_handle_models
(self)
mirror_sd/server.py:203
↓ 1 callersFunction_install_split_attention_hooks
Install split SDPA + small-proj-padding hooks on full-attention layers.
mirror_sd/generate.py:79
↓ 1 callersFunction_install_split_sdpa_if_hybrid
Install split SDPA hooks on attention layers for hybrid (Qwen3.5) models. At long context, the standard SDPA processes all 16 query positions aga
mirror_sd/generate.py:54
↓ 1 callersFunction_kod_optimal_gamma
KOD: find block_size that maximizes expected throughput. Kelly-Optimal Drafting selects the block size gamma that maximizes expected tokens p
mirror_sd/generate.py:199
↓ 1 callersMethod_load_layer_norm_weights
Load per-head norm + layer norm weights only (no projection weights).
mirror_sd/ane_model.py:281
↓ 1 callersMethod_load_layer_weights
(self, model: nn.Module, layer_idx: int)
mirror_sd/ane_model.py:199
↓ 1 callersMethod_load_layer_weights_q8
Quantize one layer's projection weights → Q8LayerWeights pyobject.
mirror_sd/ane_model.py:294
↓ 1 callersFunction_load_prompts
(args)
mirror_sd/train.py:203
↓ 1 callersMethod_log_cache
(self)
mirror_sd/server.py:44
↓ 1 callersFunction_make_gated_delta_state_kernel
()
mirror_sd/ssm_kernel.py:15
↓ 1 callersFunction_make_soft_anchor
Replicate the soft-anchor computation from _start_draft.
scripts/bench_ane_pipeline.py:76
↓ 1 callersFunction_make_split_call
(orig, has_2pass)
mirror_sd/generate.py:107
↓ 1 callersFunction_patch_attention_for_tq
Patch an Attention module to use TurboQuant quantized_attention. Replaces attn.__call__ with a version that detects TurboQuantKVCache and rou
mirror_sd/turboquant.py:59
↓ 1 callersFunction_pick_exit_layer
Pick the exit layer for Mirror-SD early-exit. Chooses the median target_layer_id as the exit point, balancing prefix and suffix compute. This
mirror_sd/generate.py:1229
↓ 1 callersFunction_spec_generate_mirror_sd
Mirror-SD speculative decoding with early-exit + parallel draft. Per Mirror-SD Eq. 10: 1. Run target prefix layers (0..exit_layer) → get hi
mirror_sd/generate.py:817
↓ 1 callersFunction_spec_generate_parallel
Parallel ANE||GPU speculative decoding (Mirror-SD Eq. 10). Pipelines draft and verify so that the next iteration's draft on ANE overlaps with
mirror_sd/generate.py:1240
↓ 1 callersFunction_tq_attention_forward
Attention forward using TurboQuant quantized_attention. Replicates the standard Attention.__call__ logic but uses cache.quantized_attention()
mirror_sd/turboquant.py:80
↓ 1 callersFunctionadvance_gated_delta_states_metal
Advance GatedDeltaNet SSM state using custom Metal kernel. Replaces the Python per-token loop with a single GPU dispatch. Falls back to the P
mirror_sd/ssm_kernel.py:85
↓ 1 callersFunctionar_generate
( target_model, input_ids: mx.array, max_new_tokens: int, stop_token_ids=None, temperature
mirror_sd/generate.py:276
↓ 1 callersFunctionbaseline_mmlu
(model, tokenizer, prompt: str, use_chat: bool, enable_thinking: bool = False)
mirror_sd/benchmarks/mmlu.py:66
↓ 1 callersFunctionbuild_attn_out_kernel
(d: &DFlashDims, w_sq: usize, w_kv: usize, softcap: f32)
ane/src/dflash.rs:238
↓ 1 callersFunctionbuild_ffn_residual_kernel_q8
Build the ffn_residual kernel with int8-quantized gate/up/down weights baked in.
ane/src/dflash.rs:434
↓ 1 callersFunctionbuild_final_norm_lm_head_kernel
Fused final RMSNorm + lm_head projection. Inputs: hidden [1, hidden, 1, w_sq], norm_w [1, hidden, 1, w_sq], lm_head_w [1, hidden, 1, vocab_size] Out
ane/src/dflash.rs:473
↓ 1 callersFunctionbuild_gqa_tile_kernel
(d: &DFlashDims, w_kv: usize)
ane/src/dflash.rs:226
↓ 1 callersFunctionbuild_loss_weights
Position-weighted loss: exp decay within each block. w_k = exp(-(k-1) / gamma) for position k within the block. Non-masked positions get weig
mirror_sd/train.py:277
↓ 1 callersFunctionbuild_mega_qkv_kernel_q8
Build the mega_qkv kernel with int8-quantized projection weights baked in. Inputs: hidden, in_norm_w, context, k_norm_w, q_norm_w, cos_k, sin_k, cos_
ane/src/dflash.rs:354
↓ 1 callersFunctionbuild_o_proj_residual_kernel_q8
Build the o_proj_residual kernel with int8-quantized wo baked in.
ane/src/dflash.rs:407
↓ 1 callersFunctionbuild_spec_cmd
(model_path, draft_path, port, model_name, args, cfg)
mirror_sd/benchmarks/llama_benchy.py:116
↓ 1 callersFunctionbuild_training_mask
Build block-diagonal attention mask for training. Within each block: bidirectional (non-causal). Between blocks: no attention. Context fe
mirror_sd/train.py:247
↓ 1 callersFunctioncmd_convert
(args)
mirror_sd/cli.py:79
↓ 1 callersFunctioncmd_generate
(args)
mirror_sd/cli.py:17
↓ 1 callersFunctionconvert_dflash_to_mlx
Convert a DFlash model from HuggingFace format to MLX format. Downloads the model from HuggingFace, converts weights to float16, and saves in
mirror_sd/loader.py:119
↓ 1 callersMethodenable
(self)
scripts/bench_ane_profile.py:63
↓ 1 callersFunctionfmt_compare
(rows_a, rows_b, label_a, label_b)
mirror_sd/benchmarks/view.py:84
↓ 1 callersFunctionfmt_summary
(rows)
mirror_sd/benchmarks/view.py:74
↓ 1 callersFunctionfmt_table
(rows, label="")
mirror_sd/benchmarks/view.py:54
↓ 1 callersFunctionformat_mmlu_question
(question: str, choices: list, subject: str, dev_set: list, n_shots: int = 5)
mirror_sd/benchmarks/mmlu.py:47
↓ 1 callersMethodforward
(self, noise_embedding: mx.array, target_hidden: mx.array, rope_offset: int = 0, ctx_len: int
mirror_sd/ane_model.py:384
↓ 1 callersFunctionforward_verifier_states_compiled
Compiled variant of forward_verifier_states for Qwen3.5.
mirror_sd/target.py:1058
↓ 1 callersFunctionforward_with_hidden_states_and_rollback
Forward pass for Qwen3.5 that records rollback data for linear attention. Returns same as forward_with_hidden_states plus rollback_records dict
mirror_sd/target.py:283
↓ 1 callersFunctionforward_with_hidden_states_compiled
Compiled forward pass for Qwen3.5 verify with rollback recording. Uses per-layer mx.compile for both linear AND full attention layers. Linear
mirror_sd/target.py:877
↓ 1 callersFunctionforward_with_hidden_states_compiled_whole
Qwen3.5 compiled whole-model verify. All 64 layers in one mx.compile graph.
mirror_sd/target.py:708
↓ 1 callersMethodfrom_dict
(cls, d: dict)
mirror_sd/dflash.py:78
↓ 1 callersMethodgenerate
(self, messages, max_tokens=128, temperature=0.0)
mirror_sd/server.py:143
↓ 1 callersMethodgenerate_streaming
(self, messages, max_tokens=128, temperature=0.0, write_fn=None)
mirror_sd/server.py:110
↓ 1 callersFunctionget_compiled_full_attention_verify_fn
Get or create a compiled full-attention verify function for a layer. Takes explicit KV cache arrays (old_keys, old_values, offset) as inputs
mirror_sd/target.py:51
↓ 1 callersFunctionget_compiled_whole_model_verify_fn
Get or create a compiled whole-model verify function for Qwen3.5. Compiles the entire 64-layer forward pass into a single mx.compile graph. A
mirror_sd/target.py:596
↓ 1 callersFunctionmain
()
mirror_sd/train.py:525
↓ 1 callersFunctionmain
()
mirror_sd/cli.py:84
↓ 1 callersFunctionmain
()
mirror_sd/server.py:260
↓ 1 callersFunctionmain
()
mirror_sd/benchmarks/view.py:238
↓ 1 callersFunctionmain
()
mirror_sd/benchmarks/llama_benchy.py:138
↓ 1 callersFunctionmain
()
mirror_sd/benchmarks/mmlu.py:273
↓ 1 callersFunctionmain
()
scripts/test_ane_e2e.py:25
↓ 1 callersFunctionmain
()
scripts/test_qk_isolation.py:109
↓ 1 callersFunctionmain
()
scripts/bench_ane_profile.py:305
↓ 1 callersFunctionmain
()
scripts/bench_ane_pipeline.py:220
↓ 1 callersFunctionmain
()
scripts/bench_ane_power.py:119
↓ 1 callersMethodmake_cache
(self)
mirror_sd/ane_model.py:428
↓ 1 callersFunctionmake_turboquant_cache
Create a prompt cache with TurboQuantKVCache for full-attention layers. For Qwen3.5 (mixed attention), replaces KVCache entries with TurboQuantKV
mirror_sd/turboquant.py:21
↓ 1 callersFunctionplot_chart
(rows_a, rows_b, meta_a, meta_b, output_path)
mirror_sd/benchmarks/view.py:103
↓ 1 callersFunctionplot_multi_chart
(all_rows, all_meta, output_path)
mirror_sd/benchmarks/view.py:166
↓ 1 callersFunctionprepare_data
Phase 1: Generate target model responses and extract hidden states. For each prompt: 1. Generate response using target model (greedy)
mirror_sd/train.py:111
↓ 1 callersFunctionprofile_dispatches
()
scripts/bench_ane_dispatch.py:20
↓ 1 callersMethodqwen3_8b
(cls, num_target_layers: int = 36)
mirror_sd/dflash.py:53
↓ 1 callersMethodread_argmax
Return argmax over the channels (vocab) dimension for each of the first `seq_len` spatial positions. Expects buffer shape [1, vocab_size, 1, w_sq] (f
ane/src/wrapper.rs:108
↓ 1 callersMethodreset
(self)
scripts/bench_ane_profile.py:59
↓ 1 callersFunctionrollback_linear_caches
Roll back Qwen3.5 linear attention caches after partial block rejection. Restores conv_state and SSM state to what they would be after processing
mirror_sd/target.py:420
↓ 1 callersFunctionrun_mmlu
(args)
mirror_sd/benchmarks/mmlu.py:118
↓ 1 callersMethodsanitize
(self, weights)
mirror_sd/dflash.py:408
↓ 1 callersMethodset_block_size
Change the active block size without recompiling kernels. Valid for any new_seq_q in [1, w_sq] (w_sq = align_width(original seq_q)).
mirror_sd/ane_model.py:611
↓ 1 callersFunctionspec_mmlu
(model, draft_model, tokenizer, prompt: str, use_chat: bool, eos_ids, **spec_kwargs)
mirror_sd/benchmarks/mmlu.py:94
↓ 1 callersFunctionstart
Begin sampling ANE power in background.
scripts/ane_utilization.py:36
↓ 1 callersFunctionstop
Stop sampling and return stats.
scripts/ane_utilization.py:45
↓ 1 callersFunctiontrain
Phase 2: Train the DFlash draft model.
mirror_sd/train.py:298
↓ 1 callersFunctiontrain_step
(model, input_ids, target_ids, target_hidden, loss_weights, attn_mask)
mirror_sd/train.py:381
← previousnext →101–200 of 277, ranked by callers