Visual Guide to Fallback Paths
シリーズ: イメージでわかる
新しい近道が使えなくても、別の経路で動けることがある。そんな fallback の考え方をやさしく説明するページです。
Even when new shortcuts aren't available, there are often alternative routes that still work. A gentle guide to the concept of fallback paths.
「最善の方法が使えないとき、代わりの方法を使うこと」です。
"Using an alternative method when the best one isn't available."
通学路の橋が工事中だったら、少し遠回りの別の道を通りますよね。到着する場所は同じだけど、時間はちょっとかかる。
If the bridge on your school route is under construction, you take a slightly longer detour. You still arrive at the same place, but it takes a bit more time.
ソフトウェアの世界にもこれと同じしくみがあります。GPU に計算を頼むとき、「最速の専用ルート」が使えなくても、「遅いけど確実に動く一般ルート」で結果を出せることがある。これを fallback(フォールバック) と呼びます。
The same mechanism exists in software. When sending computations to a GPU, if the "fastest dedicated route" isn't available, there might be a "slower but reliable general route" that still produces results. This is called a fallback.
その GPU 向けに最適化された計算ルート。速い。でも新しい GPU にしかないことがある。
A computation route optimized for that specific GPU. Fast. But sometimes only available on newer GPUs.
どの GPU でも使える汎用ルート。遅いかもしれないけど、幅広い GPU で動く。
A general-purpose route that works on most GPUs. May be slower, but runs on a wide range of hardware.
MIOpen(AI計算のライブラリ)を例にすると:
最新の GPU(MI200 など)には 専用の solver が何十種類も用意されています。gfx900(Vega)ではそのうちの一部しか使えないことがあります。
Take MIOpen (the AI computation library) as an example:
The latest GPUs (like MI200) have dozens of dedicated solvers available. On gfx900 (Vega), only some of these may be usable.
でも、MIOpen は「使える solver のリスト」を GPU の能力に応じて自動で調べ、使えるものの中からいちばん速いものを選びます。専用高速パスがなければ、使える汎用的な solver で計算する。これが fallback です。
However, MIOpen automatically discovers the "list of usable solvers" based on GPU capabilities and picks the fastest available one. If a dedicated fast solver isn't available, it falls back to a general-purpose solver. That's the fallback in action.
fallback がうまく働く背景には、ある設計思想があります。
Fallback works well because of an underlying design philosophy.
ROCm のライブラリの多くは、GPU の「名前」ではなく「できること」で判断する設計になっています。これを capability-based design(ケイパビリティ・ベースド・デザイン)と呼びます。
Many ROCm libraries make decisions based on what a GPU can do, not what its name is. This is called capability-based design.
イメージとしては、面接で「出身校はどこ?」ではなく「何ができる?」で判断するやり方です。gfx900 は古い GPU ですが、「この機能が使えるなら、この計算はできる」という形で仕事をもらえることがあります。
Think of it as a job interview that asks "What can you do?" instead of "Where did you graduate?" gfx900 is an older GPU, but if it has the required capabilities, it can still get the job done.
fallback は万能ではありません。いくつかの大事な限界があります。
Fallback isn't magic. It has important limitations.
① 遅いことがある。 専用パスが 1秒で終わる計算が、fallback では 10秒かかることも珍しくありません。
① It can be slow. A computation that takes 1 second on a dedicated path might take 10 seconds via fallback.
② すべてに fallback があるわけではない。 新しい命令セットが絶対に必要な機能には、代替ルート自体が存在しないことがあります。
② Not everything has a fallback. Features that absolutely require new instruction sets may have no alternative route at all.
③ テストされていないことがある。 fallback 経路は「動くはず」でも、古い GPU では実際にテストされていない場合があります。予期しないクラッシュのリスクがあります。
③ It may not be tested. A fallback path "should work," but if nobody actually tested it on older GPUs, unexpected crashes may occur.
fallback — 最善の道が使えないとき、代わりの道で結果を出すしくみ。
Fallback — A mechanism that uses an alternative path when the best one isn't available.
capability-based design — GPU を名前ではなく「できること」で判断する設計。これが fallback を可能にしている。
Capability-based design — Judging a GPU by what it can do, not its name. This is what makes fallback possible.
限界もある — 遅い、全部ではない、テスト不足のリスク。「動く」と「快適」は別の話。
There are limits — Slower, not universal, risk of untested paths. "It runs" and "it's comfortable" are different things.