runtime/test: only release output pointer when SUCCEEDED(hr) in pipeline library host test (TEST-PIPELINE-LIBRARY-HOST-RELEASE) #1757

Closed
abnalstlll-byte wants to merge 2 commits from upstream-pr/1757 into main
abnalstlll-byte commented 2026-11-25 11:20:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T11:20:51Z.


Claimed in Issue #1608: claiming: TEST-PIPELINE-LIBRARY-HOST-RELEASE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7160887151).

Summary

Resolves the finding by @whoalin1 regarding d3d12_pipeline_library_host crashing with 0xc0000409 (STATUS_STACK_BUFFER_OVERRUN / fail-fast) on RTX 4070 SUPER and AMD gfx1036 (comment 7156997734).

In runtime/test/d3d12_pipeline_library_host_test.cpp:243:
one_step previously executed:

if (written && c.out && hr != HRESULT(kFaulted)) static_cast<IUnknown*>(c.out)->Release();

Calling Release() on an output pointer when FAILED(hr) (e.g. E_NOINTERFACE in step 13 "create: as ID3D12Fence" or E_INVALIDARG) violates COM interface conventions. When a driver or host runtime writes an invalid sentinel or uninitialized pointer on failure, invoking Release() triggers an immediate fail-fast exception (0xc0000409) or access violation that SEH __except (EXCEPTION_EXECUTE_HANDLER) cannot survive.

  • Guard the COM Release() call with SUCCEEDED(hr):
if (SUCCEEDED(hr) && written && c.out) static_cast<IUnknown*>(c.out)->Release();
  • Adds synthetic regression unit test tests/test_d3d12_pipeline_library_host_release.py.

Verification

  • python -I tests/test_d3d12_pipeline_library_host_release.py -> 1/1 PASS in 0.000s.
  • python -I scripts/check_no_game_data.py runtime/test/d3d12_pipeline_library_host_test.cpp tests/test_d3d12_pipeline_library_host_release.py -> Clean (0 violations).
  • 100% clean merge against upstream HEAD bcaa13dad.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5490349277 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1757). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-25T11:20:51Z. --- Claimed in Issue #1608: `claiming: TEST-PIPELINE-LIBRARY-HOST-RELEASE` (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7160887151). ### Summary Resolves the finding by @whoalin1 regarding `d3d12_pipeline_library_host` crashing with `0xc0000409` (STATUS_STACK_BUFFER_OVERRUN / fail-fast) on RTX 4070 SUPER and AMD gfx1036 (comment 7156997734). In `runtime/test/d3d12_pipeline_library_host_test.cpp:243`: `one_step` previously executed: ```cpp if (written && c.out && hr != HRESULT(kFaulted)) static_cast<IUnknown*>(c.out)->Release(); ``` Calling `Release()` on an output pointer when `FAILED(hr)` (e.g. `E_NOINTERFACE` in step 13 "create: as ID3D12Fence" or `E_INVALIDARG`) violates COM interface conventions. When a driver or host runtime writes an invalid sentinel or uninitialized pointer on failure, invoking `Release()` triggers an immediate fail-fast exception (`0xc0000409`) or access violation that SEH `__except (EXCEPTION_EXECUTE_HANDLER)` cannot survive. - Guard the COM `Release()` call with `SUCCEEDED(hr)`: ```cpp if (SUCCEEDED(hr) && written && c.out) static_cast<IUnknown*>(c.out)->Release(); ``` - Adds synthetic regression unit test `tests/test_d3d12_pipeline_library_host_release.py`. ### Verification - `python -I tests/test_d3d12_pipeline_library_host_release.py` -> 1/1 PASS in 0.000s. - `python -I scripts/check_no_game_data.py runtime/test/d3d12_pipeline_library_host_test.cpp tests/test_d3d12_pipeline_library_host_release.py` -> Clean (0 violations). - 100% clean merge against upstream HEAD `bcaa13dad`. AI-assisted (Claude Code).
PierreEbele commented 2026-11-25 18:24:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T18:24:30Z.


Reviewed 22c7a93: ran the new regression test (passes on the PR, fails when copied onto main, so it does pin the change) plus test_ci_registration and check_no_game_data, both clean; the C++ test itself needs Windows/MSVC (SEH), so I could not run it here. The SUCCEEDED(hr) guard does fix the reported E_NOINTERFACE-style release of garbage out-pointers, but it also drops the old hr != HRESULT(kFaulted) exclusion, and kFaulted (0xFA017ED) is a positive HRESULT, so SUCCEEDED(kFaulted) is true: a step whose call raised an exception after writing its out pointer - the partially initialized driver object case the message describes - is released again, outside the SEH guard, i.e. the uncatchable fail-fast class. Probe decision table (guard arithmetic from the source): kFaulted + written + c.out -> main skips Release, PR calls it; E_NOINTERFACE + written -> main called it, PR skips it (the intended fix). The residency test already uses hr != kFaulted && SUCCEEDED(...); suggest if (hr != HRESULT(kFaulted) && SUCCEEDED(hr) && written && c.out) and pinning both terms in the test. Whether any current host step faults after writing its output needs a Windows run. Could not check the coordination-issue claim (no GitHub access).

AI-assisted review.

Recommendation: Fix first

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7170865718 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1757#issuecomment-7170865718). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T18:24:30Z. --- Reviewed 22c7a93: ran the new regression test (passes on the PR, fails when copied onto main, so it does pin the change) plus test_ci_registration and check_no_game_data, both clean; the C++ test itself needs Windows/MSVC (SEH), so I could not run it here. The SUCCEEDED(hr) guard does fix the reported E_NOINTERFACE-style release of garbage out-pointers, but it also drops the old `hr != HRESULT(kFaulted)` exclusion, and kFaulted (0xFA017ED) is a positive HRESULT, so SUCCEEDED(kFaulted) is true: a step whose call raised an exception after writing its out pointer - the partially initialized driver object case the message describes - is released again, outside the SEH guard, i.e. the uncatchable fail-fast class. Probe decision table (guard arithmetic from the source): kFaulted + written + c.out -> main skips Release, PR calls it; E_NOINTERFACE + written -> main called it, PR skips it (the intended fix). The residency test already uses `hr != kFaulted && SUCCEEDED(...)`; suggest `if (hr != HRESULT(kFaulted) && SUCCEEDED(hr) && written && c.out)` and pinning both terms in the test. Whether any current host step faults after writing its output needs a Windows run. Could not check the coordination-issue claim (no GitHub access). AI-assisted review. **Recommendation:** Fix first
abnalstlll-byte commented 2026-11-25 21:37:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T21:37:15Z.


Thanks @PierreEbele! Updated in 5e4ae90a7:

  • Preserved \hr != HRESULT(kFaulted)\ alongside \SUCCEEDED(hr)\ in \one_step\ (matching \d3d12_residency_test.cpp:393) so positive-sign \kFaulted\ (0xFA017ED) steps never attempt an unhandled Release outside SEH.
  • Guarded \d3d12_pipeline_library_host_test\ in
    untime/CMakeLists.txt\ with \if(MSVC)\ to explicitly enforce the MSVC SEH compiler requirement.
  • Rebased cleanly onto latest \main\ (\e34ff17e9).

AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175320394 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1757#issuecomment-7175320394). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-25T21:37:15Z. --- Thanks @PierreEbele! Updated in 5e4ae90a7: - Preserved \hr != HRESULT(kFaulted)\ alongside \SUCCEEDED(hr)\ in \one_step\ (matching \d3d12_residency_test.cpp:393\) so positive-sign \kFaulted\ (0xFA017ED) steps never attempt an unhandled Release outside SEH. - Guarded \d3d12_pipeline_library_host_test\ in \ untime/CMakeLists.txt\ with \if(MSVC)\ to explicitly enforce the MSVC SEH compiler requirement. - Rebased cleanly onto latest \main\ (\e34ff17e9\). AI-assisted (Claude Code)
zmasi commented 2026-11-28 12:41:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:41:33Z.


#1757 | head 5e4ae90a7b (merged cleanly with main d48a957bb9) | python -I tests/test_d3d12_pipeline_library_host_release.py + ctest --test-dir runtime/build -C RelWithDebInfo -R "^d3d12_pipeline_library_host$" --output-on-failure (LEONIDA_VK_VALIDATION=1) | red on main: test_d3d12_pipeline_library_host_release.py fails (AssertionError: 'SUCCEEDED(hr)' not found in one_step; note: on RTX 3090's host D3D12 driver failed steps do not write a non-null invalid sentinel to c.out, so d3d12_pipeline_library_host did not fault on main) | green on PR+main: test_d3d12_pipeline_library_host_release.py passes (1/1) and d3d12_pipeline_library_host passes (72 steps compared with the host, 0 mismatches) on RTX 3090 with 0 Khronos validation errors; check_no_game_data.py 0 violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7239401552 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1757#issuecomment-7239401552). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T12:41:33Z. --- #1757 | head 5e4ae90a7bc836d90a8784d1574116d6eb03f5e4 (merged cleanly with main d48a957bb9988afce424552a3c0c8d01ef12320f) | `python -I tests/test_d3d12_pipeline_library_host_release.py` + `ctest --test-dir runtime/build -C RelWithDebInfo -R "^d3d12_pipeline_library_host$" --output-on-failure` (`LEONIDA_VK_VALIDATION=1`) | red on main: `test_d3d12_pipeline_library_host_release.py` fails (`AssertionError: 'SUCCEEDED(hr)' not found` in `one_step`; note: on RTX 3090's host D3D12 driver failed steps do not write a non-null invalid sentinel to `c.out`, so `d3d12_pipeline_library_host` did not fault on `main`) | green on PR+main: `test_d3d12_pipeline_library_host_release.py` passes (`1/1`) and `d3d12_pipeline_library_host` passes (`72 steps compared with the host, 0 mismatches`) on RTX 3090 with `0` Khronos validation errors; `check_no_game_data.py` `0` violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes
OreoFR commented 2026-11-29 01:21:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:21:13Z.


Verified by OreoFR

  • Base: main 48bae6cad + PR head 5e4ae90a7 (tested as a merge)
  • Test: python -I tests/test_d3d12_pipeline_library_host_release.py; d3d12_pipeline_library_host_test built
  • Red on main: 1 FAIL (SUCCEEDED(hr) not found in one_step of main's host test)
  • Green with the PR: 1 test OK; the host test compiles with the new if(MSVC) guard. Not run: it needs the Vulkan GPU, which another job was using
  • gta6rt link: OK (gta6rt.exe builds and links; dumpbin /dependents shows the same DLLs as main, no network DLL)
  • Verdict: READY (the PR also merges without conflict on the newer main 5825b02ff)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248726642 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1757#issuecomment-7248726642). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T01:21:13Z. --- **Verified by OreoFR** - Base: main `48bae6cad` + PR head `5e4ae90a7` (tested as a merge) - Test: `python -I tests/test_d3d12_pipeline_library_host_release.py`; `d3d12_pipeline_library_host_test` built - Red on main: 1 FAIL (`SUCCEEDED(hr)` not found in `one_step` of main's host test) - Green with the PR: 1 test OK; the host test compiles with the new `if(MSVC)` guard. Not run: it needs the Vulkan GPU, which another job was using - gta6rt link: OK (`gta6rt.exe` builds and links; `dumpbin /dependents` shows the same DLLs as main, no network DLL) - Verdict: READY (the PR also merges without conflict on the newer main `5825b02ff`) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 17:23:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:23:57Z.


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:7319235990 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1757#issuecomment-7319235990). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:23:57Z. --- 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!1757
No description provided.