跳到主内容
@wquguru
精选88SemiAnalysis(RSS)行业动态

AWS Trainium3推理性能与微架构深度解析

AWS Challenger: Trainium3 Inference and Microarchitecture Deep Dive

原文
发到 X
推荐理由

算力从业者必读,这篇用真实业务负载和底层微架构数据拆解了Trainium3如何挑战Nvidia,特别是关于带宽利用率和软硬件协同的细节非常有参考价值。

The Nvidia GPU was originally built to shade pixels, and every Nvidia generation since 2017 has bolted on another piece of AI-specific hardware to fix the bottleneck the previous one exposed. Volta added Tensor Cores, Hopper added TMA for tile data movement between HBM and SRAM, and Blackwell added Tensor Memory for accumulating. Nvidia removed many hardware units that are required to render graphics for their datacenter GPUs

Nvidia GPU 最初是为像素着色而构建的,自 2017 年以来的每一代 Nvidia 都添加了另一块特定于 AI 的硬件,以修复上一代暴露出的瓶颈。Volta 增加了 Tensor Cores(张量核心),Hopper 增加了 TMA 用于 HBM 和 SRAM 之间的图块数据移动,Blackwell 增加了 Tensor Memory(张量内存)用于累加。Nvidia 为其数据中心 GPU 移除了许多渲染图形所需的硬件单元

In comparison, the Trainium microarchitecture is built ground-up specifically for ML workloads, with tiles as a first-class primitive instead of having a sea of threads and then bolting on tensor/tile compute and data movement engines. Trainium3 behaves the way the physics says it should. In this past this meant software was a humongous challenge, but now no longer.

相比之下,Trainium 微架构是专为 ML 工作负载从头构建的,将图块作为一等公民的原语,而不是拥有一堆线程然后再外挂张量/图块计算和数据移动引擎。Trainium3 的行为符合物理定律所预期的方式。在过去,这意味着软件是一个巨大的挑战,但现在不再如此了。

Source: Dwarkesh Podcast

来源:Dwarkesh Podcast

7 months later, Trainium 3 and TPUs are live on InferenceX, both trading blows or even winning vs Nvidia GB300 in cost to generate tokens at TCO. We will dive into those details below.

7 个月后,Trainium 3 和 TPUs 已在 InferenceX 上线,在生成 token 的 TCO(总拥有成本)方面与 Nvidia GB300 互有胜负甚至胜出。我们将在下面深入探讨这些细节。

This advantage is not purely due to Amazon’s ultra low cost supply chain. It's also due to microarchitectural decisions, which we will dive into in this post. For example, using the Trainium Descriptor Generation Engines (DGE), the equivalent of Nvidia TMA and AMD MI455X TDM, our microbenchmarks show that Trainium can reach peak HBM bandwidth utilization (MBU) at small message sizes, which is not possible on Nvidia GPUs.

这一优势并非完全归因于亚马逊超低的供应链成本。它也源于微架构决策,我们将在本文中深入探讨。例如,使用 Trainium Descriptor Generation Engines (DGE),即 Nvidia TMA 和 AMD MI455X TDM 的等效物,我们的微基准测试显示,Trainium 可以在小消息尺寸下达到峰值 HBM 带宽利用率 (MBU),这在 Nvidia GPU 上是不可能的。

Furthermore, our testing covers cycle-level SRAM scratchpad latency and bandwidth testing (SBUF to PSUM), rack-scale bandwidth and latency microbenchmarks, attention exponential testing, and the precise cycle-level latency of different shapes, including how different attention head_dim (K) would affect the percentage of roofline.

此外,我们的测试涵盖了周期级的 SRAM 临时缓冲区延迟和带宽测试(SBUF 到 PSUM)、机架级带宽和延迟微基准测试、注意力指数测试,以及不同形状的确切周期级延迟,包括不同的注意力 head_dim (K) 如何影响屋顶线百分比。

Every result comes from UBenchX, our microbenchmark suite, and we model each unit from first principles before we measure it. We thank Nafea Bshara (Co-Founder of AWS Annapurna Labs), Ron Diamant (Trainium Chief Architect), Michael Shteinbok, Armin Ebrahim and the rest of their team for helping teach us their architecture and validate our benchmark experiments.

每个结果都来自 UBenchX,我们的微基准测试套件,我们在测量之前从第一性原理对每个单元进行建模。我们感谢 Nafea Bshara(AWS Annapurna Labs 联合创始人)、Ron Diamant(Trainium 首席架构师)、Michael Shteinbok、Armin Ebrahim 及其团队的其他成员,帮助他们向我们讲解其架构并验证我们的基准测试实验。

Star the InferenceX & UBenchX GitHub repository if you find the open-source benchmark and data useful! InferenceX is the only inference benchmark in the world to have TPUv7, OpenAI Jalapeño, Nvidia Rubin NVL72, AMD, and now, Trainium3.

如果您认为开源基准测试和数据有用,请给 InferenceX & UBenchX GitHub 仓库点个星!InferenceX 是世界上唯一一个拥有 TPUv7、OpenAI Jalapeño、Nvidia Rubin NVL72、AMD 以及现在的 Trainium3 的推理基准测试。

Source: SemiAnalysis

来源:SemiAnalysis

Trainium’s Superior Inference Performance per Dollar - AgentX

Trainium 的每美元优越推理性能 - AgentX

AgentX measures Trainium3 on a production end-to-end agentic inference workload. This is achieved by replaying real coding-agent sessions against a Trainium3 server. The goal is to compare accelerators’ realistic inference performance, that you may expect to see on actual agentic workloads.

AgentX 在面向生产环境的端到端智能体推理工作负载上对 Trainium3 进行了测量。这是通过对 Trainium3 服务器回放真实的编码智能体会话来实现的。目标是比较加速器在实际智能体工作负载中可能表现出的真实推理性能。

For those unfamiliar with InferenceX, the Pareto frontiers (curves) represent the fundamental inference tradeoff between throughput and latency. Each point is a different inference configuration targeting a different latency-throughput target. At each slice of the x-axis, higher perf per TCO is better and directly leads to higher inference gross margins.

对于不熟悉 InferenceX 的人,帕累托前沿(曲线)代表了吞吐量与延迟之间的基本推理权衡。每个点代表针对不同延迟-吞吐量目标的不同推理配置。在 x 轴的每个切片上,每单位总拥有成本(TCO)的性能越高越好,并直接带来更高的推理毛利率。

Today, we are excited to share that Trainium 3 PDS + vLLM achieves amazing perf/$ TCO across the entire frontier. In fact, it is better than every other accelerator besides Vera Rubin across the entire TCO versus p90 interactivity curve. This is an amazing achievement.

今天,我们兴奋地宣布,Trainium 3 PDS + vLLM 在整个前沿领域实现了令人惊叹的每美元 TCO 性能。事实上,除了 Vera Rubin 之外,它在整个 TCO 与 p90 交互性曲线上优于所有其他加速器。这是一项了不起的成就。

Source: SemiAnalysis

来源:SemiAnalysis

Trainium is also very competitive from an end-to-end latency perspective, across the entire curve. With that being said, there is still room for improvement, particularly with respect to TTFT.

从端到端延迟的角度来看,Trainium 在整个曲线上也极具竞争力。话虽如此,仍有改进空间,特别是在 TTFT(首块令牌生成时间)方面。

Source: SemiAnalysis

来源:SemiAnalysis

Source: SemiAnalysis

来源:SemiAnalysis

It is not surprising that Trainium lags behind in some p90 TTFT cases against GB300 as this metric is largely dictated by prefill, a compute bound operation. Trainium3 has only 17% the theoretical FP4 flops as Blackwell Ultra (2,517 TFLOPS versus 15,000 TFLOPS). It has more competitive interactivity since decode is memory bound and Trainium3 has 4.9 TB/s per chip against 8.0 TB/s for GB300, 61% of the bandwidth at about 30% the TCO. Also, pipelined prefill (which Trainium relies on, as discussed in the subsequent section) generally favors throughput over latency.

Trainium 在某些 p90 TTFT 案例中落后于 GB300 并不令人意外,因为该指标主要由预填充(prefill)决定,而预填充是一种计算密集型操作。Trainium3 的理论 FP4 浮点运算能力仅为 Blackwell Ultra 的 17%(2,517 TFLOPS 对比 15,000 TFLOPS)。其交互性更具竞争力,因为解码(decode)是内存密集型操作,而 Trainium3 每芯片带宽为 4.9 TB/s,GB300 为 8.0 TB/s,即带宽占比约为 61%,但 TCO 仅为其约 30%。此外,流水线预填充(如后文所述,Trainium 依赖于此)通常更倾向于吞吐量而非延迟。

In fact, at a p90 interactivity of 135 tok/s/user (a typical speed you’d observe on OpenRouter), Trainium3 with vLLM yields the highest profit margin at 73.5%, compared to runner up GB300 + SGLang at 53% (at 3 year rental prices). This assumes Z.ai list price for token pricing and a 60% hardware fleet utilization factor.

事实上,在 p90 交互性为 135 tok/s/user(这在 OpenRouter 上是典型的速率)时,配备 vLLM 的 Trainium3 实现了最高的利润率,达到 73.5%,而亚军 GB300 + SGLang 的利润率为 53%(按三年租赁价格计算)。这假设了 Z.ai 的代币定价列表价以及 60% 的硬件集群利用率因子。

Trainium3 achieves these margins with 144GB of HBM per chip, half GB300’s capacity per GPU. This reflects our Short King thesis: additional HBM capacity must deliver enough extra throughput at the target latency to justify its cost. This is also why 4-Hi is attractive industry wide option and next generation accelerators are primarily using 8-Hi.

Trainium3 凭借每芯片 144GB 的 HBM 实现了这些利润率,仅为 GB300 每 GPU 容量的一半。这反映了我们的“Short King”论点:额外的 HBM 容量必须在目标延迟下提供足够的额外吞吐量,以证明其成本的合理性。这也是为什么 4-Hi 成为行业范围内具有吸引力的选项,且下一代加速器主要采用 8-Hi 的原因。

Source: SemiAnalysis

来源:SemiAnalysis

What makes these results interesting for this article is how directly the software follows the hardware we measure in Section 2. Prefill and decode run on separate nodes, and each arranges the same 16 chips to suit the topology.

使这些结果对本文有趣的原因在于,软件如何直接遵循我们在第 2 节中测量的硬件。预填充(Prefill)和解码(Decode)运行在独立的节点上,每个节点都根据拓扑结构排列相同的 16 个芯片。

Prefill

预填充(Prefill)

A quick primer for this section: a Trainium3 chip has 8 NeuronCores, each pair sharing one HBM stack, and a node is 16 chips. Section 2 covers the hardware in detail. For a more in depth analysis, see our Trainium3 deep dive article.

本节快速简介:一个 Trainium3 芯片拥有 8 个 NeuronCore,每对核心共享一个 HBM 堆栈,而一个节点包含 16 个芯片。第 2 节详细介绍了硬件情况。如需更深入的分析,请参阅我们的 Trainium3 深度解析文章。

Source: SemiAnalysis

来源:SemiAnalysis

A prefill node is a pipeline. The model’s layers are cut into 16 stages, one chip per stage, and a chunk of prompt tokens flows from chip to chip. Inside a stage, the chip’s 8 NeuronCores split the chunk between them, so all of the stage’s tensor and expert parallelism stays on one chip.

预填充节点是一个流水线。模型的层被切割成 16 个阶段,每个阶段对应一个芯片,提示词 token 块依次流经各个芯片。在一个阶段内部,芯片的 8 个 NeuronCore 将 token 块分配给它们,因此该阶段的所有张量并行和专家并行都保留在一个芯片上。

This is the layout our collective benchmarks argue for. Chip-level collectives were well ahead of every wider group we tested, and all-to-all, the pattern MoE layers need, is slower once it leaves the chip. With the heavy exchanges kept on one chip, what limits a stage is TensorE, which is where the MXFP4 matmul modes covered below do their work.

这是我们的集体通信基准测试所支持布局。芯片级集体通信远远领先于我们测试的所有更广泛的组别,而一旦离开芯片,MoE 层所需的 all-to-all 模式就会变慢。由于大量的数据交换保留在一个芯片上,限制一个阶段的瓶颈是 TensorE,这正是下文涵盖的 MXFP4 矩阵乘法模式发挥作用的地方。

Decode

解码(Decode)

Source: SemiAnalysis

来源:SemiAnalysis

For decode, one copy of the model is spread across individual ranks on all 128 NeuronCores (across 16 chips), and every core takes part in the computation for each token. For those familiar with Nvidia architecture, each GPU is typically a separate rank whereas Trainium treats all 128 cores as logical devices and separate EP ranks. In the case of multi-user GLM-5.3, this assigns two routed experts per NeuronCore. Decode runs at LNC=1, so each physical NeuronCore is its own rank, whereas the rest of this article uses the default LNC=2.

对于解码过程,模型的一个副本分布在所有 128 个 NeuronCore(跨越 16 个芯片)上的独立等级(ranks)上,每个核心都参与每个 token 的计算。对于熟悉 Nvidia 架构的人来说,每个 GPU 通常是一个独立的等级,而 Trainium 将所有 128 个核心视为逻辑设备和独立的 EP 等级。在多用户 GLM-5.3 的情况下,这为每个 NeuronCore 分配了两个路由专家。解码运行在 LNC=1 模式下,因此每个物理 NeuronCore 都是其自己的等级,而本文其余部分使用默认的 LNC=2。

Again, each NeuronCore is its own device with local HBM, so nothing synchronizes across the chip unless the software invokes a collective. Nvidia added locality domains in CUDA 13.4 to pin Rubin kernels to one die’s memory in the same way.

同样,每个 NeuronCore 都是一个拥有本地 HBM 的独立设备,因此除非软件调用集体通信操作,否则芯片之间不会进行同步。Nvidia 在 CUDA 13.4 中添加了局部性域(locality domains),以类似的方式将 Rubin 内核固定在一个晶粒(die)的内存中。

Source: SemiAnalysis

来源:SemiAnalysis

Not every exchange spans the node though. Decode declares nested groups of cores: half a chip, one chip, the two chips of a tray, two trays, half the node, and the whole node, plus a second family that takes the same core position on every chip. The smaller exchanges, such as the dense layers and the shared expert, can run on the small groups. A group of 8 is one chip and a group of 16 is one tray, whose two chips share a direct link, so those exchanges never touch a switch. But activations are gathered across all 128 cores and the expert outputs are reduced across all 128, so that traffic crosses the switch on every layer.

然而,并非所有交换都跨越整个节点。Decode 声明了核心的嵌套分组:半个芯片、一个芯片、托盘上的两个芯片、两个托盘、半个节点以及整个节点,另有一个第二家族在每个芯片上采用相同的核位置。较小的交换(如密集层和共享专家)可以在小分组上运行。8个核心为一组对应一个芯片,16个核心为一组对应一个托盘,其两个芯片之间通过直连链路通信,因此这些交换从不经过交换机。但激活值需在所有128个核心上收集,专家输出需在所有128个核心上归约,因此每层的流量都会穿过交换机。

Trainium Profiler Fine-grain Accuracy - Better Than Nvidia and AMD

Trainium Profiler 细粒度精度 - 优于 Nvidia 和 AMD

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件