Visual INT8 vs FP32
シリーズ: イメージでわかる
数字の持ち方の違いが、速さや得意不得意にどうつながるのかを、箱の大きさやメモの細かさで説明します。
How the way numbers are stored affects speed and capability — explained through box sizes and notebook detail.
コンピュータの中では、数字を「ビット」という 0/1 の列で表します。使うビット数が違えば、入れ物のサイズが変わります。
Inside a computer, numbers are represented as sequences of 0s and 1s called "bits." Different bit counts mean different container sizes.
AI が推論(学習ずみモデルを使って答えを出すこと)をするとき、箱が小さいとこんなメリットがあります。
When AI runs inference (using an already-trained model to produce answers), smaller boxes have these advantages:
① メモリが少なくてすむ — 同じ量の数字でも、入れ物が1/4のサイズなのでメモリ使用量も約1/4。
② 計算が速い — GPU の中には「小さい整数専用の速い計算ユニット」を持つものがある。
③ 消費電力が低い — 小さなデータを運ぶので電気も少なくてすむ。
① Less memory — same number of values, 1/4 the container size ≈ ~1/4 memory.
② Faster — some GPUs have dedicated fast compute units for small integers.
③ Lower power — moving smaller data uses less electricity.
あります。箱を小さくすると、数字の「こまかさ」が失われます。
Yes. Shrinking the box loses numerical "precision."
• 学習(トレーニング)には FP32 や FP16 の精度がほぼ必須
• 推論でも、モデルによっては INT8 にすると精度がガクッと落ちるものがある
• 「どこまで小さくして大丈夫か」はモデルごとに違う
• Training almost always needs FP32 or FP16 precision
• For inference, some models lose significant accuracy with INT8
• "How small is safe" varies from model to model
Vega 世代の GPU(gfx900)は、FP32 と FP16 の計算が得意です。しかし、最近の GPU が持つ「INT8 専用の高速ユニット」は搭載されていません。
Vega-generation GPUs (gfx900) are good at FP32 and FP16 computation. However, they lack the "dedicated fast INT8 units" found on newer GPUs.
ここで言う「最新機能」は、INT8 という数字そのものではなく、INT8 をまとめて高速処理する専用命令のことです。ROCm の調査では、これが dot4 のような命令として現れます。
Here, the "new feature" is not INT8 as a number format itself, but the dedicated instructions that process many INT8 values quickly. In ROCm-oriented investigation, this appears as instructions such as dot4.
つまり、Vega で INT8 推論をしても、新世代 GPU ほどの速度向上は得られない場合があります。一方で、メモリ節約の効果はあるため、VRAM が限られる場面ではそれでも有用です。
So running INT8 inference on Vega may not give the same speed boost as on newer GPUs. However, the memory savings still apply, which is useful when VRAM is limited.
ROCm では、「その数字の入れ物に対して、その GPU に速い計算経路があるか」がとても大事です。
In ROCm, an important question is whether that number format has a fast execution path on the GPU you are using.
同じ INT8 でも、GPU 世代によって意味が少し変わります。新しい世代では「INT8 を速く回す専用の道」がありますが、Vega(gfx900)ではその道が細い、またはありません。
The meaning of INT8 changes a little across GPU generations. On newer generations there may be special fast paths for INT8, while on Vega (gfx900) those paths are narrow or missing.
だから ROCm では、INT8 を見たときに「8ビットだから簡単」とは考えません。代わりに、その GPU に INT8 専用命令や高速カーネルがあるかを見ます。ここが、日常感覚と ROCm の見方が少しずれるところです。
So ROCm does not simply think "8-bit means easy." Instead, it asks whether that GPU has dedicated INT8 instructions or fast kernels. This is where everyday intuition and the ROCm viewpoint can differ.
そのため ROCm では、INT8 を見るときに 1. VRAM をどれだけ減らせるか と 2. その GPU に速いカーネルがあるか を分けて考えます。小さくなることと、速くなることは、同じではありません。
So in ROCm it helps to separate 1. how much VRAM you save from 2. whether the GPU has a fast kernel for that type. Becoming smaller and becoming faster are not always the same thing.