Production Inference on Domestic Accelerators: A Complete Look at Operator Scheduling

    This article examines a newly open-sourced, production-grade inference stack for domestic accelerator cards, covering core operators, communication and memory management, and the inference workflow with task scheduling. It explains why running real user traffic shifts the evaluation from peak hardware specs to end-to-end coordination, then breaks down four key areas: operator coverage and numerical consistency, bandwidth and memory as managed budgets, continuous batching with preemption, and layered latency optimization for long contexts. A deployment checklist and closing takeaways round out the guide for developers evaluating domestic compute.

    1. What Actually Changed: From “It Runs” to “It Carries Production Traffic”

    A production-grade inference stack targeting domestic accelerator cards has been open-sourced. It spans four layers: core operators, communication and memory management, the inference workflow, and task scheduling. Publicly reported figures show a P50 time-to-first-token of 277 ms and a single-stream output speed of 138 tokens/s at an average input length of roughly 98K tokens, and the stack is already serving large-scale real user traffic.

    The significance here is not simply “one more adaptation.” It marks a shift in the validation standard. When the industry discussed domestic chips in the past, the focus was on whether workloads could run at all. Once inference code enters production, the question becomes whether the chip, the model, and the inference framework can jointly handle real load. Validation expands from peak hardware parameters to operator coverage, communication efficiency, scheduling stability, and consistency over long-running sessions.

    For developers, this means evaluating domestic compute cannot stop at theoretical throughput. You have to look at the end-to-end path: whether operators are efficient, whether collective communication saturates the available bandwidth, whether GPU memory is finely reused, and whether request queuing stays under control.

    2. Breaking Down the Four Main Threads

    2.1 Core Operators: Coverage and Numerical Consistency First

    The first performance bottleneck in inference is usually the operators. Common techniques include tiling attention computation by sequence to fit on-chip cache, fusing element-wise operators such as normalization and activation to reduce memory round trips for intermediate tensors, and choosing layouts and tiling strategies for matrix multiplication that match the hardware instructions.

    The engineering recommendation is to start with an operator coverage list that flags, for each operator, whether a high-performance implementation exists, what the fallback path is, and what the numerical error range is. Example:

    1. coverage = {
    2. "rms_norm": {"impl": "fused", "tol": 1e-3},
    3. "rope": {"impl": "fused", "tol": 1e-4},
    4. "paged_attention": {"impl": "native", "tol": 1e-3},
    5. "moe_gate": {"impl": "fallback", "tol": 5e-3},
    6. }
    7. # Fallback operators need separate precision regression to avoid error accumulation under long contexts

    2.2 Communication and Memory: Treat Bandwidth and VRAM as a Budget

    Under multi-card tensor parallelism, reduction or all-gather communication can appear at every layer. The key points are overlapping communication with computation, choosing communication groups according to the topology, and controlling the granularity of each communication. On the memory side, the core is paged key-value caching with block-level reuse, so different requests can share prefixes and avoid redundant computation.

    1. # Pseudocode: paged KV cache + prefix sharing
    2. block = kv_cache.alloc_block()
    3. if prefix_hash in cache_index:
    4. block.share_with(cache_index[prefix_hash])
    5. for layer in layers:
    6. out = layer(x, kv_block=block)
    7. comm_group.all_reduce_inplace(out, overlap=True)

    2.3 Scheduling: Continuous Batching and Preemption

    Production traffic is messy, with long and short requests mixed together. Continuous batching lets new requests slot into idle capacity at any time; chunked prefill for very long inputs prevents a single request from monopolizing the device; and when memory runs tight, requests are preempted or swapped out according to policy to protect tail latency.

    1. Per-step scheduling pseudocode:
    2. 1) Pull batchable requests from the waiting queue
    3. 2) Split long inputs into chunks and fill up to budget
    4. 3) Run the batched forward pass and sample new tokens
    5. 4) Move completed requests out and release KV blocks
    6. 5) If memory is insufficient, trigger preemption/swap-out and record metrics

    2.4 Long-Context Latency: Layered Optimization of TTFT and Throughput

    At 98K input length, the prefill phase determines time-to-first-token while the decode phase determines output speed. Handle them in layers: chunking and parallelism for prefill, batch merging and cache reuse for decode. In parallel, use a metrics dashboard to observe P50/P99 TTFT, single-stream speed, batch size, and memory watermark separately.

    3. Deployment Validation Checklist

    • Accuracy: build a layered regression suite covering short and long contexts plus boundary lengths.
    • Stability: run long-duration stress tests watching for memory fragmentation, communication timeouts, and degradation counts.
    • Observability: wire metrics, logs, and distributed tracing into standard monitoring and alerting.
    • Elasticity: combine a container platform with a message queue for queuing and scale-out, and use object storage for model and cache snapshots.

    4. The Baidu AI Cloud Perspective

    Baidu AI Cloud’s own technical practice emphasizes the same closed loop of “operators, communication, scheduling, observability”: inference services run on a general-purpose container platform, monitoring and alerting plus log services are used to locate tail latency, and object storage manages model versions. The core conclusion is identical: production-grade inference is systems engineering, and point optimizations must give way to end-to-end coordination.