混合精度: FP16、BF16、TF32
精度とスループットのトレードオフ
「混合精度: FP16、BF16、TF32」はCoddyKit上の無料CUDA Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはCUDA Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 CUDA Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Trading Bits for Speed
Tensor Cores get their speed from mixed precision: feeding smaller number formats in so the hardware can push far more math per cycle. ⚡
What FP32 Costs
Standard FP32 uses 32 bits per value. It is accurate but heavy, so moving and multiplying many FP32 numbers eats bandwidth and time.
Meet FP16
FP16 uses just 16 bits: a smaller exponent and fewer mantissa bits. Half the size means more values move and multiply at once.
FP16 Has a Small Range
FP16 saves space but its narrow exponent gives a tiny dynamic range. Very large or very small values can overflow or vanish to zero.
Meet BF16
BF16 is also 16 bits but keeps FP32's full exponent, trading mantissa bits instead. It matches FP32's range with less precision.
Why BF16 Wins for Training
Because BF16 shares FP32's wide range, gradients rarely overflow. That makes BF16 a favorite for training large neural networks safely.
Meet TF32
TF32 is a 19-bit Tensor Core format: FP32's exponent with a trimmed mantissa. It speeds up math while looking like FP32 to your code.
The Accumulator Stays Wide
No matter the input format, Tensor Cores usually accumulate partial sums in FP32. The speed is in the inputs; the safety is in the running total.
Range vs Precision
The big idea: FP16 and BF16 cost the same 16 bits but split them differently. One favors precision, the other favors range.
Picking a Format
Use BF16 or TF32 when range matters, FP16 when you can manage scaling. The right format depends on your data, not just on speed.
Declaring Half Precision
In CUDA C++ the FP16 type has a short name. This line declares one half value ready for Tensor Core math.
__half x = __float2half(1.5f);Quick Check
Which format keeps FP32's full exponent range in only 16 bits?
Recap
You saw how mixed precision trades bits for throughput: FP16 favors precision, BF16 favors range, and TF32 speeds FP32-style math. Wide accumulation keeps results safe. ✨
よくある質問
「混合精度: FP16、BF16、TF32」レッスンは無料ですか?
はい。「混合精度: FP16、BF16、TF32」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、CUDA Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 CUDA Academyコースには全4レッスンが含まれています。
「混合精度: FP16、BF16、TF32」で何を学びますか?
精度とスループットのトレードオフ ブラウザで直接実行するハンズオンコードでCUDA Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
CUDA Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのCUDA Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「混合精度: FP16、BF16、TF32」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このCUDA Academyレッスンでコードを書いて実行できますか?
はい。すべてのCUDA Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Tensor Core が計算するもの
- 混合精度: FP16、BF16、TF32
- WMMA フラグメント API
- 数値安定性のトレードオフ