[FEA]: Require ct.barrier for multi stage kernels
まだ誰も着手していません。
評価
調査の方向性
まず既存の ct.kernel、ct.load、ct.atomic_add、ct.store のエントリポイントを確認し、次に、提案されている ct.barrier が複数段階のカーネル間でブロックをどのように協調させるかを検討します。issue で説明されているグローバルメモリカウンタ方式と cooperative-groups 方式を比較します。文書化された barrier 機能が例の同期フローをサポートし、そのセマンティクスの検証が用意されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Is this a new feature, an improvement, or a change to existing functionality?
New Feature
How would you describe the priority of this feature request?
High
Please provide a clear description of problem this feature solves
In CUDA programming, we use atomic methods or cooperative groups to synchronize execution across blocks.
cutile could provide a similar mechanism to help developers write complex multi-stage kernels in a simpler way.
Feature Description
Example:
import torch
import cuda.tile as ct
@ct.kernel
def device_norm(
x: ct.Array, y: ct.Array, workspace: ct.Array,
tile_size: ct.Constant, p: ct.Constant):
# create a barrier on global memory, except p blocks to reach it.
barrier = ct.barrier(p=p)
block_id = ct.bid(0)
tile = ct.load(x, index=(block_id, 0), shape=(1, tile_size))
mean = ct.sum(tile) / tile_size
ct.atomic_add(workspace, (0, ), mean)
# wait until p blocks to reach here
barrier.wait()
global_mean = ct.load(workspace, (0, ), (1, ))
global_mean = global_mean / p
tile = tile - global_mean
ct.store(y, (block_id, ), (tile_size, ))
Describe your ideal solution
Provide ct.barrier, or a similar feature, to make it easier for developers to write applications that require block-level synchronization.
There are multiple ways to implement ct.barrier:
- Allocate a region in global memory for synchronization, and let each block atomically increment a counter when it reaches the barrier.
- Use cooperative groups.
Describe any alternatives you have considered
No response
Additional context
No response
Contributing Guidelines
- I agree to follow cuTile Python's contributing guidelines
- I have searched the open feature requests and have found no duplicates for this feature request
- 主要言語
- Python
- スター
- 2.2k
- フォーク
- 155
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA/cutile-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NVIDIA/cutile-python#105 · コメント 2 件 ·
-
bug status: needs-triage
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
NVIDIA/cutile-python#102 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
NVIDIA/cutile-python#101 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
NVIDIA/cutile-python#97 · コメント 1 件 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
NVIDIA/cutile-python#96 · コメント 1 件 ·
NVIDIA/cutile-python の issue をすべて見る
似ている issue
-
essnmx good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
[Feature] 奇物选择添加优先级 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
syfoud/Simulated_Scepter#174 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Giskard-AI/giskard-oss#2840 · コメント 1 件 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success オープンarea: repo bug perceived difficulty: 2
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
yeti-platform/yeti#1380 ·