Visual Matrices & AI
シリーズ: イメージでわかる
行列の掛け算が、どうして AI の中心的な計算になるのかを、変換の道具としてやさしく説明します。
Why matrix multiplication is the core computation in AI — explained as a "transformation tool."
数字をタテヨコに並べた表のことです。
A grid of numbers arranged in rows and columns.
たとえばテストの点数——数学 80、英語 70、理科 90 という3科目の点を1行に並べたものは「1×3 の行列」です。生徒が30人いれば「30×3 の行列」。ただそれだけのことです。
For example, test scores — Math 80, English 70, Science 90 arranged in a row is a "1×3 matrix." If 30 students each have 3 scores, that's a "30×3 matrix." That's really all there is to it.
A の1行目「1, 2, 3」と B の1列目「7, 9, 11」を、対応する数字同士でかけて足す: 1×7 + 2×9 + 3×11 = 58。これを全マスぶん繰り返すのが行列のかけ算です。
Take row 1 of A (1, 2, 3) and column 1 of B (7, 9, 11), multiply matching pairs and sum: 1×7 + 2×9 + 3×11 = 58. Repeat for every cell — that's matrix multiplication.
AI(ニューラルネットワーク)の中では、「入力を受け取って → 変換して → 次の層に渡す」を何十回も繰り返します。この「変換」が行列のかけ算です。
Inside an AI (neural network), the process "receive input → transform → pass to next layer" repeats dozens of times. That "transform" is matrix multiplication.
ピクセルの行列を変換して「猫」「犬」を判定
Transform pixel matrices to determine "cat" or "dog"
単語の行列を変換して次の単語を予測
Transform word matrices to predict the next word
音の周波数行列を変換してテキスト化
Transform frequency matrices into text
行列のかけ算は「同じ計算を大量に繰り返す」仕事です。2×3 と 3×2 のかけ算だけでも 12回のかけ算と6回の足し算が必要。実際の AI では数百万〜数十億回になります。
Matrix multiplication is "repeating the same calculation many times." Even a 2×3 times 3×2 requires 12 multiplications and 6 additions. In real AI, that becomes millions to billions.
GPU は何千もの計算ユニットを持ち、これらを同時並列で処理できます。CPU が1人の達人なら、GPU は数千人のチームワークです。
GPUs have thousands of compute units and can process these in parallel. If a CPU is one expert, a GPU is a team of thousands working together.
ROCm では、「この式は結局どんな行列計算か?」をまず見ると話がつながりやすくなります。
In ROCm, it often helps to ask first: "What kind of matrix computation is this, underneath?"
$y = Wx$ や $AB$ のような式が出てきたら、ROCm 目線では「rocBLAS が得意な仕事かも」と考えると理解しやすくなります。全結合層、Attention の一部、埋め込みの変換など、見た目が違っても中身は行列積であることが多いからです。
When you see formulas like $y = Wx$ or $AB$, a ROCm-friendly way to read them is: "this may be a rocBLAS-style job." Fully connected layers, parts of Attention, and embedding transforms may look different, but many of them reduce to matrix multiplication.
この研究で gfx900 を見るときも、「AI らしい名前の層か」より「大きな行列計算として速い経路に乗るか」を追います。そこで rocBLAS や、その下で行列カーネルを整える仕組みの重要さが出てきます。
That is why, in this research, we look at gfx900 less in terms of AI buzzwords and more in terms of whether a workload lands on a fast matrix path. This is where rocBLAS and the machinery that tunes matrix kernels start to matter.