Operator Optimization Pushing Domestic AI Chips to Their Hardware Limits
This article explains what it means to optimize core operators to the hardware limits of a domestic AI accelerator, why large model performance depends on a small set of operators, and how to locate bottlenecks with a four-layer model and the roofline method. It covers general optimization techniques such as tiling, operator fusion, data layout, mixed precision, parallel strategies, and auto-tuning, along with an evaluation framework for proving near-limit performance and a practical checklist for reproducible optimization.
1. What It Means to Optimize Operators to the Hardware Limit
When an engineering team announces that it has optimized several core operators to the hardware limit of a domestic AI accelerator, what is actually validated is not a single benchmark score but a complete engineering capability to squeeze every bit of the hardware specification. The hardware limit usually refers to several observable upper bounds:
- Compute bound: determined by peak compute throughput (for example, the number of multiply-accumulate operations per cycle multiplied by clock frequency);
- Bandwidth bound: determined by memory bandwidth and on-chip cache bandwidth;
- Cache and occupancy bound: determined by on-chip storage capacity, register file size, and shared memory size;
- Interconnect bound: determined by inter-card and inter-node communication bandwidth and topology.
If an operator reaches a high percentage of the theoretical peak in one of these dimensions, the implementation is already close to the physical ceiling of that dimension. If multiple core operators achieve this at the same time, it means a stable loop has formed among the toolchain, library implementations, compiler optimizations, and hardware features. That is the real technical substance of such an announcement.
2. Why Large Model Performance Is Decided by a Few Operators
The computation graph of a mainstream large model may contain hundreds or thousands of operators, but the time is highly concentrated. Typical hotspots include:
- Matrix multiplication: fully connected layers, projections and scoring in attention, and grouped matrix multiplication in expert networks;
- Normalization and element-wise operations: layer normalization, activation functions, and residual addition;
- Attention operations: masking, softmax, and fused operators that combine scoring and value retrieval;
- Communication: collective communication in tensor parallelism and pipeline parallelism;
- Sampling and decoding: key-value cache management and incremental computation in autoregressive generation.
These operators share one characteristic: their computational intensity varies enormously. Matrix multiplication is compute-intensive, normalization and activation are memory-intensive, and communication is sensitive to bandwidth and latency. A uniform optimization strategy will inevitably trade one aspect for another, so the operators must be handled by category.
3. A Four-Layer Bottleneck Model: A Coordinate System for Locating Problems
Developers are advised to build a four-layer coordinate system to locate performance problems:
- Layer 1, compute bound: high arithmetic intensity, performance constrained by peak compute;
- Layer 2, memory bound: low arithmetic intensity, performance constrained by bandwidth;
- Layer 3, latency bound: insufficient parallelism, large launch overhead, or long dependency chains;
- Layer 4, communication bound: cross-card and cross-node synchronization waits, or topology mismatch.
The roofline model is a general tool for deciding which layer applies: compare the operator’s arithmetic intensity (floating-point operations per byte of memory traffic) with the hardware’s peak-compute-to-peak-bandwidth ratio. Points to the left of the ridge are memory-bound; points to the right are compute-bound. Illustrative code:
def roofline(flops, bytes_moved, peak_flops, peak_bw):intensity = flops / max(bytes_moved, 1)ridge = peak_flops / peak_bw # hardware ridge pointattainable = min(peak_flops, intensity * peak_bw)bound = "compute" if intensity >= ridge else "memory"return intensity, attainable / peak_flops, bound
4. General Methodology for Optimizing Core Operators
4.1 Tiling and Multi-Level Storage Coordination
Splitting a large matrix multiplication into tiles that fit on-chip storage, so that data movement drops from O(n^3) to roughly O(n^3 / cache capacity), is the fundamental way to raise arithmetic intensity. Tile sizes must account for on-chip capacity, register pressure, and parallelism at the same time, and are usually obtained through parameterized templates plus auto-tuning search.
4.2 Operator Fusion to Cut Memory Round Trips
Element-wise operators and normalization are the most likely to become memory-bound. Fusing activation, bias, residual, and normalization into the epilogue of the upstream matrix multiplication can significantly reduce writes and reads of intermediate tensors. The criterion for fusion is simple: if an intermediate tensor is consumed by only one downstream operator, consider fusing it in place.
4.3 Data Layout and Vectorized Access
Layout determines memory access efficiency. Common techniques include making consecutive threads access consecutive addresses, placing the channel dimension first or last to match the hardware access granularity, and using vectorized load and store instructions. Layout conversion itself has a cost and should be done once during weight preprocessing rather than repeatedly at runtime.
4.4 Low Precision and Mixed Precision
Using lower-bit data types when precision is under control both increases the effective data volume per unit of bandwidth and enables higher-throughput instructions. In engineering practice, a mixed strategy of low-precision compute, high-precision accumulation, and preserved precision at critical positions is common, with end-to-end task metrics rather than single-operator error serving as the acceptance criterion.
4.5 Parallel Strategies and Scheduling
- Data parallelism raises throughput, tensor parallelism splits computation within a layer, and pipeline parallelism splits dependencies across layers;
- Overlapping computation and communication is key to efficiency, so communication must be completed in the shadow of computation;
- In the autoregressive decoding stage, memory-intensive incremental computation and cache management should be handled together to avoid kernel launch overhead dominating the time.
4.6 Auto-Tuning and Continuous Regression
Handwritten tuning cannot cover every shape combination. A practical approach is to build a parameter search space, use measured latency as the objective function for auto-tuning, and turn the results into a regression performance baseline to prevent regressions in later versions. Illustrative pseudocode:
for shape in workload_shapes:best = Nonefor tile, stages, vector in search_space(shape):t = bench(build_kernel(tile, stages, vector), shape)best = min(best, t) if best else tbaseline[shape] = best # added to the performance regression gate
5. Evaluation Framework: How to Prove Near-Hardware-Limit Performance
A rigorous evaluation contains at least five parts:
- Theoretical peak calculation: derive compute and bandwidth upper bounds from public specifications to obtain the achievable percentage;
- Shape coverage: cover typical and extreme shapes in both training and inference;
- Precision validation: compare error distributions against a high-precision reference implementation rather than looking at a single error point;
- End-to-end validation: use throughput and latency of the complete model task as the final metrics;
- Stability and regression: long-duration stress testing, performance gates, and traceable changes.
Only when all five are in place is “approaching the limit” a reproducible engineering conclusion rather than a one-off demonstration.
6. Deeper Significance for an Independent Compute Ecosystem
Early alternatives were often constrained by ecosystem adaptation costs: missing operators, inconsistent precision, and heavy migration work. When core operators are systematically optimized to near the hardware limit, the changes are structural:
- Better usability: mainstream models can achieve usable performance without major changes, and migration costs drop significantly;
- Changed bargaining position: performance is no longer the weak point, so the selection criteria return to cost, supply, and scenario fit;
- A positive feedback loop: larger application scale drives toolchain improvement, and a better toolchain lowers migration costs for the next round;
- Stronger supply security: diversified supply shifts compute planning from single-point dependence to composable options.
It should be stated objectively that a single-card operator limit does not equal cluster efficiency. In large-scale training, communication share, fault recovery, and scheduling efficiency are often what determine overall utilization, and these remain directions for continued investment.
7. A Practical Checklist
- Measure before optimizing: use profiling tools to confirm hotspots and the bottleneck layer instead of refactoring on intuition;
- Establish dual baselines for performance and precision, and require every optimization to pass the regression gate;
- Prioritize high-return fusion and layout changes before moving to low precision and parallel strategies;
- Turn tuning results into templated, parameterized reusable assets rather than one-off scripts;
- In a cloud platform environment, container platforms can be used to freeze the environment, object storage can hold datasets and artifacts, and logging and monitoring with alerting can track long-term stability, making the optimization process reproducible and observable.
8. Conclusion
Pushing multiple core operators to the hardware limit is essentially a public test of hardware-software co-design capability: it shows that bottlenecks can be broken down layer by layer and solved item by item. For developers, what is worth taking away is not a particular number but the transferable methodology of four-layer bottleneck localization, tiling and fusion, auto-tuning, and dual-baseline regression. For the industry, this is a key step for independent compute moving from usable to genuinely good.
