`atomic_store_add` of a slice extracted from a tile adds nothing when the slice is under 256 bytes

Đang mở
#337 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
julia
Lĩnh vực
backend, testing-qa

Hướng nghiên cứu

Start by reproducing the issue with the Julia kernel and size table in the report, comparing extract followed by atomic_store_add against the masked-sum workaround. The report says the emitted Tile IR looks correct and points to tileiras as a possible source, but gives no repository file or test entry point. Done means identifying the cause and ensuring atomic additions of extracted slices work across the reported sizes and element types.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

On cuTile 1.0.0 (tileiras 13.3.36, and 13.4.92 with cuTile main), atomic_store_add of a slice that extract takes from a loaded tile leaves the destination unchanged when the slice is small. A plain store of the same slice is right, and so is atomic_store_add of the whole tile. On a GB10 (sm_121), cuTile 1.0.0 and tileiras 13.3.36:

Slice (Float32) store atomic_store_add
8 × 1 (32 B) right CUDA_ERROR_MISALIGNED_ADDRESS
16 × 1 (64 B) right wrong: nothing added
32 × 1 (128 B) right wrong: nothing added
64 × 1 (256 B) right right

BFloat16 behaves the same by bytes: 8 and 16 rows fault, 32 and 64 rows add nothing, and 128 rows are right. With cuTile main and tileiras 13.4.92, compute-sanitizer reports the fault as "Misaligned shared or local address" inside atomic_store_add. The Tile IR that cuTile.jl emits looks right (extract %tile[1, 0] : tile<2x16xf32> -> tile<1x16xf32>, then atomic_red_view_tko ... addf), so this seems to be in tileiras.

using CUDACore, cuTile
const ct = cuTile

function k(out, g, ::Val{R}, ::Val{Atomic}) where {R, Atomic}
    x = ct.load(g, (Int32(1), Int32(1)), (R, 2))
    slice = ct.extract(x, (1, 2), (R, 1))
    Atomic ? ct.atomic_store_add(out, (Int32(1), Int32(2)), slice) : ct.store(out, (Int32(1), Int32(2)), slice)
    return
end

for R in (16, 64)
    g = CuArray(rand(Float32, R, 2))
    for atomic in (false, true)
        out = CUDACore.zeros(Float32, R, 2)
        ct.launch(k, 1, out, g, Val(R), Val(atomic))
        println(atomic ? "atomic_store_add" : "store", " of column 2, R = $R: ",
            Array(out)[:, 2] == Array(g)[:, 2] ? "right" : "wrong")
    end
end
store of column 2, R = 16: right
atomic_store_add of column 2, R = 16: wrong
store of column 2, R = 64: right
atomic_store_add of column 2, R = 64: right

A workaround that is right at every size we tried (1 to 128 rows, Float32 and BFloat16): build the slice as a masked sum, sum(ifelse.(lane .== 2, x, 0f0); dims = 2), rather than extract.

A related observation on cuTile main, possibly by design: atomic_store_add at a tile index before the first (index 0) raises CUDA_ERROR_ILLEGAL_INSTRUCTION, while one past the last is clipped silently.

This should probably be reported upstream instead but I wanted to record it quickly before I forgot about it.

2026/11/05: Still happens on tileiras 13.5

Assisted by: Opus 5.5

Ngôn ngữ chính
Julia
Star
90
Fork
13
Merge trung bình
4 ngày 8 giờ
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của JuliaGPU/cuTile.jl

Tất cả issue của JuliaGPU/cuTile.jl

Issue tương tự

Thêm issue về Julia

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.