You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Port performance fixes (upstream #497 / #464) to zion-training "Frankenstein" build
This issue tracks the porting of two critical performance and safety fixes from upstream dev into our custom zion-training deployment.
Context on the "Frankenstein" Build
Our production deployment is built on upstream/dev@31526ae with custom cherry-picks (like the f6c1828 attention-only eligibility fix and METRICS parser fixes). We are intentionally not performing a full merge of the 95 upstream commits to avoid:
Conflict Complexity: Merging the entire dev tree would introduce AMD GPU support, serve stage 2 grammar features, security hardening, and fmt=5/6 quantization, creating a massive conflict surface.
Instead, we target specific high-value, low-risk patches.
Why: The original LFRU eviction guard (pilot: LFRU-aware eviction guard — a speculative load never evicts a warm demand expert (#441) #474) was implemented with the comparison inverted for speculations: if(cs <= vs+(vs>>2)+(4u<<8)){ drop; return; }
This demanded that a speculative load beat a just-used demand victim by 25% + 4 frequency counts. Since speculations are historically cold, the condition was almost always true, causing the cache to drop ~100% of speculative loads once full. This collapsed the LRU hit share from 27-38% down to 15%, reducing tok/s by ~15%.
Fix: Protect the victim only when it is genuinely warm (heat >= 2 demand accesses) AND hotter than the speculation by the same margin: if(vs+(vs>>2)+(4u<<8) > cs){ drop; return; }
Impact: Restores LRU churn and the 27-38% cache hit contribution, providing a +10-15% tok/s boost.
2. Upstream #464 (commit d8277d6): Reject fmt=4 without group size
Why: Prevents silent math corruption if a fmt=4 model (grouped int4) is loaded and reaches CUDA per-row-only entry points (coli_cuda_matmul and coli_cuda_expert_mlp).
Fix: Guard the entry points to reject fmt == 4 if gs <= 0.
Impact: Safety guard (low risk).
Integration & Verification Plan
Branching: Create a new branch feat/port-lfru-guard-497 from dev.
Port performance fixes (upstream #497 / #464) to zion-training "Frankenstein" build
This issue tracks the porting of two critical performance and safety fixes from upstream dev into our custom zion-training deployment.
Context on the "Frankenstein" Build
Our production deployment is built on
upstream/dev@31526aewith custom cherry-picks (like thef6c1828attention-only eligibility fix and METRICS parser fixes). We are intentionally not performing a full merge of the 95 upstream commits to avoid:Instead, we target specific high-value, low-risk patches.
Selected Fixes for Porting
1. Upstream #497 (commit 38d1777): Fix LFRU Eviction Guard
if(cs <= vs+(vs>>2)+(4u<<8)){ drop; return; }This demanded that a speculative load beat a just-used demand victim by 25% + 4 frequency counts. Since speculations are historically cold, the condition was almost always true, causing the cache to drop ~100% of speculative loads once full. This collapsed the LRU hit share from 27-38% down to 15%, reducing tok/s by ~15%.
heat >= 2demand accesses) AND hotter than the speculation by the same margin:if(vs+(vs>>2)+(4u<<8) > cs){ drop; return; }2. Upstream #464 (commit d8277d6): Reject fmt=4 without group size
fmt=4model (grouped int4) is loaded and reaches CUDA per-row-only entry points (coli_cuda_matmulandcoli_cuda_expert_mlp).fmt == 4ifgs <= 0.Integration & Verification Plan
feat/port-lfru-guard-497fromdev.c/glm.catpilot_realloadandpilot_uring_batch.c/backend_cuda.cuforcoli_cuda_matmulandcoli_cuda_expert_mlp(adapted to our signature).make portableandmake test-cto verify correctness.zion-training:/home/agent/colibri-test/.colibri-testdirectory and rollback the branch. If successful, mergefeat/port-lfru-guard-497todev.