タイルと幅のパラメーター化
調整可能な設定をパラメーターとして公開します
「タイルと幅のパラメーター化」はCoddyKit上の無料Mojo Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはMojo Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Mojo Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Knobs Must Be Parameters
To let autotuning vary a value, it has to be a compile-time parameter, not a plain runtime variable. Parameters can be specialized per candidate.
Tile Size as a Knob
A tile size controls how big a block of work you process at once. Make it a parameter and the tuner can try 16, 32, 64, and more.
fn process[tile: Int]():
passWidth as a Knob
SIMD width sets how many numbers you crunch per instruction. Different chips favor different widths, so expose it as a parameter too.
fn run[width: Int]():
passDeclaring the Parameters
Put tunable values inside the function's bracket list. Each entry becomes a knob the autotuner is allowed to change.
fn kernel[tile: Int, width: Int]():
passUse Them Inside
Inside the body, treat the parameter like a constant. The compiler bakes its value in for each specialized version it builds.
fn step[tile: Int]() -> Int:
return tile * 2Sensible Ranges
Pick candidate values that make hardware sense: powers of two like 8, 16, 32 for width, and cache-friendly blocks for tile size.
Keep Knobs Independent
Each knob should mean one clear thing. Tangled parameters make the search confusing and the results hard to explain.
Validate with Constraints
Use a constraint to reject impossible combinations early, so the tuner never wastes time building candidates that cannot work.
constrained[width > 0]()Defaults Still Help
Give each parameter a reasonable default. Code stays usable without tuning, and the search starts from a known-good baseline.
fn kernel[tile: Int = 32]():
passMore Knobs, Bigger Space
Every extra parameter multiplies the candidates to test. Expose the few knobs that truly matter, not every number you can find.
Now It Is Tunable
With tile and width as parameters, your kernel is ready: the autotuner has clear dials to turn while searching for peak throughput. 🔧
Quick Check
Confirm what makes a value tunable by the autotuner.
Recap
You exposed tile and width as compile-time parameters, added a constraint and defaults, and gave the autotuner clean dials to turn. 🎯
よくある質問
「タイルと幅のパラメーター化」レッスンは無料ですか?
はい。「タイルと幅のパラメーター化」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Mojo Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Mojo Academyコースには全4レッスンが含まれています。
「タイルと幅のパラメーター化」で何を学びますか?
調整可能な設定をパラメーターとして公開します ブラウザで直接実行するハンズオンコードでMojo Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Mojo Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのMojo Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「タイルと幅のパラメーター化」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このMojo Academyレッスンでコードを書いて実行できますか?
はい。すべてのMojo Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Autotuningで解決できること
- タイルと幅のパラメーター化
- パラメーター空間の探索
- 最適な設定の固定