Add support for enabling/querying local memory exceptions.#105
Add support for enabling/querying local memory exceptions.#105oogunbow-amd wants to merge 4 commits into
Conversation
simark
left a comment
There was a problem hiding this comment.
The commit message says set/show lds-out-of-addr-range-exceptions, so I was going to say this setting should probably be under set/show amdgpu, but that's what the code actually does. So I think the commit message should be updated to reflect that.
|
Please drop period from commit log. |
60c4db1 to
5e882e9
Compare
|
I've added last untested commit [f2deb49] on Olu's request, will test at the earliest opportunity. |
oogunbow-amd
left a comment
There was a problem hiding this comment.
Fixed-up all pending reviews
|
This needs a rebase on top of current rocm-systems develop branch, and then a force-push so we run CI. |
db2504e to
2867577
Compare
2867577 to
a4d35a3
Compare
This feature allows users to detect out‑of‑address-range accesses to local memory (LDS) during debugging sessions on AMD GPU devices that support it (gfx12 and later). When enabled, the GPU hardware will report an exception when a wave attempts to access local memory beyond the allocated range, making it easier to detect and debug invalid LDS accesses. The setting is per-inferior and controlled via: - set amdgpu lds-addr-range-exception [on|off] - show amdgpu lds-addr-range-exception Usage example: (gdb) set amdgpu lds-addr-range-exception on (gdb) run ... Thread 2.1 "kern" received signal SIGBUS, Bus error. [Switching to AMDGPU Wave 1:2:1:1 (0,0,0)/0] kern (dyn_alloc=64, lds_size=65536) at test.cpp:43 43 arr[idx] = 8; /* Out-of-range access */ In this example, the kernel allocated 64 bytes of shared memory but attempts to access arr[65532], which is beyond the allocated range. With the feature enabled, GDB catches this as a SIGBUS instead of the access silently failing or causing undefined behavior. By default, the feature is off to maintain backward compatibility. If enabled but not supported by the GPU architecture, a warning is displayed. Changes: - Updated target data structures and attach/detach logic - Updated clone/fork handling to propagate the new setting - Adjusted build configuration to require amd‑dbgapi ≥ 0.81.0 Co-Authored-By: Kondratiev Alexey <Alexey.Kondratiev@amd.com>
a4d35a3 to
c9d1ee5
Compare
|
Still running into... |
You need to build it with this branch ROCm/rocm-systems#5536, it bumps amd-dbgapi to version 0.81.0 |
|
The test is finished, the CI job should be failing on gfx94X until this PR is merged ROCm/rocm-systems#8382 |
Add support for enabling/querying local memory exception reporting.
This feature allows users to detect out‑of‑address-range accesses
to local memory (LDS) during debugging sessions on AMD GPU devices
that support it (gfx12 and later).
When enabled, the GPU hardware will report an exception when a wave
attempts to access local memory beyond the allocated range, making
it easier to detect and debug invalid LDS accesses. The setting is
per-inferior and controlled via:
Usage example:
(gdb) set amdgpu lds-addr-range-exception on
(gdb) run
...
Thread 2.1 "kern" received signal SIGBUS, Bus error.
[Switching to AMDGPU Wave 1:2:1:1 (0,0,0)/0]
kern (dyn_alloc=64, lds_size=65536) at test.cpp:43
43 arr[idx] = 8; /* Out-of-range access */
In this example, the kernel allocated 64 bytes of shared memory but
attempts to access arr[65532], which is beyond the allocated range.
With the feature enabled, GDB catches this as a SIGBUS instead of
the access silently failing or causing undefined behavior.
By default, the feature is off to maintain backward compatibility.
If enabled but not supported by the GPU architecture, a warning is
displayed.
Changes:
Co-Authored-By: Kondratiev Alexey Alexey.Kondratiev@amd.com