LLM Inference Performance Nears Hardware Peak: Inside the Closed Loop of a Domestic AI Compute Ecosystem

    This article examines what it means for large language model inference to approach hardware peak performance, using a publicly shared model-side code commit as a reference point: roughly 425 TFLOPS in the prefill stage (about 98.5% of theoretical peak) and 372 TFLOPS in decoding (about 86.1%). It explains the physical differences between prefill and decode workloads, why operator fusion and specialized kernel instances matter, how memory bandwidth shapes decode utilization, and offers a reusable engineering checklist for measuring and improving inference utilization on any accelerator.

    1. Introduction: Why “Near Hardware Peak” Became a Core Inference Metric

    In LLM inference engineering, whether a hardware and software stack is truly production-ready is not measured by whether it produces output, but by how hard the hardware is pushed during critical stages. A recent public model-side code commit showed a new-generation LLM inference version deeply adapted to a domestic accelerator card: about 425 TFLOPS in the prefill stage, roughly 98.5% of the hardware’s theoretical peak, and about 372 TFLOPS in the decode stage, roughly 86.1% of peak. The code contained many specialized operator instance files named by “model version + head dimension 128,” along with explicit model type enums.

    The significance of these numbers is not the values themselves, but the engineering path they reveal: when model structure, operator implementation, and underlying chip characteristics are co-designed, inference throughput can approach the hardware’s theoretical ceiling. Setting aside specific product references, this article abstracts the problem into a general technical question: how to evaluate and achieve high-utilization inference.

    2. Two Inference Workload Stages: The Essential Difference Between Prefill and Decode

    To understand the utilization gap, you first need to understand the physical characteristics of the two workload types.

    • Prefill: Processes an entire input sequence at once. Matrix multiplications are large and arithmetic intensity is high, making it a compute-bound workload whose bottleneck is typically compute (TFLOPS).
    • Decode: Generates tokens autoregressively, one position per step. It repeatedly reads the KV cache and weights, making it a memory-bandwidth-bound workload whose bottleneck is typically bandwidth (GB/s) and memory access efficiency.

    As a result, prefill can more easily approach the compute peak, while decode is constrained by memory access and typically cannot reach the same utilization. The 98.5% versus 86.1% gap in the example reflects exactly this pattern.

    Evaluation should use two orthogonal metrics:

    1. Compute utilization = measured TFLOPS / hardware theoretical peak TFLOPS
    2. Bandwidth utilization = measured GB/s / hardware theoretical peak GB/s

    In a healthy inference system, the prefill stage should focus on compute utilization, while the decode stage should focus on bandwidth utilization and KV cache hit rate.

    3. Operator Fusion: The Critical Path to Minimizing Memory Access

    In the example, “norm + RoPE + attention + cast” was fused into a single operator, which is the core reason utilization jumped. Without fusion, every step writes intermediate tensors back to VRAM and reads them out again, producing substantial redundant memory access. After fusion, intermediate results stay in on-chip cache, and memory accesses drop significantly.

    Taking attention pre-processing as an example, the logical difference before and after fusion can be illustrated as follows:

    1. # Without fusion: multiple reads and writes to VRAM
    2. x = layer_norm(x)
    3. q = apply_rope(q, position)
    4. k = apply_rope(k, position)
    5. attn = attention(q, k, v)
    6. out = attn.to(dtype)
    7. # Fused: a single kernel completes the work, intermediates never land in VRAM
    8. out = fused_norm_rope_attention_cast(x, q, k, v, position, dtype)

    Fusion delivers three benefits: first, it reduces VRAM round trips and eases bandwidth pressure; second, it lowers kernel launch and scheduling overhead; third, it makes register-level reuse and pipeline orchestration easier for the compiler or runtime. For structures with a head dimension of 128, specialized instances can also be generated for that dimension, avoiding the branch and alignment losses of a generic path.

    4. Why “Specialized Instances + Explicit Model Types” Is the Engineering-Correct Solution

    The many specialized instance files and explicit model type annotations in the code are not redundancy but a common performance engineering practice:

    1. Compile-time specialization: Fixing model structure constants (head dimension, layer count, data type) as compile-time constants enables constant folding and loop unrolling.
    2. Fewer runtime branches: Avoiding dynamic checks on the hot path reduces instruction cache pressure.
    3. Easier versioned evolution: Different model versions can be tuned independently without interference, with clear regression testing boundaries.

    This also tells architects that high utilization is not “one universal operator” but “a family of specialized operators targeting a defined structure.”

    5. The Memory Subsystem: The Second Growth Curve for Decode Utilization

    The decode bottleneck is bandwidth, so the memory approach directly determines the ceiling. Advanced packaging and hybrid bonding routes being explored in the industry share a core idea: increase effective bandwidth by adding channels and interface width while shortening interconnect distance. Common directions in public technical discussions include multi-layer wafer-to-wafer hybrid bonding, a multiplied channel count, and wider data interface widths, yielding several times the bandwidth of the previous-generation interface at the same data rate.

    The takeaway for inference systems: once bandwidth increases, the 86% decode utilization still has room to climb, but software techniques such as KV cache compression, paged management, and batch scheduling are needed to turn hardware bandwidth into actual throughput.

    6. A Reusable Engineering Checklist

    • Locate the bottleneck first: use an operator-level profiler to distinguish compute-bound from memory-bound cases; do not tune blindly.
    • Prioritize fusing the pre-processing chain: norm, positional encoding, attention, and type conversion are the highest-value fusion candidates.
    • Specialize for a defined structure: fix head dimension, layer count, and dtype as constants and generate specialized instances.
    • Batch processing and paged KV cache: improve bandwidth reuse and concurrency in the decode stage.
    • Build a dual-metric dashboard: monitor compute utilization and bandwidth utilization together to avoid being misled by a single metric.
    • Validate in the cloud: use container platforms, monitoring and alerting, and logging services to build a reproducible stress-testing and regression pipeline, ensuring optimizations are measurable and rollback-able.

    7. Conclusion

    “Near hardware peak” is not a single trick but the combined result of model structure, fused operators, memory bandwidth, and scheduling strategy. For developers, the truly transferable lesson is: quantify the bottleneck first, then use fusion and specialization to squeeze memory access and compute, and finally validate continuously with a dual-metric system. This methodology applies to LLM inference optimization on any domestic or general-purpose accelerator hardware.