mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #500] [CLOSED] perf(cpu-pool): eliminate host serialization barrier for intermediate activation quantization with adaptive threshold #2667
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2667
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/500
Author: @praveshkhatana
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:feat/parallel-intermediate-quant📝 Commits (10+)
cc97fcdsetup: AMD layer splits with --gpus (every chosen card a supported AMD arch; the engine compiled for each)e9e2ba3pinned (#243 follow-up): the shared-memory-budget cap on the sliced pin is opt-in (STRATA_ARENA_PIN_GIB=auto) - by default the arena pins as in 0.1.30; on this 64 GB PC the cap pinned 26 instead of 30 GiB and cost ~20% prompt speed and 2-4% IQ3_S decodecacffa9CS-T speed: the file tier fetched in parallel, PCIe planning without file reads, a partial pin of the RAM tier, bit-exact AVX2 multi-token kernels for Q4_K / Q5_1 / Q8_0 experts, decode-only tier statsa348c7aMerge branch 'f-131-srv' into r131-q4b93a00cMerge branch 'f-q4-on242' into r131-q48f5148cCS-T: the partial pin at most 24 GiB (STRATA_PARTIAL_PIN_GIB), the Q4_K/Q5_1/Q8_0 multi-token kernels from two tokens on5ffda19CS-T: the GGUF-in-place prefetch asks Windows for all of a layer's missed slices at once (PrefetchVirtualMemory)ed6c124#253: the 8 GiB arena pin cap only under WDDM; STRATA_ARENA_PIN_GIB; the split's prompt chunk steps down450149d--split-skip-if-fits (opt-in): an auto split runs on the main card alone when it holds every profiled expert + KV6926e0bMerge branch 'f-131-amd' into r131-amd📊 Changes
2 files changed (+22 additions, -2 deletions)
View changed files
📝
include/strata/kernels/cpu/pool.hpp(+2 -0)📝
src/kernels/cpu/pool.cpp(+20 -2)📄 Description
Summary
In multi-token speculative verification passes (
run_split_multiandrun_split_multi_native), between phase 5 (gate/up projections) and phase 6 (down projections), intermediate activationsff[t]are quantized (act_quant_any/native_quant_hintoa2orhq).Previously, this intermediate activation quantization was executed sequentially on the host thread in a nested loop while all worker threads sat idle in a barrier:
This PR removes the host serialization barrier and introduces pooled parallel quantization protected by an adaptive threshold:
ExpertPool::drain: Executes intermediate activation quantization tasks in parallel across pool workers using lock-free task claiming.quant_threshold_ = std::max(8, n_workers)):\le \text{threshold}), quantization executes sequentially on the host thread with zero worker wake / spin-barrier overhead (matching upstream baseline).> \text{threshold}), quantization tasks dispatch across idle pool workers viarun_phase(7).STRATA_POOL_QUANT_THRESH(e.g. set to0to force parallel).Scope & Micro-Benchmarking Clarification
Internal engine timers (
pool multi ... gate/up / quantize / down ms/round, profiled viaSTRATA_VERIFY_PROFILE=1) show that sequential intermediate quantization takes ~0.007 to 0.13 ms per round (<0.5% of round time on modern AVX2/AVX-512 CPUs).This PR is therefore designed as a thread-pipeline hygiene improvement to eliminate the host wait during speculative bursts, rather than a macro tok/s booster. It guarantees zero regression on low-fanout verification passes via the adaptive threshold while cleanly utilizing available worker threads during multi-token bursts.
Numerical Parity & Correctness
All bitwise parity tests pass with zero discrepancies:
iq_multi_parity: PASSEDmmvq_multi_parity: PASSEDquantize_act_parity: PASSEDs2_expert_grouped_parity: PASSEDnative_expert_parity: PASSEDBit-for-bit identical outputs: intermediate quantizations write to independent, disjoint thread buffers (
split_multi_[e].a2[t]/split_multi_[e].hq[t]), ensuring zero race conditions.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.