runtime: include HRESULT in D3D12 traces #2312

Closed
ZroIsHere wants to merge 1 commit from upstream-pr/2312 into main
ZroIsHere commented 2026-11-26 13:44:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ZroIsHere on 2026-11-26T13:44:46Z.


--trace-d3d12 currently records failed calls without their HRESULT, making it hard to distinguish unsupported operations from invalid arguments and other failures. Include the hexadecimal HRESULT on failed calls. Keep E_NOTIMPL classified as unsupported and successful calls as ok.

Validation: the Windows/MSVC RelWithDebInfo gta6rt build passed. A retail run with translated shaders recorded four ID3D12Device2::CreatePipelineState failures as hr=0x80070057 (E_INVALIDARG), which the old trace reduced to the generic word failed. No tests were run.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5511152491 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2312). Originally posted by [ZroIsHere](https://github.com/ZroIsHere) on 2026-11-26T13:44:46Z. --- `--trace-d3d12` currently records failed calls without their HRESULT, making it hard to distinguish unsupported operations from invalid arguments and other failures. Include the hexadecimal HRESULT on failed calls. Keep `E_NOTIMPL` classified as `unsupported` and successful calls as `ok`. Validation: the Windows/MSVC RelWithDebInfo `gta6rt` build passed. A retail run with translated shaders recorded four `ID3D12Device2::CreatePipelineState` failures as `hr=0x80070057` (`E_INVALIDARG`), which the old trace reduced to the generic word `failed`. No tests were run.
lixonik commented 2026-11-26 17:57:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T17:57:31Z.

Review: COMMENTED


The exact PR head built with MSVC on Windows 11. The d3d12_trace CTest failed at entry #10 because its event parser rejects the new failure suffix. Details inline.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6078688733 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2312#pullrequestreview-6078688733). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T17:57:31Z. **Review:** COMMENTED --- The exact PR head built with MSVC on Windows 11. The `d3d12_trace` CTest failed at entry #10 because its event parser rejects the new failure suffix. Details inline. AI-assisted.
lixonik commented 2026-11-26 17:57:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T17:57:31Z.

Code review location: runtime/shims/d3d12_trace.h; line 40

@@ -33,7 +33,15 @@ inline void record(const char* method, const char* outcome = "called") noexcept
 }
 
 inline HRESULT result(const char* method, HRESULT code) noexcept {
-    record(method, code == E_NOTIMPL ? "unsupported" : FAILED(code) ? "failed" : "ok");
+    if (code == E_NOTIMPL) {
+        record(method, "unsupported");
+    } else if (FAILED(code)) {
+        char outcome[40]{};
+        std::snprintf(outcome, sizeof(outcome), "failed (hr=0x%08lx)", static_cast<unsigned long>(code));

[P2] Update the trace parser alongside the new failure suffix.

ctest -R '^d3d12_trace$' fails on Windows 11 at entry #10 with ID3D12GraphicsCommandList::Close failed (hr=0x80004005). runtime/test/check_d3d12_trace.py full-matches a bare failed outcome and rejects that event before checking the sequence. Can the parser accept the HRESULT field and still compare the same event kind?

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4711969003 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2312#discussion_r4711969003). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T17:57:31Z. **Code review location:** `runtime/shims/d3d12_trace.h`; line 40 ~~~~diff @@ -33,7 +33,15 @@ inline void record(const char* method, const char* outcome = "called") noexcept } inline HRESULT result(const char* method, HRESULT code) noexcept { - record(method, code == E_NOTIMPL ? "unsupported" : FAILED(code) ? "failed" : "ok"); + if (code == E_NOTIMPL) { + record(method, "unsupported"); + } else if (FAILED(code)) { + char outcome[40]{}; + std::snprintf(outcome, sizeof(outcome), "failed (hr=0x%08lx)", static_cast<unsigned long>(code)); ~~~~ --- [P2] Update the trace parser alongside the new failure suffix. `ctest -R '^d3d12_trace$'` fails on Windows 11 at entry #10 with `ID3D12GraphicsCommandList::Close failed (hr=0x80004005)`. `runtime/test/check_d3d12_trace.py` full-matches a bare `failed` outcome and rejects that event before checking the sequence. Can the parser accept the HRESULT field and still compare the same event kind?
MoonEyes commented 2026-11-27 22:43:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T22:43:20Z.


Hi @ZroIsHere, thanks for this pull request.

CONTRIBUTING.md asks contributors to claim their work in the coordination issue ("Coordinating who works on what", currently #1608) before opening a pull request: post claiming: <ID> there, or a one-line description if the item is not listed yet, and put the ID in the pull request. I could not find a claim from you for this one.

The claim matters because "it is claimed in the coordination issue by the pull request's author" is the first item on the maintainers' checklist for a mergeable pull request, and because it lets others see that the work is taken before they write it a second time.

Could you post the claim in #1608 and put its ID (or a link to it) on the pull request's "Claimed in the coordination issue as:" line? If you already claimed it in another form, a link to your comment is enough.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7229562762 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2312#issuecomment-7229562762). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T22:43:20Z. --- Hi @ZroIsHere, thanks for this pull request. CONTRIBUTING.md asks contributors to claim their work in the coordination issue ("Coordinating who works on what", currently #1608) before opening a pull request: post `claiming: <ID>` there, or a one-line description if the item is not listed yet, and put the ID in the pull request. I could not find a claim from you for this one. The claim matters because "it is claimed in the coordination issue by the pull request's author" is the first item on the maintainers' checklist for a mergeable pull request, and because it lets others see that the work is taken before they write it a second time. Could you post the claim in #1608 and put its ID (or a link to it) on the pull request's "Claimed in the coordination issue as:" line? If you already claimed it in another form, a link to your comment is enough. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 16:43:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:43:41Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7318114891 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2312#issuecomment-7318114891). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:43:41Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2312
No description provided.