Repository navigation
[DebugInfo] Support global addresses in variable locations - #5029
Closed
ampandey-AMD wants to merge 10000 commits into
Closed
ampandey-AMD wants to merge 10000 commits into
ampandey-AMD wants to merge 10000 commits into
Conversation
makes progress on: #4601
…predicates (llvm#227258)" This reverts commit e5430fc.
)" This reverts commit d6cb583.
Mirror the upstream device-init and image-registration path onto amd-staging, leaving local XNACK, APU zero-copy, and team-proc behavior in place.
This reverts commit 8908e9c.
…ch (#4836) - Add OF_ForceSyncOps BoolEnvar and forceSyncOps() on GenericDeviceTy with actual spelling: OFFLOAD_FORCE_BLOCKING - Add shouldForceSync predicate and drain external async info objects in AsyncInfoWrapperTy::finalize() when the flag is set Downstream version of llvm#222635
This is the downstream-adjusted version of llvm#225639 --------- Co-authored-by: Dhruva Chakrabarti <dhruva.chakrabarti@amd.com> Co-authored-by: Michael Halkenhauser <michaelgerald.halkenhauser@amd.com>
## Motivation This is a refactor. It prepares the next pull request, "[Comgr] Use a cached unbundle output in place". That pull request uses a cached unbundle output without writing it to a file. It needs a function that splits the cached output into the contents of each output file. ## Technical Details - New function: `UnbundleCommand::splitCachedOutput`. It reads the cached output and returns the contents of each output file, in the order of `Config.OutputFileNames`. It does not write a file. - `UnbundleCommand::writeExecuteOutput` now calls `splitCachedOutput`, then writes each output file. - Behavior change: `writeExecuteOutput` now checks the full cache entry before it writes the first file. Before this change, it could write some files and then return an error. - The cache entry format does not change. The error messages do not change. ## Test Plan 1. Add `test-lit/cache-tests/unbundle-cached-bad-entry.hip`. The test fills the cache and then damages the cache entry in two ways: - It sets the size of the first output to a value larger than the entry. The entry deserializes, but `splitCachedOutput` returns an error. - It truncates the entry. The entry does not deserialize. In both cases, the test makes sure that Comgr unbundles the input again and that the result is the same as the result of a cache miss. 2. Add `test-lit/cache-tests/unbundle-cached-many-outputs.hip`. It unbundles 5 bundle entries and compares a cache hit and a damaged entry with a cache miss. It also checks the `target-cpu` of each output, so the outputs must be in the order of the bundle entry IDs. The `unbundle` test driver now takes more than one bundle entry. 3. Mutation test: write the cached outputs in reverse order. `unbundle-cached-many-outputs.hip` fails. The single-output tests pass. 4. Build LLVM, clang, lld, device-libs, and Comgr in-tree from `amd-staging` (`8cd9ac8c8f12`). 5. Run the Comgr LIT tests and the Comgr CTest tests. 6. Run clang-format on the changed lines. ## Test Result - New tests: pass. - Comgr LIT tests: 32 pass, 1 fails, 119 unsupported. `clang-resource-dir.hip` also fails on `amd-staging` without this change, in the same build. - Comgr CTest tests: 32 of 32 pass. - clang-format: no changes.
…#4844) The gfx1250 entry sequence enables multi-group replay with a MODE bit that has a different meaning on gfx942. Omit the exact immediate enable at kernel entry for gfx1250 to gfx942. Raising discards source register allocation and scheduling -- regenerated target code must satisfy gfx942’s own replay rules. We refuse other writes overlapping the source replay field.
The tests are covered by the ones added in `llvm/test/CodeGen/AMDGPU/GlobalISel/ashr.ll` in llvm#140940. Part of upstream divergence effort.
…lvm#232349) (#5009) Move the Record Replay calls to record a kernel launch to libomptarget. The routines themselves remain inside the PluginInterface. This allow to remove fields from KernelLaunchArgs that were specific to RR so we can further align to liboffload kerenl launch (still not there). Downstream: KernelLaunchArgsTy keeps the full downstream KernelLaunchInfo, which buildLaunchArgs() still fills in; its RequestedNumBlocks field is removed, as record/replay now gets it from KernelRecordArgsTy. Co-authored-by: Alex Duran <alejandro.duran@intel.com>
…m#220092) LLDB's `lldb_private::lzma` is currently the only xz decompressor in the tree. It reads the ELF `.gnu_debugdata` (MiniDebugInfo) section, whose embedded symbol table can sometimes be the only source of function names in a stripped binary. Move it to `'llvm::compression::xz` so that other tools like llvm-gsymutil can use it. - Only decompression is implemented and it's kept out of `compression::Format` since it's not written by LLVM and is produced by an extra packaging step. It also doesn't model the schemes usable for SHF_COMPRESSED sections, which are self-describing via some type of `ELFCOMPRESS_*` constant, which doesn't exist for XZ. - Reformats the ported code to LLVM standards, but avoids other functional changes unless a comment was specifically made on the PR to address it. There is a latent bug in the ported code where `lzma_index_buffer_decode()` was passed a pointer to the stream index but the size of the whole stream, which could've caused it to technically read past the end of the buffer. Valid streams aren't currently affected since the index is self-delimiting and CRC-checked, so this will just be addressed in a following PR. - `LLDB_ENABLE_LZMA` is replaced by `LLVM_ENABLE_LZMA`, and is default to ON globally. Cases where LLDB_ENABLE_LZMA and LLVM_ENABLE_LZMA are in disagreement will fail, and otherwise, uses of LLDB_ENABLE_LZMA will result in deprecation warnings. - In the Bazel overlay, @llvm-project//lldb:lzma=system flag can no longer work for the same reason, so it is replaced by --@llvm-project//third-party:llvm_enable_lzma=true via a new //third-party:lzma target alongside the existing zlib and zstd wrappers. Added a unit test testing the decompression Existing LLDB unit tests of minidebuginfo still passing Tested with `LLVM_ENABLE_LZMA` both on and off, check-llvm, and check-lldb-shell are clean.
…llvm#227159) ## Summary A stripped ELF binary may keep a [.gnu_debugdata section](https://sourceware.org/gdb/current/onlinedocs/gdb.html/MiniDebugInfo.html) ("MiniDebugInfo"), which is an xz-compressed ELF object whose .symtab holds the function symbols that were stripped out of the main object and are not exported through .dynsym. llvm-gsymutil ignored it, causing stripped binaries like AMD's `libhsa-runtime64.so` to show up with unknown function info. - Refactors code to move the symbol table loop out of `convert()` and into a `loadSymbols()` helper so it can also be used for `.dynsym` and for the `.symtab` embedded inside of the `.gnu_debugdata`. - Also adds a helper `loadGnuDebugDataSymbols()` to decompress the section and parse the embedded object. Note that the dynamic symbols are needed because MiniDebugInfo normally omits symbols already exported through .dynsym. ## Testing Unit tests in ElfObjectFileTest.cpp and llvm-gsymutil tests On a stripped `libhsa-runtime64.so`, llvm-gsymutil goes from 0 functions to 4219. Assisted-by: Codex
- paramerized pr workflow_dispatch merges llvm/llvm-project pull requests into compiler/amd-llvm submodule - raising the git depth to 100 provides extra history for the merge to find a recent common ancestor
Keep a workflow_dispatch entry on the default branch so Run workflow is available, and always call the implementation on amd-compiler-ci.
Reland the upstream change on amd-staging by reverting ead1180, the commit that dropped it. Later GlobalISel coverage in dbg-value-globaladdr-gisel.ll stays, with its XFAIL removed, and the new LiveDebugValues tests use the current live-debug-values pass name.
AMDGPU location lists walk DIOp expressions, and that walker only understood the older E_Global entry. E_GlobalAddress fell through to llvm_unreachable and crashed the assembly printer in release builds. Spell those arguments with addGlobalAddress so the address pool can carry them.
ampandey-AMD
force-pushed
the
reland-3ea3f78121b2dfda02da00493cce8bed37484e7d
branch
from
October 19, 2026 09:28
9ad1ab5 to
43736d7
Compare
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Author
|
Wrong Pull Request to repository. |
ampandey-AMD
deleted the
reland-3ea3f78121b2dfda02da00493cce8bed37484e7d
branch
October 19, 2026 09:38
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.
This patch adds support for global address locations to SelectionDAG, GlobalISel and AsmPrinter. The actual implementation is very similar to how constants are being handled so most code changes are very mechanical.
The motivation for adding global address support is the Swift compiler and it is needed even in unoptimized code. For example, the standard libary implements the empty array with a global "empty array storage" singleton object, so it can show up as the location of array values. Another very common use-case are references to type metadata, which is also accessed via global symbols.
It is even possible to motivate this with a C exmple:
extern int g; int *p = &g;
also produces the dbg_value with a global value.
This patch adds an SDDbgOperand kind for a global address which gets lowered to a MO_GlobalAddress DBG_VALUE operand, a DbgValueLocEntry, and finally DW_OP_addrx/DW_OP_stack_value, similar to how global DITemplateValueParameter are handled.
In AsmPrinter the address pool is preferred, its index is plain data that both a DIE and the byte stream backing a location list can hold. Before DWARF 5 the pool is only available under split DWARF, so fall back to a relocated DW_OP_addr, which only a DIE can carry. Emit no location at all when neither is possible.
Not handled are thread locals, which need DW_OP_form_tls_address, dllimport, whose address requires a load from the import address table, and ifuncs, whose symbol address is not the value of the pointer.
rdar://156549577
Assisted-by: Claude