Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1141 +/- ##
==========================================
+ Coverage 93.13% 93.18% +0.05%
==========================================
Files 32 32
Lines 8574 8653 +79
==========================================
+ Hits 7985 8063 +78
- Misses 589 590 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
IR backtraces stop at a function with several call sites, ending in a "multiple call sites" frame, so an InvalidIRError raised in a shared non-inlined helper doesn't say which code in the kernel reaches it. While validating, record for such errors up to five paths of calls into that function, each followed outwards until a function that isn't called (normally the kernel) or recursion, and show up to four of them below the backtrace as alternative continuations. They are kept next to the errors in InvalidIRError rather than in the backtraces, whose frames other code takes as a single call chain: the grouping of errors by origin, Enzyme, and the device-side exception frames. Back-ends record them by implementing `validate_ir` with a third argument, as the in-tree ones now do. Back-ends that only implement the two-argument form keep working, without the callers, but validation no longer calls a two-argument override for one of the in-tree targets. Co-authored-by: Nishagoswamii <nishagoswami369@gmail.com>
maleadt
force-pushed
the
tb/backtrace-callers
branch
from
December 2, 2026 19:54
aa0203c to
2cfe101
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.
When an invalid instruction is in a function that isn't inlined and is called from several places, the IR backtrace of an
InvalidIRErrorstops at that function with a "multiple call sites" frame. It doesn't say which code in the kernel reaches the error:While validating, the paths of calls into such a function are now recorded for each error, each followed out to the kernel, and shown as alternative continuations of the backtrace. Up to four are shown ("or elsewhere" when there are more); recursion is not followed.
The paths are stored in a new
callersfield ofInvalidIRError, not in the backtraces. Other code takes the frames of a backtrace as one call chain: the grouping of errors by where they come from, Enzyme's error messages, and the frames that device-side exceptions report. Those are unchanged, as isbacktraceitself.Errors from the back-end validators (e.g. system-scope atomics on PTX,
Float64on Metal) get their callers too:validate_irhas a three-argument form that receives the record, and the in-tree back-ends implement it. The generic three-argument method calls the two-argument one, so back-ends that only implement that keep working, without callers. One caveat: an override ofvalidate_ir(job, mod)for one of the in-tree targets (e.g. specialized on its ownCompilerParams) is no longer called by validation; I found none in the JuliaGPU packages or Enzyme.Tested with the native and PTX suites, which cover nested paths, recursion, mutual recursion and the cap, and a PTX atomic in a shared helper.
Fixes #637. Supersedes #1135, from which it takes the idea and test setup.