Maximizing Compute Utilization on Domestic AI Accelerators: A Fusion-Based Optimization Practice

    This article examines how core operators on domestic AI accelerators are approaching hardware theoretical limits, and why further gains from single-operator tuning are diminishing. It explains how to use MFU to identify bottlenecks, how the bottleneck shifts from compute to memory access and small surrounding operations, and how expanding operator fusion can unlock new performance gains. Readers will find a reusable tuning loop covering baseline setup, layered profiling, structural changes, fusion, regression validation, and reuse, along with the broader significance for the domestic compute ecosystem.

    1. The Signal: Core Operators Are Closing In on Hardware Limits

    As domestic accelerators and their supporting software stacks mature, a notable engineering pattern has emerged: the core operators in some high-performance computing libraries now run close to the theoretical peak of the hardware. For matrix multiplication and attention-style operators, public optimization work shows that compute utilization in the prefill stage can be pushed from around 95% to 97%, 98%, or even 98.5%.

    The point is not the fight over a single decimal place. It is the signal these numbers send: the “easy gains” at the operator level are nearly exhausted, and continuing to make incremental tweaks along the same technical path yields rapidly diminishing returns. When multiple teams use different tiling strategies and scheduling approaches yet all independently approach the same ceiling, that ceiling is determined by the hardware architecture rather than being an accidental result of one particular implementation technique.

    2. Measure First: Use MFU to Tell Whether You Have Hit the Limit

    To judge whether optimization has peaked, you need a trustworthy metric first. A common approach is to compare measured throughput against theoretical peak, using a metric such as Model FLOPs Utilization (MFU). The calculation can be simplified as:

    1. MFU ≈ effective measured FLOPs / (theoretical peak compute × actual elapsed time)

    Three details are easy to get wrong when using this metric:

    • The numerator must be “effective compute.” Padding, invalid tokens, and redundant computation must be excluded, or the metric will be inflated.
    • The denominator must distinguish data types and sparse vs. dense modes, since peak values differ significantly across precisions.
    • Statistics must be collected per stage. The prefill stage is constrained by compute density, while the decode stage is constrained by memory bandwidth; their bottlenecks are entirely different.

    When MFU enters the 90%+ range, the compute units are nearly saturated. Further optimizing a single operator at that point usually just shuffles overhead between data movement and synchronization in a zero-sum way.

    3. Bottleneck Migration: Why Single-Operator Optimization Runs Dry

    Diminishing returns from single-operator optimization come from a shift in the bottleneck. In a typical inference pipeline, the time is often consumed not by the one large matrix multiplication, but by several “small actions” around it:

    1. Tensor layout conversion and reordering, repeatedly moving data to align with the hardware’s memory access granularity;
    2. Low-compute-density steps such as elementwise operations, normalization, activation, scaling, and masking;
    3. In attention computation, mask construction, positional encoding application, and statistic updates;
    4. Multiple kernel launches and round-trip reads/writes of intermediate results, creating substantial bandwidth waste;
    5. In distributed settings, communication and computation that are not sufficiently overlapped.

    Each of these looks insignificant on its own, but together they can account for a considerable share. Improving an already highly optimized matrix multiplication by another percentage point is extremely hard; merging three or five fragmented steps, however, can often deliver multiples of the gain. This is what “low-hanging fruit” really means.

    4. The Way Forward: Expanding Fusion Scope Is the New Growth Curve

    The essence of fusion is to keep data in on-chip high-speed cache as much as possible, performing multiple steps with a single read-in and reducing round trips and launch overhead. It is worth stressing that fusion is not limited to the common matrix multiplication and attention operators; a large middle ground can be brought in:

    • Fuse normalization with the subsequent linear transform and activation function;
    • Fuse positional encoding application with the scaling and masking before attention scoring;
    • Fuse the temperature adjustment, reordering, and filtering logic in the sampling stage;
    • In the decode stage, combine statistic updates with output projection to reduce memory accesses;
    • On the training side, fuse gradient scaling, clipping, and parameter updates by block.

    An illustrative before/after comparison of fusion:

    1. Before fusion: GEMM → write back → read in → normalization → write back → read in → activation → write back
    2. After fusion: [GEMM + normalization + activation] single read-in, done on-chip, single write-back

    A caveat: more fusion is not always better. Register and on-chip cache capacity are limited, and over-fusion raises occupancy pressure and lowers parallelism, which can slow things down overall. The sensible approach is “moderate fusion” around the bottleneck, validated with measured data on the net gain of each step.

    5. Engineering Method: A Reusable Tuning Loop

    To put these ideas into practice, adopt the following loop:

    1. Establish a baseline: fix input size and precision, and record throughput, latency, and MFU;
    2. Profile in layers: separate compute-bound from memory-bound, and locate where time is actually spent;
    3. Restructure: adjust tile sizes, data layout, and pipeline scheduling so memory access aligns with hardware granularity;
    4. Expand fusion: prioritize fragmented steps with low compute density and high call frequency;
    5. Regression validation: watch for numerical consistency and avoid precision drift introduced by fusion;
    6. Consolidate and reuse: abstract stable implementations into general components that upper-layer models can call directly.

    In real production environments, this loop typically relies on a container platform to fix the environment, on monitoring, alerting, and logging services to collect metrics, and on object storage to keep baseline data and versioned artifacts, ensuring the optimization process is reproducible and comparable.

    6. What This Means for Domestic Compute

    Multiple independent teams approaching the hardware ceiling simultaneously under different implementation paths delivers value on three levels. First, it validates that domestic accelerator hardware and its supporting software stack are mature enough to carry large-scale training and inference, and that the hardware-software co-design engineering paradigm is proven. Second, it shows the real gap is shifting from “can it compute” to “can every bit of compute be fully used,” bringing the focus back to engineering fundamentals. Third, open source and open sharing let methodology spread quickly, so newcomers need not repeat the same mistakes, accelerating the ecosystem’s overall iteration.

    For developers, the most practical takeaway is: do not bet all your attention on core operators that are already optimized to the extreme. Instead, first build a complete bottleneck profile and capture the gains from fusion and layout changes. Once MFU enters the high range, the outcome often hinges on how cleanly those seemingly trivial steps are handled.