Collecting a context together with its memory segfaults
Los mantenedores suelen responder en 1 día
Ya se ha fusionado un pull request relacionado.
- #716 de @maleadt — fusionado
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start with the ZeContext finalizer and the memory allocation and release paths in oneAPI.jl; the issue does not name their files or tests. Trace how context ownership interacts with allocations that become unreachable in the same collection, then check the proposed lifecycle against the CUDA.jl comparison and Level Zero constraints. Done means collecting a context and its allocations no longer segfaults; an open pull request already addresses this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Every Level Zero object is destroyed by its own finalizer, and Julia runs the finalizers of objects that become unreachable in the same collection in no particular order. A ZeContext can thus be destroyed before memory allocated in it, and freeing that memory afterwards crashes in NEO:
using oneAPI, oneAPI.oneL0
function work()
ctx = ZeContext(oneAPI.driver())
for _ in 1:3; GC.gc(true); end # the context is old by the time the array is allocated
old = context()
context!(ctx)
a = oneArray{Float32}(undef, 1_000_000)
context!(old)
return
end
work()
GC.gc(true)
[19895] signal 11 (1): Segmentation fault
_ZN2L07Context7freeMemEPKvb at libze_intel_gpu.so.1
zeMemFree at ...
This fails every time on an Iris Xe with NEO 26.35. Without the collections before the allocation the finalizers happen to run in a working order. A context in which a kernel was launched, or small (pooled) arrays were allocated, stays reachable from oneAPI.jl's caches and is never collected, which is probably why this hasn't come up.
Forcing other parent-before-child orders (a queue before its fences, an event pool before its events, a module before its kernels, a command list while it is executing) does not crash on NEO, though the Level Zero spec doesn't allow them either. The context is the one that matters: destroying it frees the allocations made in it.
CUDA.jl avoids this by not destroying contexts from a finalizer at all (CuContext has no finalizer, see also JuliaGPU/CUDA.jl#3404 for releases after an explicit destroy).
- Lenguaje dominante
- Julia
- Estrellas
- 218
- Forks
- 36
- Merge medio
- 1 d 4 h
- PR fusionados (30 d)
- 57
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de JuliaGPU/oneAPI.jl
-
performance
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
libraries upstream
Dificultad 4/5 1-2 días Aptitud para principiantes 22/100
JuliaGPU/oneAPI.jl#703 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
ci
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
JuliaGPU/oneAPI.jl#663 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
runtime upstream
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
ci kernels upstream
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
JuliaGPU/oneAPI.jl#538 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de JuliaGPU/oneAPI.jl
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jump-dev/MathOptInterface.jl#3113 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 83/100
JuliaMath/Polynomials.jl#647 ·
-
reactant ☣
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
NumericalEarth/Breeze.jl#1110 ·
Los mantenedores suelen responder en 1 día