Skip to content

Improves the backend debugging guide #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 9, 2025
Merged

Improves the backend debugging guide #43

merged 2 commits into from
Apr 9, 2025

Conversation

KMJ-007
Copy link
Contributor

@KMJ-007 KMJ-007 commented Apr 9, 2025

Changes include:

  • Added tips on using std::hint::black_box and extern "..." to control LLVM-IR generation.
  • Included advice on advanced debugging like manual LLVM-IR editing and referencing Enzyme test cases.
  • Enhanced the bug reporting section with links to relevant resources and emphasized documenting findings.
  • Improved clarity of instructions and fixed minor typos/formatting.

largely based on suggestions from ZuseZ4 in issue EnzymeAD/rust#193 (comment).

@KMJ-007 KMJ-007 changed the title Improves the backend debugging guide (src/debug_backend.md) by incorporating additional debugging techniques and clarifying existing steps Improves the backend debugging guide Apr 9, 2025
Please create an issue on [https://github.com/EnzymeAD/Enzyme/issues](github) and share `mwe.ll` and (if you have it) `reduced.ll`, as well as links to the compiler explorer. Please feel free to also add your Rust code or a link to it. With that, hopefully someone from the Enzyme core repository will be able to fix your bug. Once that happened, I will update the Enzyme submodule inside the rust compiler, which should allow you to now differentiate your Rust code. Thanks for helping us to improve Rust-AD.
Please create an issue on [https://github.com/EnzymeAD/Enzyme/issues](https://github.com/EnzymeAD/Enzyme/issues) and share `mwe.ll` and (if you have it) `reduced.ll`, as well as links to the compiler explorer. Please feel free to also add your Rust code or a link to it.

**Documenting Findings:** Some Enzyme errors, like `"Attempting to call an indirect active function whose runtime value is inactive"`, have historically caused confusion. If you investigate such an issue, even if you don't find a complete solution, please consider documenting your findings (e.g., in the Enzyme issue or by proposing an update to these docs). This helps prevent others from starting from scratch.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it’s not rust specific, can you suggest first adding to the overall Enzyme docs (github.com/EnzymeAD/www)


**Documenting Findings:** Some Enzyme errors, like `"Attempting to call an indirect active function whose runtime value is inactive"`, have historically caused confusion. If you investigate such an issue, even if you don't find a complete solution, please consider documenting your findings (e.g., in the Enzyme issue or by proposing an update to these docs). This helps prevent others from starting from scratch.

With a clear reproducer and documentation, hopefully someone from the Enzyme core repository will be able to fix your bug. Once that happens, the Enzyme submodule inside the rust compiler will be updated, which should allow you to differentiate your Rust code. Thanks for helping us to improve Rust-AD.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: EnzymeAD/Enzyme isn’t called Enzyme core, perhaps rephrase “someone from the Enzyme core repository” => “an Enzyme developer”

## 5) Report your bug.

Afterwards, you should be able to copy and paste your `mwe.ll` (and `reduced.ll`) example into our [compiler explorer](https://enzyme.mit.edu/explorer/).
Afterwards, you should be able to copy and paste your `mwe.ll` (or `reduced.ll`) example into the [Enzyme compiler explorer](https://enzyme.mit.edu/explorer/).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not: honestly the world “our” is fine here

@KMJ-007
Copy link
Contributor Author

KMJ-007 commented Apr 9, 2025

requested changes are done, can you review it again and merge it if there are no more edits

@ZuseZ4 ZuseZ4 merged commit de5f583 into EnzymeAD:main Apr 9, 2025
@ZuseZ4
Copy link
Collaborator

ZuseZ4 commented Apr 9, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants