Handle allocation failure when boxing - #919
Merged
Merged
Conversation
`Runtime.box` wrote the type tag and payload through every pointer returned by `malloc`. OpenCL has no device allocator and returns `C_NULL`; after inlining, back-end optimizers can treat those stores as undefined and remove the throwing path, including `signal_exception`. Use the same failure path as `gc_pool_alloc`: report OOM and throw `OutOfMemoryError` before writing. This prevents an invalid Julia object from escaping and gives optimization a real exceptional path. Cover both allocator-less SPIR-V back-ends and verify the OOM and original exception paths.
Member
Author
|
This is a prerequisite for improved exception handling in OpenCL.jl (without having to add a device-side allocator). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #919 +/- ##
==========================================
+ Coverage 85.04% 85.14% +0.09%
==========================================
Files 29 29
Lines 5563 5566 +3
==========================================
+ Hits 4731 4739 +8
+ Misses 832 827 -5 ☔ 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.
Runtime.boxwrote the type tag and payload through every pointer returned bymalloc. OpenCL has no device allocator and returnsC_NULL; after inlining, back-end optimizers can treat those stores as undefined and remove the throwing path, includingsignal_exception.Use the same failure path as
gc_pool_alloc: report OOM and throwOutOfMemoryErrorbefore writing. This prevents an invalid Julia object from escaping and gives optimization a real exceptional path. Cover both allocator-less SPIR-V back-ends and verify the OOM and original exception paths.