Conversation
maleadt
force-pushed
the
tb/throw-arguments
branch
from
September 23, 2026 19:19
b3c6132 to
5392dab
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## tb/julia-ir-passes #940 +/- ##
======================================================
- Coverage 86.36% 86.28% -0.09%
======================================================
Files 29 29
Lines 5766 5783 +17
======================================================
+ Hits 4980 4990 +10
- Misses 786 793 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
Author
|
Looks to be working nicely! And allows us to get rid of the broken atomic demotion pass. |
maleadt
added this pull request to stack #944
September 24, 2026 15:38
This was referenced Sep 25, 2026
maleadt
force-pushed
the
tb/throw-arguments
branch
from
September 25, 2026 06:13
7219d34 to
783daf0
Compare
maleadt
removed this pull request from stack #944
September 25, 2026 06:13
This was referenced Sep 25, 2026
maleadt
added this pull request to stack #951
September 25, 2026 06:14
maleadt
force-pushed
the
tb/throw-arguments
branch
from
September 25, 2026 06:55
783daf0 to
946c1d7
Compare
Targets that cannot throw report exceptions without inspecting the thrown value. The new Julia IR pass `drop_throw_arguments!` replaces the argument of `throw` with `nothing` on those targets, allowing Julia's DCE to remove exception construction when proven removable. Such dead constructions used to survive to the back-end because Julia does not inline into throw blocks and the constructors allocate through the device allocator (for example, `InexactError`'s boxed arguments, #904, and `DomainError` with a `LazyString`), with GC orderings on the stores into those objects. This supersedes `lower_throw!`'s LLVM-level erasure of the thrown value, which erased the call's direct argument regardless of what it was.
maleadt
force-pushed
the
tb/throw-arguments
branch
from
September 28, 2026 16:52
946c1d7 to
9eb33a1
Compare
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.
Targets that cannot throw (
!can_throw(job)) report exceptions without inspecting the thrown value, but code still constructed that value. The construction is dead afterthrowis lowered, yet often survived to the back-end because Julia does not inline into throw blocks and the constructors allocate through the device allocator. For example,Bool(x)constructs anInexactErrorwhose boxedargstuple gets anunorderedpointer store (#904), whilelog1pwith Float64 emulation constructs aDomainErrorwith aLazyString(release stores). These GC orderings led todemote_atomics!(#904, #924, #927).This PR adds
drop_throw_arguments!, a Julia IR pass for targets where!can_throw(job). It rewritesthrow(x)asthrow(nothing). Julia's DCE (compact!+adce_pass!) then removes each construction provenremovable_if_unused; constructions with side effects, such as eagerly built message strings, remain. The pass replaceslower_throw!'s LLVM-level erasure of the thrown value, which erased the call's direct argument regardless of what it was.Measurements
On Julia 1.12 on an M1, these are the numbers of kernels that passed validation but still contained dead exception allocations, GC atomics, or boxes. The measurements use the whole stack; later PRs in the stack do not remove any of the constructs counted here:
gpu_convert_kernel!had 8InexactErrorallocations and 24store atomic ptr unordered→ 0.DomainErrorfloat boxes → 0.