Core Operator Optimization to Hardware Limits: Lessons for Domestic AI Compute

    This article explains why optimizing core operators to hardware limits matters more than merely getting models to run on domestic accelerators. It breaks down compute, memory, and communication bottlenecks; identifies high-value operator categories; and presents a roofline-based engineering workflow for profiling, shape-specific tuning, fusion boundaries, communication overlap, precision regression, and reusable components. It also discusses implications for the domestic compute supply chain and common pitfalls in production deployment.

    Why “Approaching Hardware Limits” Matters More Than “Functional Correctness”

    Domestic accelerators entering large-model production environments usually pass through three stages: interface compatibility, functional correctness, and acceptable efficiency. The first two only show that the software stack can map a computation graph onto the device; the third determines per-card throughput, cluster cost, and delivery cycles. Optimizing core operators to hardware limits does not mean marketing-level “faster.” Under the roofline model, it means compute-intensive operators achieve effective compute close to chip peak, memory-intensive operators achieve effective bandwidth close to memory or on-chip cache bandwidth, and communication-intensive operators achieve effective throughput close to interconnect bandwidth, while numerical error, stability, and reproducibility remain acceptable.

    For the industry, this step matters more than isolated benchmark scores. Only when utilization improves can equivalent compute support larger contexts, higher concurrency, and lower cost per token. Only when the toolchain is reusable can later teams avoid rewriting every operator from scratch. Progress in homegrown compute therefore appears as a continuous curve: first make the inference path work, then open up base components, then get supernodes and multi-machine communication running smoothly, and only then discuss whether native training deserves scaled investment. No one can skip the three foundations of operators, memory, and communication.

    What Determines Hardware Limits

    Before discussing limits, it is necessary to distinguish bottleneck types. The peak advertised by an accelerator is usually theoretical multiply-add throughput for a certain data type and tensor shape. Real models rarely stay at that sweet spot.

    On the compute side, matrix multiplication, convolution, and some linear layers after normalization are constrained by tensor core or matrix unit utilization. Block size, alignment, pipeline depth, and instruction issue determine whether the compute array can be fed. When shapes are irregular, batches are too small, or there are too many tail blocks, theoretical peak quickly becomes misleading.

    On the memory side, attention, elementwise operators, embedding lookup, and large numbers of intermediate activations are more bandwidth-bound. The hierarchy includes registers, on-chip cache or shared memory, high-bandwidth memory, and host memory. If an operator repeatedly writes and reads the same block of data, time is spent on the bus rather than on multiply-add units. Fusion, recomputation, and tiling are essentially ways to reduce cross-level movement.

    On the communication side, tensor parallelism, expert parallelism, and pipeline parallelism turn a single-card problem into a cluster problem. Collective communication startup overhead, message size, topology hops, and compute-communication overlap determine scaling efficiency. Even with strong inter-card interconnect, if software still uses synchronous barrier-style calls, effective bandwidth will be far below the nominal value.

    Therefore, “optimized to the limit” should report data type and shape, batch and sequence length, whether communication is included, numerical format, and two utilization ratios—relative to peak and relative to bandwidth—rather than only an end-to-end speed number.

    Which Core Operators Are Worth Tuning

    Hot spots in large-model inference and training are highly concentrated. The usual priority order is as follows.

    Matrix multiplication and grouped matrix multiplication. These are the main body of linear layers and expert networks. The key is to match tiling and data layout to the hardware’s optimal tile, handle unaligned tail blocks, and control accumulation precision under low-precision formats. During inference, weight residency and prefetching must also be considered to avoid moving weights again at every step.

    Attention and long-sequence memory access. If scores, softmax, and value-vector weighting are split into multiple round-trip kernels, intermediate matrices can blow up high-bandwidth memory. Fused implementations keep tiled attention on chip and write only the final result, turning long context from “memory explosion” into “computable.” Masks, variable-length sequences, and paged cache break regular memory access and require dedicated scheduling rather than applying dense matrix multiplication templates.

    Collective communication and compute overlap. Multi-card inference needs to overlap partial reductions, dispatch, and local compute on the same timeline. If communication primitives can only synchronize in whole blocks, the scaling curve flattens early. Splitting large messages into pipeline chunks and hiding startup latency is a prerequisite for supernodes to exploit interconnect capability.

    Memory management and kernel launch. When there are too many small operators, launch overhead and synchronization points dominate latency. Graph-level fusion, persistent kernels, and reasonable workspace reuse often affect first-token and tail latency in online serving more than squeezing out a few more percentage points of multiply-add utilization.

    None of these directions depends on vendor-specific terminology. Any accelerator with matrix units, hierarchical memory, and inter-card interconnect has a similar optimization problem structure; differences lie only in tile sizes, alignment constraints, and the concrete form of communication primitives.

    From Roofline to an Engineering Loop

    A repeatable process can be used instead of relying on hand-written kernels from a few experts.

    Step one: establish a roofline baseline. For the target data type, measure large matrix multiplication close to peak, as well as bandwidth-sensitive streaming copy or elementwise kernels, to obtain the machine’s “compute roof” and “bandwidth roof.” Every subsequent business operator falls between these two lines, which helps determine whether the issue is algorithmic or implementation-related.

    Step two: cluster by shape rather than optimizing by model name. In online traffic, hidden dimensions, head counts, expert counts, and sequence buckets form a finite set. Preparing dedicated kernels for high-frequency buckets and using generic implementations for long-tail shapes is usually closer to the limit than pursuing one universal kernel.

    Step three: fusion needs boundaries. Fusion reduces memory access and launch overhead, but it reduces debuggability and portability. It is better to fuse only fragments with short data dependencies and high reuse, and to keep numerical comparisons for each fused kernel: maximum error against a high-precision reference implementation, overflow ratio, and stability on specific inputs. If limit optimization breaks training convergence or inference consistency, it is not complete.

    Step four: put communication into the same profiling setup. Record compute time, exposed communication time, and non-overlappable portions. If exposed communication consistently accounts for a high share, adjust parallel partitioning or message chunking rather than continuing to tune compute that is not being used.

    Step five: freeze results into regression-ready components. What is open-sourced or shared internally should not be scattered patches; it should include build methods, supported data types, known shape ranges, performance baseline tests, and accuracy tests. Ecosystem diffusion depends on others being able to reproduce results on their own business graphs, not on watching a demo.

    A simple self-check logic can be used: for each hot operator, record measured throughput, roofline ratio, peak error, and regression cases. When the ratio remains below expectation, first check layout and tail blocks, then check fusion boundaries, and only then consider changing the parallel strategy. This avoids treating “it feels faster” as completed optimization.

    What It Means for the Domestic Compute Supply Chain

    First, software utilization becomes a multiplier on capacity. Chip expansion solves supply quantity; operator and communication stacks determine how much effective token throughput or effective training steps each unit of supply can convert into. During capacity ramp-up, fully using existing devices often has a more direct impact on whether business can migrate than waiting for next-generation hardware.

    Second, open-source base components change how collaboration works. If adaptation work remains inside individual business loops, the ecosystem fragments: every team repeatedly solves alignment, fusion, and communication overlap. Sharing business-agnostic low-level operators, memory pools, and communication wrappers allows later teams to put manpower into scheduling strategies and model structures. Sharing will of course encounter capability and commercial boundaries; it is not rare for some implementations to remain closed source temporarily. The key is that components on the critical path gradually become reusable, rather than requiring everything to be public at once.

    Third, inference first and training later fits engineering reality. The shape of the inference path is relatively stable, weights are read-only, and optimization gains quickly show up in serving cost. Training also faces optimizer states, activation recomputation, failure recovery, and long-duration numerical drift, placing higher demands on software maturity and cluster stability. A more prudent path is to first make utilization and multi-machine scaling solid on the inference side, then validate training reproducibility with smaller models, and then gradually increase model and cluster scale. Understanding “whether the next-generation model will be fully trained on domestic compute” as a stage result on the roadmap, rather than a precondition, is more consistent with industry rhythm.

    Fourth, anticipating external constraints changes the timetable for technology selection. When there is supply uncertainty for advanced devices and software ecosystems, accumulating operator, compiler, and parallelism experience on domestic accelerators early is risk hedging, not a slogan. This accumulation cycle is measured in quarters or even years; concentrated tool releases are often only the visible part of long-term work.

    Fifth, capacity and software must be examined together. Even if per-card efficiency approaches the upper limit, if supply is insufficient to support the training window or inference peak of a target model, the business still needs hybrid deployment, phased migration, and capacity planning. Reservations about capacity and recognition of software progress can coexist: efficiency proves “worth using,” while supply determines “can be used on schedule.”

    Common Pitfalls in Team Deployment

    Treating the compatibility layer as the performance endpoint. A framework running successfully only shows that semantics are correct; default kernels are often far from the roofline. Before launch, profiling should be done by real traffic buckets, not only by official example shapes.

    Optimizing only compute and not the serving system. After kernels become faster, scheduling queues, KV cache fragmentation, batching strategies, and host-side copies may still dominate latency. Hardware limits are device-side upper bounds; service-level agreements look at end-to-end performance.

    Using incomparable numbers for decisions. Different data types, whether communication is counted, and whether sampling and post-processing are included all make “close to the limit” meaningless. Comparisons must lock down the workload definition.

    Ignoring precision and fallback paths. Low precision and aggressive fusion require canary rollout and fast rollback. Limit kernels should be switchable back to conservative implementations by shape or version, so that one numerical issue does not block the entire cluster.

    Compressing ecosystem expectations into a single project. The homegrown supply chain is a multi-point collaboration among chips, packaging, interconnect, compilers, operator libraries, and model teams. Open-sourcing or optimization in any one link deserves recognition, but it cannot replace sustained investment in the others.

    Conclusion

    Core operators reaching hardware limits mark the transition of domestic accelerators from functional validation to efficiency competition: compute, bandwidth, and interconnect are no longer largely idle; base components begin to be reusable by others; and inference scaling and training trials gain a measurable foundation. It cannot automatically solve capacity, toolchain completeness, or model-side algorithm problems, but it shows that progress in homegrown compute can be measured, shared, and amplified step by step. For engineering teams, the next step is not to chase slogans, but to establish roofline baselines, optimize hot operators by real shapes, bring communication and precision into the same regression suite, and plan the migration rhythm for inference and training under capacity constraints.