Stubs: record R8/R9 argument registers of stub calls in the report #2722
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2722
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2722"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@amazedturnip on GitHub · 2026-11-26 08:29 UTC · original
amazedturnip:xcl/stubs-record-r8-r9-argument-registers-081516→main· +114 −7 · 3 files · 1 commits · openRecord 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— 1311 passed, 1 failed, 27 ignored (SKIPPED GPU tests: 1 (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), 1 (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), 1 (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), 1 (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), 1 (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), 1 (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #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:
The first run of this commit lost the device at 10.6 s (0x887a0007), right after XCL's "a command list is submitted while its previous submit is still on the GPU" warning (the race #2320 addresses). This iGPU loses the device that way now and then on builds of
maintoo. The PR block above is the second run of the same commit.Not tested
AI use
@luckyteagirl on GitHub · 2026-11-26 08:33 UTC · original · reviewed
I found a concurrency issue in the new R8/R9 diagnostics at head
77158b0(baseb49be18). This is a source-derived review; I did not run a native concurrent title test.record_call_with_argsassigns the call ordinal withfetch_addand storesfirst_callerbefore taking theARGSmutex. 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 sayfirst_caller=A,first_args=B, andlast_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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.