Ryzen AI 7 350 NPUのピークTOPS達成原理

#Tech

本記事は、Ryzen AI 7 350に搭載されたNPUのTOPS(Tera Operations Per Second)の真の算出根拠と、そのピーク性能を達成するための技術的考察を解説している。

NPUは単なる推論アクセラレータではなく、行列乗算などの線形代数演算を処理するハードウェアアクセラレータである。

AMDのNPUはXilinx AI Enginesと本質的に共通しており、Ryzen AI 7 350は最新世代のAIE-MLv2(XDNA2)アーキテクチャを採用している。

AIE-MLv2は、インターフェース、メモリ、コンピュートタイルからなるタイルアレイ構造で構成されている。

このようにハードウェア構造を深く理解することは、アルゴリズムのボトルネック特定と効率的な最適化に不可欠である。

AMDの最新モバイルCPUに搭載されているNPU(Neural Processing Unit)の性能を深く掘り下げる解説記事が公開されました。特に、Ryzen AI 7 350に搭載されたNPUが謳う「50 TOPS」という数値が、具体的にどのようなハードウェア構成と実行条件で達成されるのかを検証しています。これは、AIアクセラレータの性能指標であるTOPSの真の意味を理解する上で非常に重要な視点を提供しています。

NPUの基本とTOPSの定義

NPUは、機械学習モデルの推論(Inference)を高速化するためのハードウェアアクセラレータです。TOPS(Tera Operations Per Second)は、その処理能力を示す一般的なマーケティング指標として使われます。ここでいう「オペレーション」とは、主にint8(8ビット整数)データ型における加算や乗算を指します。本記事では、Ryzen AI 7 350のNPUが50 TOPSと謳う根拠を、ハードウェアの実行ユニットや具体的な動作条件から解明しようとしています。単に数値を見るだけでなく、その裏側にあるアーキテクチャを理解することが目的です。

AMD NPUとXilinx AI Engineの関係性

AMDがCPUに搭載するNPUは、根本的にXilinxのAI Engine技術に基づいています。このため、低レベルな開発を行う上では、Xilinxのドキュメントやソフトウェアスタックが適用されることが多く、両者は非常に密接な関係にあると説明されています。XilinxはAI Engineを3世代(AI Engine、AIE-ML、AIE-MLv2)展開しており、AMDのNPUもこれに対応しています。例えば、Ryzen AI 300シリーズに搭載されているNPUはAIE-MLv2世代の技術を利用しているとのことです。

XDNA2 NPUのアーキテクチャ詳細

筆者は、自身のラップトップに搭載されているNPUがXDNA2(npu2)であり、これはAIE-MLv2(aie2p)のアーキテクチャを採用していると特定しています。このAIE-MLv2は、タイル(Tile)と呼ばれる計算ユニットの配列で構成されています。この配列には、システムとの接続を担うインターフェースタイル、データ処理のためのメモリタイル、そして実際の計算を行うコアタイルが含まれています。この構造を理解することで、NPUがどのようにして高い並列処理能力を発揮しているのかがわかります。

まとめ

本記事は、NPUの性能指標であるTOPSが、単なるカタログスペックではなく、特定のハードウェア構成と最適化されたアルゴリズムによって初めて達成されることを示唆しています。AIアクセラレータの真の能力を理解するためには、その基盤となるアーキテクチャへの深い洞察が必要であると言えるでしょう。

原文の冒頭を表示(英語・3段落のみ)

I have a Framework Laptop 13 that has a Ryzen AI 7 350 CPU that includes an NPU. I have started playing with this NPU to understand how to develop software for it. While NPUs are mainly intended as accelerators for inference of ML models, they are fundamentally hardware accelerators for matrix multiplication and other similar linear algebra operations, so they are also useful for signal processing and other compute applications, which is why I am interested in them. Another reason why I am interested in this NPU is that, as I will explain below, it is very similar to the AIE-ML v2 AI engine in Versal FPGA SoCs, so this laptop is a great platform to learn how to use this AI engine.

NPUs use the concept of TOPS (tera operations per second) as a high-level marketing figure of their capabilities. An operation is generally understood as an addition or multiplication for int8 data types, since the amount of parallelization that can be achieved depends on the datatype width. The NPU on the Ryzen AI 7 350 is marketed as a 50 TOPS NPU. The main goal of this post is to understand where this number comes from, in terms of hardware execution units and capabilities, understand under which conditions it can be reached, and write a small application that reaches this TOPS value.

I think this is a good way of gaining in-depth understanding about a compute architecture. Most typical real world use cases are going to be slower than this, because the algorithms will have bottlenecks that result in hardware underutilization. By understanding how the hardware needs to be used to reach peak performance, we have a better idea of the gaps of these algorithms and also how to rewrite the algorithms to reduce the gap if possible. In a post last year about NEON kernels on the ARM Cortex-A53 I worked in a similar way, by choosing a simple kernel to accelerate and by comparing performance benchmarks with the peak performance allowed by the hardware.

※ 著作権に配慮し、引用は冒頭3段落までです。続きは元記事をご覧ください。

元記事を読む ↗