gdb.rocm: select precise-memory fault insn by XNACK mode - #332
Conversation
lancesix
left a comment
There was a problem hiding this comment.
If the device supports it, should we try to test both the HSA_XNACK modes?
If we support both modes on a machine and we can easily configure it, I think we should do it. |
|
@spatrang Given we need to confirm where the fix should land, could you please prototype a dbgapi-side fix? If the fix is in dbgapi, technically we wouldn't need to deal with this situation in rocgdb, and then we could drop this PR. |
Sure, let me give a try from dbgapi side. |
|
I am not sure it would be trivial to apply, as dbgapi does not know how a particular process is configured regarding xnack-replay. My best guess for now is that we should update the documentation specifying that with precise memory, the PC might be at the faulty insn or just after it depending on the xnack-replay configuration (this is what we have today anyway). Having dbgapi auto-correct would probably imply needing to have knowledge of the xnack configuration (so needs to be advertised to us by the driver), and we need to ensure we do not double fixup (a scenario like: we get a memviol, show it in the debugger, create a coredump with |
|
Let's go with the rocgdb + updated documentation strategy. |
4ba8bb7 to
03e6f3d
Compare
|
Rebased onto amd-staging and resolved the rocm.exp conflict with the new generic_target_for proc by keeping both procs. |
|
Looks good to me as-is, but Lancelot suggested we check if both modes are supported and proceed to try them both to make sure they do the expected thing. |
|
This is an automated-assisted review.
with:
|
03e6f3d to
3b2789b
Compare
|
Updated the PR based on the review feedback.
Validated on both machines, both modes pass:
Both boxes can be forced to either mode, so both iterations run and pass on each. |
|
This is an automated-assisted review.
The helper returns a list of supported modes ( if {[hip_device_xnack_supported]} {
with_test_prefix "xnack on" { do_test 1 {s_load_dword[ \t][^\r\n]*} }
}
with_test_prefix "xnack off" { do_test 0 {s_nop[ \t]+0} }Worth confirming with the driver/hardware team whether a device can ever be locked to XNACK-on such that
The triple-variable # Iterate {mode request expected_insn} triples.
foreach { mode request expected_insn } { ... } |
The precise-memory fault location depends on the GPU XNACK (memory retry) mode. With XNACK enabled the faulting s_load_dword is replayable, so the wave stops on it. With XNACK disabled the wave stops on the following s_nop. The test previously expected the s_nop unconditionally, which failed on machines running with XNACK enabled. Add a hip_device_xnack_supported helper to lib/rocm.exp that probes whether the device can enable XNACK. Every device can run with it off, so run the test with XNACK off unconditionally and add the XNACK on run only when supported, forcing the mode with HSA_XNACK and checking the expected instruction. Also update the precise-memory documentation to describe the XNACK-dependent location. The behavior is left as is in amd-dbgapi, which already permits it. A fix there would still require handling the same case for core files in rocgdb.
3b2789b to
7335375
Compare
|
Simplified per the review. Replaced the list-returning helper with a bool hip_device_xnack_supported that only probes whether XNACK can be turned on. The test now runs the XNACK off path unconditionally (every device can run with it off) and adds the XNACK on path only when supported. Also updated the commit message to match. Re-validated on both machines, both paths pass:
|
Summary
gdb.rocm/precise-memory.expfailed on MI325X while passing on MI300X, even though both are gfx942. The divergence is driven by XNACK mode, not architecture: with XNACK enabled the faultings_load_dwordis replayable, so the wave halts on that instruction; with XNACK disabled the PC advances to the followings_nop.Change
s_nop.hip_device_xnack_onhelper tolib/rocm.expthat readshipDeviceProp_t::gcnArchName, whose feature suffix (e.g.gfx942:sramecc+:xnack+) reflects the runtime mode set byHSA_XNACKand device config.Distinct per-mode expectations are kept (rather than accepting both) to preserve the test's ability to catch a fault-PC regression.
Test
HSA_XNACK=1): PASSMade with Cursor