LLM Inference on Heterogeneous Compute: Deep Adaptation Reaches 98.5% of Hardware Peak
This article examines how a well-known large language model was deeply adapted to a new generation of domestic heterogeneous compute chips, achieving 425 TFLOPS in Prefill—98.5% of theoretical peak—and 372 TFLOPS in Decoding, or 86.1% utilization. It explains why Prefill can approach hardware peak, how fused attention operators and dedicated instance files reduce memory traffic, why Decoding remains memory-bandwidth-bound, and what next-generation W2W hybrid-bonded HBM may change. It also outlines enterprise deployment practices on Baidu AI Cloud for heterogeneous scheduling, end-to-end monitoring, and memory-bandwidth tuning.
Introduction: Closing the Compute Ecosystem Loop Through Software-Hardware Co-Design
As large language models (LLMs) scale in both parameter count and context length, the imbalance between compute supply and demand and the memory bandwidth bottleneck have become increasingly prominent. In this context, improving per-GPU compute alone is no longer enough to meet efficient inference requirements. Deep software-hardware co-design—“software-defined, hardware-accelerated”—has become the key to breaking through.
Recently, a set of code commits in the open-source community attracted widespread attention. The official code repository of a well-known large model confirmed that its latest model version has achieved deep adaptation with a new generation of domestically developed heterogeneous compute chips, reaching up to 98.5% of hardware peak compute in the Prefill stage. This breakthrough marks that the ecosystem loop of “domestic LLMs + domestic compute chips” is being validated in code by a leading vendor.
1. Compute Adaptation Analysis: Performance Approaching Hardware Peak
In this adaptation practice, the most notable data point is that in the Prefill stage, compute throughput reached 425 TFLOPS, equivalent to 98.5% of the hardware’s theoretical peak. In the Decoding stage, throughput reached 372 TFLOPS, with 86.1% utilization.
1. Why can Prefill achieve such high utilization?
LLM inference is generally divided into two stages: Prefill and Decoding. The Prefill stage performs parallel computation over the input prompt and is a typical compute-intensive task. At this stage, matrix multiplication (GEMM) operations dominate and can easily saturate the underlying hardware’s compute units. Reaching 98.5% peak utilization means the chip’s compute array is pushed to its limit, and it also shows that the model structure and the hardware’s low-level instruction set are highly matched.
2. Bottlenecks and optimization in Decoding
In contrast, Decoding uses autoregressive generation and produces only one token at a time, making it a memory-bound task. At this stage, compute units are often starved, and performance is limited by memory bandwidth. Although 86.1% utilization is already a top-tier level in the industry, the gap from the Prefill stage also shows that memory access optimization remains a key focus for future technical work.
2. Core Technology: Fused Operators and Dedicated Instances
Details in the code repository updates reveal the technical logic behind the performance jump: the introduction of fused operators and dedicated instance files deeply customized for specific hardware.
1. Core operator fusion technology
This adaptation introduces fused operators at the attention mechanism level, fusing originally separate operations—Layer Normalization (LayerNorm), Rotary Position Embedding (RoPE), Attention computation, and data type conversion—into a unified low-level operator.
The core benefit of operator fusion is a significant reduction in memory access overhead. Without fusion, data must be frequently moved among registers, L2 cache, and HBM. With fusion, intermediate results can reside directly in on-chip cache and be computed in a pipelined manner. The pseudo-code logic is as follows:
# Traditional step-by-step computation logic (pseudo-code)x_norm = layer_norm(x)x_rope = apply_rope(x_norm, pos)attn_out = attention(q=x_rope, k=x_rope, v=x_rope)out = cast_type(attn_out)# Fused operator execution logic (pseudo-code)out = fused_attention_with_norm_rope_cast(x, pos)# The underlying hardware completes all operations through a single kernel launch
2. Dedicated instances and model markers
The code adds a large number of low-level assembly or intermediate representation instance files with specific marker suffixes and explicitly marks the model type. This approach shows that the model team did not limit itself to generic graph optimization strategies, but made fine-grained customizations for the hardware’s microarchitecture characteristics, such as instruction cycles of specific tensor cores and cache hierarchy sizes. This hard-coded level of adaptation is key to breaking through the performance ceiling of general frameworks.
3. Underlying Evolution: A Look Ahead to Next-Generation High-Bandwidth Memory (HBM)
Although operator fusion greatly improves compute efficiency, the bandwidth limitation in the Decoding stage remains a sword of Damocles. To fundamentally solve the memory wall problem, the industry is actively exploring next-generation high-bandwidth memory solutions.
According to disclosed industry technology roadmaps, a customized HBM solution is expected to be deployed within the next few years. The solution has the following breakthrough characteristics:
- Doubled architecture: A 64-channel design with 4,096 DQ data interfaces, providing 4x the bit width of current mainstream HBM3E solutions.
- Advanced packaging: Five-layer wafer-to-wafer (W2W) hybrid bonding. Compared with traditional chip-to-wafer bonding, W2W technology can further shorten interconnect length and reduce parasitic capacitance and resistance.
- Bandwidth leap: At the same data transfer rate, the solution’s available bandwidth can reach 4x that of existing HBM3E, greatly alleviating memory access pressure during long-sequence LLM inference.
4. Enterprise Deployment Practices: Building Efficient LLM Inference Services
For enterprise users and developers, understanding low-level hardware adaptation and storage evolution is ultimately about building cost-effective inference services in the cloud. In actual deployment, developers can use the infrastructure and cloud-native capabilities provided by Baidu AI Cloud to achieve agile deployment and performance tuning of LLMs.
1. Relying on a cloud-native platform for heterogeneous compute scheduling
Facing inference requests with different batches and workloads, enterprises can use Baidu AI Cloud’s Container Service Platform (CCE) together with elastic GPU resource pools to dynamically allocate compute. Compute-intensive Prefill requests can be scheduled to high-compute instances; long-tail Decoding requests can be combined with continuous batching to improve overall throughput.
2. Using end-to-end monitoring for bandwidth and compute tuning
After model deployment, through Baidu AI Cloud’s monitoring and alerting service and log service, developers can collect the latency distribution of the inference engine in real time. If Decoding latency is abnormal and monitoring metrics show memory bandwidth utilization has hit the ceiling, it can be judged as a memory access bottleneck. Developers can then consider memory optimization strategies such as KV Cache quantization and PagedAttention to trade space for time.
5. Summary and Outlook
From deep customization of fused operators to the breakthrough of 98.5% hardware peak, and to the next-generation W2W hybrid-bonded HBM solution waiting in the wings, LLM inference is evolving from single-point algorithm breakthroughs to full-stack software-hardware co-design. The closed loop of the domestic compute ecosystem is not only a guarantee for supply chain security but also a touchstone for technical depth.
In the future, with the mass production of higher-bandwidth storage and further automation of operator compilation technology, LLM performance on heterogeneous compute will see a new round of gains. Developers should closely follow low-level hardware characteristics, combine them with cloud infrastructure capabilities, and continue to explore the limits of inference efficiency, laying a solid technical foundation for the large-scale deployment of AI applications.
