Collecting a context together with its memory segfaults
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #716 @maleadt による — マージ済み
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- Julia
- スター
- 218
- フォーク
- 36
- 平均マージ
- 1日 4時間
- マージ済み PR(30日)
- 55
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaGPU/oneAPI.jl のほかの issue
-
performance
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
libraries upstream
難易度 4/5 1〜2日 初心者へのやさしさ 22/100
JuliaGPU/oneAPI.jl#703 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
ci
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
JuliaGPU/oneAPI.jl#663 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
runtime upstream
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
ci kernels upstream
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
JuliaGPU/oneAPI.jl#538 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
JuliaGPU/oneAPI.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
EnzymeAD/Reactant.jl#3549 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
JuliaGeometry/Meshes.jl#1469 ·
メンテナーはふだん 1 日以内に返信
-
distributed 🕸️
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
CliMA/Oceananigans.jl#6295 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信