Repository navigation
Test multithreaded GC with NEO's SIGSEGV handler installed - #706
Merged
Merged
Conversation
NEO chains its SIGSEGV handler to Julia's using a counter shared by all threads, so Julia's GC, which makes every thread fault on the safepoint page at once, crashed the process. NEO_jll 26.35.39758+1 carries the fix (intel/compute-runtime#1009). The test forces NEO to install its handler on integrated GPUs as well, through debug keys, and is skipped when NEO_jll is pointed at a system driver, as on Aurora. Fixes #607.
Contributor
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/test/level-zero.jl b/test/level-zero.jl
index b86ed26..4b0a25d 100644
--- a/test/level-zero.jl
+++ b/test/level-zero.jl
@@ -391,30 +391,30 @@ end
@testset "SIGSEGV handler chaining" begin
-# NEO installs a SIGSEGV handler that chains to Julia's. Julia's GC makes every thread fault
-# on its safepoint page at the same time, which crashed NEO before it made chaining
-# thread-safe (oneAPI.jl#607, intel/compute-runtime#1009).
-script = raw"""
- using oneAPI, oneAPI.oneL0
- # NEO installs its handler on the first shared allocation that gets device storage.
- # Integrated GPUs normally don't use it, and fail the allocation when forced to,
- # but the handler is installed anyway.
- try
- free(shared_alloc(context(), device(), 1024))
- catch err
- err isa oneL0.OutOfGPUMemoryError || rethrow()
- end
- Threads.@threads for i in 1:100
- x = [rand(100) for _ in 1:1000]
- GC.gc(false)
- end
-"""
-cmd = `$(Base.julia_cmd()) --project=$(Base.active_project()) --threads=4 -e $script`
-cmd = addenv(cmd, "NEOReadDebugKeys" => "1", "AllocateSharedAllocationsWithCpuAndGpuStorage" => "1")
-# Only our NEO_jll build carries the fix; skip with a system driver (e.g. on Aurora, where
-# preferences point NEO_jll at /usr/lib64).
-NEO_jll = oneL0.NEO_jll
-system_driver = !startswith(NEO_jll.libze_intel_gpu, NEO_jll.artifact_dir)
-@test success(pipeline(cmd, stdout=stdout, stderr=stderr)) skip=system_driver
+ # NEO installs a SIGSEGV handler that chains to Julia's. Julia's GC makes every thread fault
+ # on its safepoint page at the same time, which crashed NEO before it made chaining
+ # thread-safe (oneAPI.jl#607, intel/compute-runtime#1009).
+ script = raw"""
+ using oneAPI, oneAPI.oneL0
+ # NEO installs its handler on the first shared allocation that gets device storage.
+ # Integrated GPUs normally don't use it, and fail the allocation when forced to,
+ # but the handler is installed anyway.
+ try
+ free(shared_alloc(context(), device(), 1024))
+ catch err
+ err isa oneL0.OutOfGPUMemoryError || rethrow()
+ end
+ Threads.@threads for i in 1:100
+ x = [rand(100) for _ in 1:1000]
+ GC.gc(false)
+ end
+ """
+ cmd = `$(Base.julia_cmd()) --project=$(Base.active_project()) --threads=4 -e $script`
+ cmd = addenv(cmd, "NEOReadDebugKeys" => "1", "AllocateSharedAllocationsWithCpuAndGpuStorage" => "1")
+ # Only our NEO_jll build carries the fix; skip with a system driver (e.g. on Aurora, where
+ # preferences point NEO_jll at /usr/lib64).
+ NEO_jll = oneL0.NEO_jll
+ system_driver = !startswith(NEO_jll.libze_intel_gpu, NEO_jll.artifact_dir)
+ @test success(pipeline(cmd, stdout = stdout, stderr = stderr)) skip = system_driver
end |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #706 +/- ##
==========================================
- Coverage 83.70% 83.44% -0.26%
==========================================
Files 52 51 -1
Lines 4376 4253 -123
==========================================
- Hits 3663 3549 -114
+ Misses 713 704 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NEO installs a SIGSEGV handler that forwards faults it doesn't own to Julia's, tracking its position in the handler chain with a counter shared by all threads. Julia's GC makes every thread fault on the safepoint page at the same time, so with more than one thread a GC crashed the process with a bare SIGSEGV. NEO_jll 26.35.39758+1 (JuliaPackaging/Yggdrasil#15164) makes that counter thread-local; the fix is proposed upstream in intel/compute-runtime#1009.
The test runs a 4-thread GC loop in a child process. NEO only installs its handler for shared allocations with device storage, which integrated GPUs don't use, so the test forces that with NEO debug keys; on the TGL runner the allocation then fails, but the handler is installed. With NEO_jll +0 the child dies from SIGSEGV 5/5 times, with +1 it passes 5/5.
The test is skipped when NEO_jll's
libze_intel_gpuis redirected outside its artifact, as on Aurora, where the system driver doesn't have the fix yet.Fixes #607.