-
Notifications
You must be signed in to change notification settings - Fork 549
Add get_aie_coredump_elf() API for generating coredump (ET_CORE) ELF #9997
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
base: master
Are you sure you want to change the base?
Changes from all commits
627ddc0
ec9db67
4faa92d
6eb994f
a5c4ec7
ca1e98e
08078ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3154,7 +3154,10 @@ class run_impl : public std::enable_shared_from_this<run_impl> | |
| } | ||
|
|
||
| // abort_coredump_or_noop() - AIE coredump if enabled | ||
| // Dump core and abort, or do nothing. | ||
| // Write AIE coredump ELF to the configured file then abort. | ||
| // std::abort() ensures the OS reclaims driver resources (hw_context, hardware | ||
| // state) after a timeout. Users who set xrt.ini to capture AIE coredump | ||
| // have already observed the timeout exception on a prior run. | ||
| void | ||
| abort_coredump_or_noop(ert_cmd_state state) const | ||
| { | ||
|
|
@@ -3167,12 +3170,22 @@ class run_impl : public std::enable_shared_from_this<run_impl> | |
|
|
||
| try { | ||
| auto hwctx = kernel->get_hw_context(); | ||
| auto core = hwctx.get_aie_coredump(); // may throw | ||
| // Use the ELF from this run's own module | ||
| // Each ELF has its own UUID; using the run's module ensures the | ||
| // correct UUID is embedded in the coredump metadata. | ||
| if (!m_module) | ||
| throw std::runtime_error("AIE coredump ELF not available: no ELF associated with this run"); | ||
|
|
||
| auto elf = xrt::elf{xrt_core::module_int::get_elf_handle(m_module)}; | ||
|
|
||
| auto core = xrt_core::hw_context_int::get_aie_coredump_elf(hwctx, elf); | ||
|
|
||
| std::ofstream ostr{file, std::ios::binary}; | ||
| if (!ostr) | ||
| throw std::runtime_error("Could not open '" + file + "' for writing"); | ||
|
|
||
| ostr.write(core.data(), static_cast<std::streamsize>(core.size())); | ||
| ostr.flush(); // flush before abort — destructors do not run after std::abort() | ||
| std::abort(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there was a mention that we should not abort on coredump, but the original spec said we should. I want to make sure remove std::abort() is indeed correct.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should keep the std::abort() to make sure driver clean up hw_context after timeout. We don't have to get the exception message and coredump() at one run. When usesrs set xrt.ini to save aie coredump, they already see the timeout and exception message. |
||
| } | ||
| catch (const std::exception& ex) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.