Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

High and variable launch + synchronize latency for small kernels (~56 µs, often 2x)

Đang mở
#756 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 1 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
43/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, performance

Hướng nghiên cứu

Start with the two Julia reproducers in the issue and confirm the launch and synchronization latency distributions on the stated Arc A770 setup. Then trace the oneAPI.jl launch and synchronize paths to locate where the variable delay occurs. The issue is resolved when the source of the slow samples is identified and launch plus synchronize latency is reduced or made consistent.

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

Mô tả

Launching a trivial kernel and synchronizing takes about 56 µs on an Arc A770. A noticeable share of calls take twice that or more:

  • the launch itself costs about 18 µs of host time, and still 15 µs per launch when 1000 launches are queued back to back with a single synchronize at the end;
  • synchronize then takes a median of 39 µs, with a p90 of 110 µs;
  • back to back, about 10% of launch+sync calls take 125–155 µs instead of 56 µs. After the host has been idle for 1 ms, the median is 97–117 µs. synchronize(blocking=true) behaves the same.

For small problems this dominates. We ran into it in JuliaGPU/AcceleratedKernels.jl#194, where medians of back-to-back calls on 10^4 elements flipped by ±30% between runs, depending on the share of slow samples. Earlier, with heavier kernels and some background CPU load, back-to-back calls were bimodal at about 60 µs and 125–155 µs, with each process tending to stay in one mode. I haven't found out whether the cost is in oneAPI.jl's launch path, Level Zero, or the GPU's power management.

launch: p10  17.0 p50  17.9 p90  18.6 µs
sync:   p10  37.7 p50  39.0 p90 109.7 µs
1000 back-to-back launches + 1 sync: 15.1 µs per launch
blocking=false gap    0 µs: p10   55.8  p50   56.7  p90  127.8 µs
blocking=false gap   10 µs: p10   56.4  p50   58.4  p90   59.8 µs
blocking=false gap   50 µs: p10   56.6  p50   57.1  p90   59.3 µs
blocking=false gap 1000 µs: p10   69.5  p50   96.9  p90  149.4 µs
blocking=true  gap    0 µs: p10   55.6  p50   56.4  p90  126.9 µs
blocking=true  gap 1000 µs: p10   70.5  p50  117.2  p90  148.7 µs

Environment: oneAPI.jl 2.10.0, NEO 26.35.39758, libigc 2.41.5, Level Zero API 1.17, Julia 1.13.2, Arc A770, Linux 7.2.11 (Arch), otherwise idle machine.

Reproducers
# Split launch + sync of a trivial kernel: host time of the launch, of the synchronize, and the device time
using oneAPI, Statistics, Printf
z = oneArray(zeros(Float32, 1))
k(a) = (@inbounds a[1] = 1f0; nothing)
for _ in 1:100; @oneapi k(z); oneAPI.synchronize(); end
tl = Float64[]; ts = Float64[]
for _ in 1:1000
    t0 = time_ns(); @oneapi k(z); t1 = time_ns(); oneAPI.synchronize(); t2 = time_ns()
    push!(tl, (t1 - t0) / 1e3); push!(ts, (t2 - t1) / 1e3)
end
@printf("launch: p10 %5.1f p50 %5.1f p90 %5.1f µs\n", quantile(tl, [0.1, 0.5, 0.9])...)
@printf("sync:   p10 %5.1f p50 %5.1f p90 %5.1f µs\n", quantile(ts, [0.1, 0.5, 0.9])...)
# launch-only throughput: 1000 launches, one sync
t = @elapsed (for _ in 1:1000; @oneapi k(z); end; oneAPI.synchronize())
@printf("1000 back-to-back launches + 1 sync: %.1f µs per launch\n", 1e6 * t / 1000)
# Wall time of launching a trivial kernel and synchronizing, after the host idles for `gap` µs
using oneAPI, Statistics, Printf
z = oneArray(zeros(Float32, 1))
k(a) = (@inbounds a[1] = 1f0; nothing)
function spin(us)
    t = time_ns() + round(UInt64, us * 1000)
    while time_ns() < t; end
end
for blocking in (false, true)
    for _ in 1:100; @oneapi k(z); oneAPI.synchronize(; blocking); end
    for gap in (0, 10, 25, 50, 100, 1000)
        ts = Float64[]
        for _ in 1:500
            spin(gap)
            push!(ts, 1e6 * @elapsed (@oneapi k(z); oneAPI.synchronize(; blocking)))
        end
        q = quantile(ts, [0.1, 0.5, 0.9])
        @printf("blocking=%-5s gap %4d µs: p10 %6.1f  p50 %6.1f  p90 %6.1f µs\n", blocking, gap, q...)
    end
end
Ngôn ngữ chính
Julia
Star
218
Fork
36
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
65

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/oneAPI.jl

Tất cả issue của JuliaGPU/oneAPI.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.