Repository navigation
Stubs: record R8/R9 argument registers of stub calls in the report - #2722
amazedturnip wants to merge 1 commit into
Conversation
luckyteagirl
left a comment
There was a problem hiding this comment.
I found a concurrency issue in the new R8/R9 diagnostics at head 77158b0 (base b49be18). This is a source-derived review; I did not run a native concurrent title test.
record_call_with_args assigns the call ordinal with fetch_add and stores first_caller before taking the ARGS mutex. If call A gets ordinal 0 and pauses during first-call logging, call B can get ordinal 1 and insert B's arguments into the empty side table. A then acquires the mutex and overwrites the last arguments. After both calls, the report can say first_caller=A, first_args=B, and last_args=A. Neither argument pair matches the ordinal implied by its label.
Could the side table record the first/last ordinal alongside the arguments and update each field only when the incoming ordinal is earlier/later, or otherwise serialize ordinal assignment with the table update? A two-thread fixture that forces the first caller to enter the table second would cover the first and last fields. Logging and hooks can remain outside the mutex.
AI assistance: GPT-6.2 Sol identified the interleaving; GPT-6.2 Astra independently checked the exact-head source and wording.
|
Fixed per the review: the ARGS side table now records (first_ord, last_ord, first_r8, first_r9, last_r8, last_r9) per info and updates each field only when the incoming ordinal is strictly earlier/later. Ordinal assignment still happens via fetch_add before the ARGS mutex (logging/hooks remain outside), but no field is overwritten by an out-of-order caller now. A two-thread fixture ( |
77158b0 to
315e3f8
Compare
Record the 3rd/4th Win64 argument registers (R8/R9) at stub-thunk call time and surface them in report.json as first_args/last_args per called stub, to diagnose which console slots actually receive which values. Args are kept in a side table keyed by the StubInfo pointer so no StubInfo fields or thunk bytes change (avoids overlap with open #936/#1155). Tests pin first/last/call-count and serde on/off; verified on the AMD Radeon iGPU retail build.
What is in it
crates/xcl/src/stubs.rs:stub_reportnow takes(r8, r9)and records first/last R8/R9 per stub in a side-table keyed by the StubInfo pointer (no StubInfo field changes, no thunk-bytes changes).crates/xcl/src/report.rs:StubCallgains optionalfirst_args/last_args(hex, serde default + skip_serializing_if empty);build()emits them fromstub_args.crates/xcl/src/stubs_args_tests.rs(new sibling test module): thunk call records first/last R8/R9 and call count; arglessrecord_callleaves the side table empty; StubCall with args serializes them, without args omits them.Tested
AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64),XCL_ADAPTER=radeon):cargo test --workspace -- --test-threads=2— 1312 passed, 1 failed, 27 ignored (SKIPPED GPU tests: 1 (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), 1 (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), 1 (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), 1 (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), 1 (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), 1 (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), 1 (cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)); pre-existing upstream/main failures excluded: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1)Regression run
main:
PR:
Not tested
AI use