Add support for enabling/querying local memory exceptions.#105
Add support for enabling/querying local memory exceptions.#105oogunbow-amd wants to merge 1 commit intoamd-stagingfrom
Conversation
This feature allows users to detect out‑of‑address-range accesses to local memory (LDS) during debugging sessions using new set/show lds-out-of-addr-range-exceptions commands. Updated target data structures, attach/detach logic, and clone/fork handling to propagate the new setting. Adjusted build configuration to require amd‑dbgapi ≥ 0.81.0.
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.
| - set amdgpu lds-out-of-addr-exception | ||
| - show amdgpu lds-out-of-addr-exception | ||
|
|
||
| ## ROCgdb-X for ROCm-next |
There was a problem hiding this comment.
these new added lines are duplicate and should be removed.
## ROCgdb-X for ROCm-next
### Added
The new entries should also go at the end of the "Added" list.
| cmds = add_setshow_boolean_cmd ("lds-out-of-address-range-exception", no_class, | ||
| _("Set lds-out-of-address-range-exception mode."), | ||
| _("Show lds-out-of-address-range-exception mode."), _("\ | ||
| If on, local memory out-of-address-range exception reporting is enabled if/when\n\ |
There was a problem hiding this comment.
looks like you copy/pasted this from the code block above, nonetheless I think "if/when" is not adding any value. a mere "when" would suffice.
| /* Callback for "show amdgpu lds-out-of-address-range-exception". */ | ||
|
|
||
| static void | ||
| show_local_memory_out_of_addr_range_exception_mode (struct ui_file *file, int from_tty, |
There was a problem hiding this comment.
right now, this line is above 80 column limit (87 chars to be exact).
the function name is 50 characters long. show_lds_addr_range_excp_mode() maybe? the same holds true for other functions.
|
|
||
| static void | ||
| show_local_memory_out_of_addr_range_exception_mode (struct ui_file *file, int from_tty, | ||
| struct cmd_list_element *c, const char *value) |
There was a problem hiding this comment.
The alignment of the text is off.
I'm going to suppress other GNU coding standard violations at this point. Please find and fix them.
| return info.precise_alu_exceptions.enabled; | ||
| } | ||
|
|
||
| /* Callback for "show amdgpu lds-out-of-address-range-exception". */ |
There was a problem hiding this comment.
lds-addr-range-exception ?
| @@ -0,0 +1,57 @@ | |||
| # Copyright (C) 2022-2025 Advanced Micro Devices, Inc. All rights reserved. | |||
| @@ -0,0 +1,48 @@ | |||
| /* Copyright (C) 2022-2025 Advanced Micro Devices, Inc. All rights reserved. | |||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
|
|
||
| #define CHECK(cmd) \ |
There was a problem hiding this comment.
#include "rocm-test-utils.h" and drop the definition of CHECK().
| } \ | ||
| } | ||
|
|
||
| typedef void (*func_ptr) (); |
There was a problem hiding this comment.
why this typedef? I don't see func_ptr used anywhere.
| # You should have received a copy of the GNU General Public License | ||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| # Test debugging a program that branches to a bad address. Check that |
There was a problem hiding this comment.
I don't think this description is up-to-date. moreover, maybe shared-exceptions is not the best name for this test.
| "Warning: precise memory violation signal reporting is not enabled, reported" \ | ||
| "location may not be accurate. See \"show amdgpu precise-memory\"\\." \ | ||
| "Warning: local memory out-of-address-range exception reporting is not enabled\\." \ | ||
| "See \"show amdgpu lds-out-of-addr-exception\"\\." \ |
There was a problem hiding this comment.
So what happens if you turn this on? Please explain it in the commit log, ideally with a short/concise example.
| copy the precise memory request, it will be applied when the process | ||
| starts. */ | ||
| copy the precise memory and local memory request, it will be applied when | ||
| the process starts. */ |
There was a problem hiding this comment.
We now have two things, so some words must be adjusted for plural:
request => requests
it will be => they will be
| set_local_memory_out_of_addr_range_exception_mode, | ||
| get_local_memory_out_of_addr_range_exception_mode, | ||
| show_local_memory_out_of_addr_range_exception_mode, | ||
| &set_amdgpu_list, &show_amdgpu_list); |
There was a problem hiding this comment.
This setting / feature must be documented in the GDB manual.
|
Please drop period from commit log. |
This feature allows users to detect out‑of‑address-range accesses to local memory (LDS) during debugging sessions using new set/show lds-out-of-addr-range-exceptions commands.
Updated target data structures, attach/detach logic, and clone/fork handling to propagate the new setting. Adjusted build configuration to require amd‑dbgapi ≥ 0.81.0.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist