ロード・同期・計算パターン
計算前にタイルをステージングします。
「ロード・同期・計算パターン」はCoddyKit上の無料CUDA Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはCUDA Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 CUDA Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Three Simple Phases
Tiling follows one rhythm in every kernel: load a tile into shared memory, sync, then compute from the fast copy.
Phase One: Load
In the load phase, each thread reads one element from global memory and stores it into a shared-memory tile its whole block can see.
tile[threadIdx.x] = in[globalIndex];A Cooperative Effort
Loading is a team job. Every thread fetches its slice, so together the block stages one full tile with a single coalesced pass.
Phase Two: Sync
Before anyone reads a neighbor s value, all threads must finish loading. __syncthreads is the barrier that guarantees the tile is ready.
__syncthreads();Why Sync Is Mandatory
Skip the barrier and a thread may read a tile slot that its neighbor has not written yet. That is a race and gives wrong results. 💥
Phase Three: Compute
Now every value lives on chip. In the compute phase threads read tile entries freely, since shared memory is orders faster than global.
Fast Reuse Pays Off
Because the tile sits in shared memory, a value loaded once is reused by many threads with almost no extra cost. That is the whole win.
Sometimes Sync Again
If the compute phase writes back into the same tile for a next step, add a second __syncthreads before reusing those slots.
All Threads or None
Every thread in the block must reach __syncthreads. If some skip it inside a branch, the kernel deadlocks or misbehaves.
A Reusable Skeleton
Load, sync, compute is a template you will reuse for convolutions, matrix multiply, and reductions throughout this category.
Mind the Tile Size
The shared tile must fit the block. Tile width usually equals blockDim, so each thread owns exactly one slot to load and reuse.
Quick Check
Why is __syncthreads needed between load and compute?
Recap
Tiling is load, sync, compute: stage a tile cooperatively, barrier so it is complete, then reuse it fast on chip. ✅
よくある質問
「ロード・同期・計算パターン」レッスンは無料ですか?
はい。「ロード・同期・計算パターン」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、CUDA Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 CUDA Academyコースには全4レッスンが含まれています。
「ロード・同期・計算パターン」で何を学びますか?
計算前にタイルをステージングします。 ブラウザで直接実行するハンズオンコードでCUDA Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
CUDA Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのCUDA Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「ロード・同期・計算パターン」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このCUDA Academyレッスンでコードを書いて実行できますか?
はい。すべてのCUDA Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- データ再利用の問題
- ロード・同期・計算パターン
- ステンシルとスライディングウィンドウ
- 端のタイルを処理する