Repository navigation
Don't keep the deferred-free context in the package image - #782
Merged
Merged
Conversation
The precompilation workload frees memory with the DEFER_FREE policy, which records the context in `oneL0.deferred_frees`. The workload cleanup did not reset it, so when the context was still alive while the image was written, the image kept it, with a null handle once loaded. Reclaiming memory after a failed allocation then swept deferred frees in that context, and crashed in zeMemAllocHost. Reset it both after the workload and when initializing the driver, like the extension properties cache.
The workload cleanup forgets the report slabs, but a stream it created can still be finalized afterwards, typically at exit, where returning its slot failed with a KeyError. Such a slot belongs to a forgotten slab, so drop it. Also clear the slabs under the pool lock, which such a finalizer takes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #782 +/- ##
==========================================
+ Coverage 86.71% 86.87% +0.15%
==========================================
Files 55 55
Lines 5143 5099 -44
==========================================
- Hits 4460 4430 -30
+ Misses 683 669 -14 ☔ 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.
The GPU part of the precompilation workload frees pool memory with the
DEFER_FREEpolicy, which records the context inoneL0.deferred_frees. The workload cleanup reset the other driver state but not that one, so when the context was still alive while the image was written, the package image kept it. After loading,oneL0.deferred_frees.context.valueis then aZeContextwith a null handle (seen on an Iris Xe host; whether it happens depends on GC timing during precompilation). The next failed allocation reclaims memory, sweeps deferred frees in that context, and segfaults inzeMemAllocHost. In a full test run this showed up as worker crashes and a failing "SIGSEGV handler chaining" test.This PR resets
deferred_freesboth in the workload cleanup and inoneL0.initialize, next to the extension properties cache, which is reset there for the same reason. The test checks in a fresh process that nothing is recorded right afterusing oneAPI.It also fixes the "error in running finalizer: KeyError" printed while precompiling: a stream created by the workload can be finalized after the cleanup forgot the report slabs (here at exit), and returning its slot to the missing slab list threw. Such a slot is now dropped, and the cleanup clears the slabs under the pool lock that the finalizer takes.