Open-Source Inference Stack on Domestic AI Accelerators: Capabilities and Gaps

    A production-oriented open-source inference stack for domestic AI accelerators is examined from public code and docs: custom operators, fusion, MoE communication, and KV Cache huge pages, plus three remaining engineering issues and a practical evaluation checklist.

    1. Background: From “It Runs” to “It Serves”

    An open-source model team released production-grade inference code targeting domestic AI accelerators, claiming that this class of hardware can already deliver AI inference at a high operational bar. Two points matter: the code has been hardened in real workloads, not as a proof of concept; and it covers the full inference path—core operators, communication, memory management, and scheduling.

    For developers, claims matter less than layer-by-layer verification. Open source makes that possible. Based on public code and documentation, this article unpacks what is already in production, flags remaining engineering gaps, and outlines a general way to evaluate stacks of this kind.

    2. Technical Breakdown of the Open-Source Stack

    2.1 Custom Compute Operators: Filling the Ecosystem Gap

    On GPUs, inference frameworks lean on mature operator libraries. Domestic accelerator ecosystems are younger, so operators must be built in-house. The released model execution layer includes dozens of specialized operator modules covering:

    • KV Cache read/write and batch management
    • Quantize/dequantize for weights and activations
    • High-frequency fine-grained ops such as rotary position embeddings
    • Primitive ops used before fusing gates and normalization

    These operators are implemented via code generation from high-level operator descriptions, which simplifies tuning per hardware backend. Operator coverage and performance largely determine how fast model structures run and how many variants can be supported—an early requirement for production-grade domestic compute.

    2.2 Operator Fusion: Fewer Intermediate Reads and Writes

    The open-source code deeply fuses paths such as attention projections, MoE gating, and mixed communication, collapsing separate matmul, normalization, and residual-add steps into a small number of kernels. Benefits include:

    1. Less spilling and reloading of intermediate tensors in device memory
    2. Fewer kernel launches and less overhead from tiny operators
    3. Room for more aggressive memory reuse inside fused kernels

    This is compiler-style optimization and a main way inference engines extract performance on constrained hardware. Fusion depth is a trade-off: too deep reduces kernel generality and raises maintenance cost.

    2.3 Communication and Dynamic Load Balancing: Prerequisite for MoE Serving

    MoE expert weight placement drifts as load changes, so the system needs expert-parallel load balancing (EPLB)—redistributing expert weights across devices. The code implements weight-copy kernels over high-speed inter-chip interconnects for those transfers.

    Two design points stand out:

    • Communication kernels are decoupled from the compute pipeline so weight movement can overlap inference
    • Redistribution is on-demand, avoiding static maps that overload some devices and idle others

    2.4 Huge-Page Allocation for KV Cache: Lower Address-Translation Cost

    Long-context inference stresses device memory and bandwidth. The stack uses a dedicated KV Cache allocator that prefers 1 GiB huge pages and includes huge-page capacity queries. Gains include:

    • Fewer page-table entries and lower TLB-miss cost
    • Less allocator fragmentation
    • KV Cache batch I/O closer to contiguous access

    The win is less dramatic than fusion, but it matters under high concurrency and long context.

    3. Three Engineering Details Still to Polish

    Open source also exposes real implementation limits. Three issues stand out.

    3.1 MoE Prefill Still Forces CPU Synchronization

    During expert token dispatch in MoE Prefill, the code forces a CPU sync flag. Comments say this is to avoid OOM, but each dispatch adds an NPU→CPU sync and stalls the device pipeline.

    Schematically:

    1. for expert_tokens in split_by_expert(tokens):
    2. stats = do_cpu_sync(expert_tokens) # forced sync, wait for NPU
    3. dispatch(expert_tokens, stats)

    Possible directions: preallocate worst-case buffers to drop the sync; two-stage scheduling (coarse buckets then fine dispatch); static planning from Prefill’s relatively concentrated expert hits. In batch inference where Prefill throughput is critical, these syncs add up.

    3.2 “Batch Copy” Is a Loop of Submits

    On the domestic accelerator path, the KV Cache batch-copy API issues async copies in a loop. Mainstream GPU paths submit many copies in one batch call. Pseudocode:

    1. // Current implementation
    2. for (auto& blk : blocks)
    3. async_copy(blk.src, blk.dst); // N calls, N submit points
    4. // Desired implementation
    5. batch_async_copy(blocks); // 1 call, batched submit internally

    With many cache blocks (long context, multi-request batches, cache migration), looped submits and possible extra syncs compound. A true batch-submit primitive, or chaining requests on the hardware copy engine, would be better.

    3.3 Vocab/Embedding Cache Cannot Offload to Host Memory

    On this platform, vocab-related caches are forced to stay in device memory even if the user turns the option off. Consequences:

    • Vocab/embedding data always occupies scarce device memory
    • Less capacity remains for KV Cache and other runtime buffers
    • Users lose the capacity-vs-bandwidth trade-off

    A layered approach—cold data on host memory plus async prefetch—would balance PCIe bandwidth and device capacity, with a user-configurable switch so long-context jobs can grow KV Cache.

    4. How to Evaluate a “Production-Grade” Open-Source Inference Stack

    Suggested checklist:

    1. Per-scenario performance: Benchmark Prefill and Decode separately across long context, large batch, and mixed concurrency—not a single peak throughput number.
    2. Sync and pipelining: Hunt forced syncs and looped “fake batch” APIs on hot paths.
    3. Memory policy: Huge vs. regular pages, fragmentation control, and whether KV Cache vs. resident weights is configurable.
    4. Operator coverage and fusion depth: Zero-cost path for common model structures and complete quant formats.
    5. Observability: Kernel-level profiling, communication traces, device-memory watermarks.
    6. Scheduling and elasticity: Continuous batching, preemption, and expert load balancing that actually ship.

    5. Practical Advice

    For teams serving inference on domestic accelerators:

    • Shadow-traffic load tests: Use real request mixes, not only synthetic benchmarks; watch P99 latency and long-context memory pressure.
    • Monitoring baseline: Track utilization, communication share, sync wait, and memory fragmentation for version-to-version comparison.
    • Migration cost: Check model formats, quantization, and serving paths so “it runs” does not mean “you cannot change it.”
    • Upstream feedback: The gaps above are fixable engineering issues; community patches often land faster than waiting for an official release.

    6. Conclusion

    This release is more than a demo. Custom operators, fusion, communication, and memory management show the software stack moving from “adapted and usable” toward “production usable.” The three details—CPU sync in MoE Prefill, looped cache copies, and device-only vocab cache—show that “highest-standard serving” still depends on hot-path engineering. Open source lets anyone verify that, which is a healthy signal for the ecosystem.