[FEA]: Require ct.barrier for multi stage kernels
还没有人认领这个 Issue。
评估
调研方向
首先检查现有的 ct.kernel、ct.load、ct.atomic_add 和 ct.store 入口点,然后确定提议的 ct.barrier 将如何在多阶段 kernel 之间协调各个 block。比较 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·