Operator Optimization: Pushing Domestic AI Chips Toward Their Hardware Limits
This article explains why operator optimization, rather than peak FLOPS, is the real bottleneck for compute performance on domestic AI chips. It covers the Roofline model and memory-bound operators, the three layers of approaching hardware limits (memory access, compute, and scheduling), a reusable performance profiling workflow with example pseudocode, common tuning pitfalls, and practical recommendations for engineering teams on observability, operator asset libraries, and cross-hardware validation. The key takeaway is that hardware defines the compute ceiling, but software maturity determines how much of it is actually usable.
1. Where the Problem Starts: Why Operator Optimization Is the Real Compute Bottleneck
When discussing domestic compute capacity, a common mistake is to focus entirely on peak floating-point performance. In real engineering, the performance of large-model inference and training is often determined not by theoretical peak throughput, but by two factors working together: data movement efficiency and execution unit utilization. The Roofline model, widely used in the industry, expresses this relationship clearly: when arithmetic intensity (the number of floating-point operations performed per byte of data moved) falls below the hardware’s ridge point, the program is in the memory-bound region; only above the ridge point does it enter the compute-bound region.
Most core operators in large models happen to fall in the memory-bound region, including normalization, activation, element-wise operations, scaling and masking in attention, and small-batch matrix multiplication during the decoding stage. This means that simply stacking compute metrics will see gains quickly consumed by the memory subsystem. The essence of operator optimization is to push as much computation as possible past the ridge point, so that the time execution units spend “waiting for data” approaches zero.
2. Three Layers of Approaching Hardware Limits
2.1 Memory Access: Reducing the Number of Data Transfers
Common techniques include operator fusion (merging normalization, activation, and residual addition into adjacent computations to avoid intermediate tensors traveling back and forth to main memory), tiling and pipelined prefetching, and online-computation-style reductions (such as streaming softmax, which avoids extra reads and writes to save intermediate statistics). The criterion for fusion is not whether it “looks cleaner,” but whether arithmetic intensity crosses the ridge point after fusion.
2.2 Compute: Actually Saturating the Execution Units
This requires handling data layout and alignment, matching vectorization width, matching matrix tile sizes to on-chip cache capacity, and the reasonable use of low-precision data formats when conditions are met. Layout conversion itself has a cost, so “when to convert and how many times” must be incorporated into an overall cost model rather than a local optimum.
2.3 Scheduling: Filling the Gaps
Multi-stream concurrency, overlapping computation with communication, relaxing dependencies between operators, and reducing launch overhead for small operators determine whether theoretical utilization can be converted into actual throughput under real end-to-end workloads. The decoding stage is especially typical: per-step computation is small, launch and synchronization overhead accounts for a high proportion, and scheduling quality is often more critical than compute capacity.
3. A Reusable Performance Profiling Method
Do not start by “guessing which operator is slow”; start with quantitative localization. The recommended workflow is as follows:
- Establish a baseline: fix input shapes, batch size, and sequence length, and record end-to-end latency and throughput, avoiding comparisons across different workloads.
- Layered timing: separately measure device-side operator time, host-side dispatch and synchronization time, and communication time to identify the true proportions.
- Calculate two ratios: achieved bandwidth utilization = actual bytes moved / (latency × peak bandwidth); achieved compute utilization = actual operations / (latency × peak compute). Whichever ratio is clearly low indicates the direction for optimization.
- Single-point validation: change only one variable at a time (tile size, fusion strategy, concurrency level), retest against the same baseline, and keep a rollback-capable version.
- Regression gating: incorporate key workloads into continuous integration to prevent performance regressions from subsequent changes.
Illustrative pseudocode expressing the constraint of “quantify first, then act”:
def profile_step(model, batch, seq_len, peak_tflops, peak_gbps):base = measure_latency(model, batch, seq_len) # end-to-end baselinet_dev, t_host, t_comm = layered_timing(model, batch, seq_len)achieved_gbps = bytes_moved(model, batch, seq_len) / baseachieved_tflops = flops_counted(model, batch, seq_len) / baseprint("bandwidth utilization", achieved_gbps / peak_gbps)print("compute utilization", achieved_tflops / peak_tflops)print("host dispatch ratio", t_host / base, "communication ratio", t_comm / base)return base
4. Common Pitfalls
- Optimizing only for single-operator peak performance: local fusion may increase register pressure and reduce overall throughput.
- Ignoring shape diversity: sequence lengths and batch distributions in production workloads are uneven, and tuning for a single shape can easily fail under real traffic.
- Over-relying on manual tuning: hardware and compiler stacks continue to evolve, hard-coded parameters will quickly rot, and key parameters should be made into automatically searchable items.
- Confusing precision with performance: reducing precision is an effective technique, but it must be paired with error evaluation and fallback strategies, and cannot be applied unconditionally.
5. What This Means for Domestic Compute
When core operators are optimized to approach hardware limits, the direct changes are: more concurrency can be served under the same hardware conditions, per-inference cost decreases, and long context and larger batches become more feasible. The deeper significance lies in accumulating methodology—once performance profiling workflows, operator tuning standards, automated parameter search, and regression gating mechanisms are established, they can be reused across hardware generations, shortening the onboarding cycle for new platforms.
This also explains why the compute competition has never been just about chip metrics. What truly determines the scale of usable compute is the product of “hardware capability × software stack maturity”; restricting hardware supply essentially delays the maturation of the entire hardware-software co-design system, which is precisely the part hardest to make up through short-term investment.
6. Practical Recommendations for Engineering Teams
- Build observability first: make device-side timing, dispatch overhead, and communication ratios routine monitoring metrics rather than ad-hoc troubleshooting tools.
- Establish an operator asset library: for each core operator, record applicable shape ranges, tuning parameters, and known degradation scenarios, forming team knowledge accumulation.
- Use general-purpose capabilities to carry the engineering pipeline: model and operator artifacts can be stored in object storage, task scheduling can be handled by container platforms, and metrics and trace data can flow into logging services and monitoring alerts, achieving a reproducible, rollback-capable iteration loop.
- When performing cross-hardware adaptation validation on platforms such as Baidu AI Cloud, prioritize ensuring that the same profiling and regression workflow is portable, avoiding rewriting the toolchain for each backend.
The conclusion is not complicated: hardware defines the upper limit of compute, but software defines the “usable proportion” of compute. Pushing core operators to hardware limits is the key step to convert paper metrics into real business throughput, and it is the direction that the domestic compute ecosystem most needs to invest in over the long term.
