b11569: metal : fix mul_mat_id with duplicate ids (#30373)

5,569 reads • 229 shares • 1 min read • Impact: 9.4/10 • Zero Trackers
Derived & scientifically synthesized from Llama.cpp Tensor Acceleration.
Original reference: [Source Link →]
Policy: Zero Trackers | Zero Ads | Objective Engineering Peer-Synthesis
Key Architectural Takeaway

metal : fix mul_mat_id limits and kernel name metal : fix mul_mat_id with duplicate ids kernel_mul_mm_id_map0 assumed at most one match per token and a fixed capacity of ne21 entries per expert, which produced wrong or dropped output rows and could overflow into the slice of the next expert when the ids contain duplicates.

Executive Summary

metal : fix mul_mat_id limits and kernel name metal : fix mul_mat_id with duplicate ids kernel_mul_mm_id_map0 assumed at most one match per token and a fixed capacity of ne21 entries per expert, which produced wrong or dropped output rows and could overflow into the slice of the next expert when the ids contain duplicates. build a compact per-expert list of the (token, slot) entries instead: pass 1 counts the entries of every expert, thread 0 computes the offsets of the expert slices (tpe now holds [base, count]) pass 2 writes the entries with one unconditional store per token (conditional stores of divergent lanes are very slow), the dummy value of the tokens without a...

Artificial Intelligence Architecture & Model Evaluation

From an artificial intelligence architecture, model weights governance, and inference efficiency perspective: - **Weights Accessibility & Sovereignty:** Evaluates whether weights are open for private self-hosting or locked behind centralized cloud APIs. - **Quantization & Edge Performance:** Kernel optimizations (4-bit/8-bit GGUF, AWQ, EXL2) allow high tokens-per-second on consumer GPUs and Apple Silicon. - **Reasoning & Architectural Scaling:** Scrutinizes mixture-of-experts (MoE), attention mechanisms, and fine-tuning datasets against open community benchmarks.

Impact on the Open Ecosystem

Protects developers and enterprises from proprietary black-box entrapment, fostering auditable, sovereign AI infrastructure.