[FEA]: Require ct.barrier for multi stage kernels
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các entry point hiện có là ct.kernel, ct.load, ct.atomic_add và ct.store, sau đó xác định cách ct.barrier được đề xuất sẽ phối hợp các block giữa các kernel nhiều giai đoạn. So sánh các cách tiếp cận dùng bộ đếm trong bộ nhớ toàn cục và cooperative-groups được mô tả trong issue. Công việc được xem là hoàn tất khi một tính năng barrier được ghi tài liệu hỗ trợ luồng đồng bộ hóa trong ví dụ và có phần kiểm thử tính ngữ nghĩa của nó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 2.2k
- Fork
- 155
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA/cutile-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NVIDIA/cutile-python#105 · 2 bình luận ·
-
bug status: needs-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
NVIDIA/cutile-python#102 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
NVIDIA/cutile-python#101 ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
NVIDIA/cutile-python#97 · 1 bình luận ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
NVIDIA/cutile-python#96 · 1 bình luận ·
Tất cả issue của NVIDIA/cutile-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/skills#1811 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
speaches-ai/speaches#678 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
datalayer/mcp-compose#42 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conda-forge/spacy-feedstock#177 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
UKGovernmentBEIS/inspect_evals#2523 ·