High and variable launch + synchronize latency for small kernels (~56 µs, often 2x)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 43/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- julia
- Ambito
- backend, performance
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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;
synchronizethen 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
- Lingua principale
- Julia
- Stelle
- 218
- Fork
- 36
- Merge medio
- 1g 6h
- PR unite (30g)
- 65
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di JuliaGPU/oneAPI.jl
-
Difficoltà 4/5 1-2 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
JuliaGPU/oneAPI.jl#750 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
performance
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
libraries upstream
Difficoltà 4/5 1-2 giorni Idoneità per principianti 22/100
JuliaGPU/oneAPI.jl#703 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
ci
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
JuliaGPU/oneAPI.jl#663 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di JuliaGPU/oneAPI.jl
Issue simili
-
documentation invalid
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
JuliaPhysics/BeamletOptics.jl#190 ·
I maintainer di solito rispondono entro 2 giorni
-
mul! with a Symmetric or Hermitian factor throws for a matrix view whose columns are not contiguousAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JuliaLang/LinearAlgebra.jl#1829 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MagneticResonanceImaging/MRIReco.jl#320 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
rfordatascience/tidytuesday#1098 ·
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
trixi-framework/TrixiParticles.jl#1364 ·
I maintainer di solito rispondono entro 2 giorni