report apu heap allocations that fail #1719

Merged
imjustprism merged 1 commit from upstream-pr/1720 into main 2026-11-25 21:51:12 +00:00
imjustprism commented 2026-11-24 21:17:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by imjustprism on 2026-11-24T21:17:46Z.


when the host allocator refuses an apu heap allocation, ApuAlloc returns E_OUTOFMEMORY and nothing is written anywhere. the title in #289 does not check that result and crashes a moment later on a write near null, so the crash log points at the title instead of at the cause. the refusal now goes to crashes.log with the size and the system commit, the same way the commit-limit report in xmem does, and a request that no device-address range fits gets a warning. both are reported by the caller after its locks are dropped. what the title sees does not change.

checked live: running the title in a job object with a 7.1 GB per-process commit cap reproduces #289, and crashes.log then starts with the refused allocation (about 401 MiB) and the commit numbers. only the report text has a unit test, the host allocator cannot be made to return null in one. clippy both ways, cargo test --workspace (343 passed) and xtask policy on windows 11.

#538 does the same for XMemVirtualAlloc and XMemAllocDefault and touches the same part of xmem.rs, so the two will conflict. #528 and #237 also touch ApuAlloc.

refs #289

<!-- greyfinch-sync:Marvisak/VIctory:issue:6591602928 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1720). Originally posted by [imjustprism](https://github.com/imjustprism) on 2026-11-24T21:17:46Z. --- when the host allocator refuses an apu heap allocation, ApuAlloc returns E_OUTOFMEMORY and nothing is written anywhere. the title in #289 does not check that result and crashes a moment later on a write near null, so the crash log points at the title instead of at the cause. the refusal now goes to crashes.log with the size and the system commit, the same way the commit-limit report in xmem does, and a request that no device-address range fits gets a warning. both are reported by the caller after its locks are dropped. what the title sees does not change. checked live: running the title in a job object with a 7.1 GB per-process commit cap reproduces #289, and crashes.log then starts with the refused allocation (about 401 MiB) and the commit numbers. only the report text has a unit test, the host allocator cannot be made to return null in one. clippy both ways, cargo test --workspace (343 passed) and xtask policy on windows 11. #538 does the same for XMemVirtualAlloc and XMemAllocDefault and touches the same part of xmem.rs, so the two will conflict. #528 and #237 also touch ApuAlloc. refs #289
DenRakEiw commented 2026-11-24 21:28:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T21:26:25Z.

Review: APPROVED


Verified locally merged onto origin/main (Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-hle — 96 passed, 0 failed (including allocator_refusal_report_names_apu_heap_and_system_commit)
  • cargo clippy -p victory-hle --all-targets — 0 warnings
  • cargo xtask policy — ok

Clean diagnostics reporting failed APU heap allocations alongside system commit status, with unit test coverage. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6047682849 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1720#pullrequestreview-6047682849). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T21:26:25Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test -p victory-hle` — 96 passed, 0 failed (including `allocator_refusal_report_names_apu_heap_and_system_commit`) - `cargo clippy -p victory-hle --all-targets` — 0 warnings - `cargo xtask policy` — ok Clean diagnostics reporting failed APU heap allocations alongside system commit status, with unit test coverage. Looks good. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-24 22:02:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:36:41Z.

Review: COMMENTED


Static review only: this crate is Windows-only (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; source review of the diff.

APU heap refusals are now reported with their cause: HeapRefusal::NoDeviceRange (size+align) warns, HostAllocator delegates to report_allocator_refusal which writes crashes.log — and report() is called with no lock held, which matters if the refusal path can run under the heap lock. Please confirm no caller holds the heap mutex when report() runs.

<!-- greyfinch-sync:Marvisak/VIctory:review:6047807586 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1720#pullrequestreview-6047807586). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T21:36:41Z. **Review:** COMMENTED --- Static review only: this crate is Windows-only (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; source review of the diff. APU heap refusals are now reported with their cause: HeapRefusal::NoDeviceRange (size+align) warns, HostAllocator delegates to report_allocator_refusal which writes crashes.log — and report() is called with no lock held, which matters if the refusal path can run under the heap lock. Please confirm no caller holds the heap mutex when report() runs.
Marvisak commented 2026-11-25 04:06:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:35:56Z.


Automated triage for the maintainers.

Merge candidate. When the host allocator or the device-address range refuses an APU heap block, heap_alloc (audio.rs) now returns a HeapRefusal, and the callers (ApuAlloc, AcpHalAllocateShapeContexts) report it after dropping their locks. A host refusal goes to crashes.log through the new xmem::report_allocator_refusal, which shares its text with the existing commit-limit report. The HRESULT the title sees does not change. The lock order is fine: the HEAP guard is released on return, and CONTEXTS is dropped before report().

Update after your reply: confirmed, the branch now merges cleanly with main, so the #538 conflict is gone. CI passes.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7152063823 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1720#issuecomment-7152063823). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T03:35:56Z. --- <!-- victory-triage v1 head=bef186b082fd296efdff626fed784f535d058b62 verdict=merge-candidate at=2026-11-25T07:19:06Z --> Automated triage for the maintainers. **Merge candidate.** When the host allocator or the device-address range refuses an APU heap block, `heap_alloc` (`audio.rs`) now returns a `HeapRefusal`, and the callers (`ApuAlloc`, `AcpHalAllocateShapeContexts`) report it after dropping their locks. A host refusal goes to crashes.log through the new `xmem::report_allocator_refusal`, which shares its text with the existing commit-limit report. The HRESULT the title sees does not change. The lock order is fine: the HEAP guard is released on return, and CONTEXTS is dropped before `report()`. Update after your reply: confirmed, the branch now merges cleanly with `main`, so the #538 conflict is gone. CI passes. --- _Generated by [Claude Code](https://claude.ai/code)_
imjustprism commented 2026-11-25 05:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by imjustprism on 2026-11-25T04:14:39Z.


the description is out of date on one point: #538 is merged and this branch is rebased over it, so the xmem.rs conflict it mentions is gone. it merges clean into main at 940d32f and ci is green.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7152663917 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1720#issuecomment-7152663917). Originally posted by [imjustprism](https://github.com/imjustprism) on 2026-11-25T04:14:39Z. --- the description is out of date on one point: #538 is merged and this branch is rebased over it, so the xmem.rs conflict it mentions is gone. it merges clean into main at 940d32f and ci is green.
StExpeditus commented 2026-11-25 10:07:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by StExpeditus on 2026-11-25T09:30:28Z.


Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at bef186b. cargo test --workspace --locked --no-fail-fast -> 694 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7158423800 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1720#issuecomment-7158423800). Originally posted by [StExpeditus](https://github.com/StExpeditus) on 2026-11-25T09:30:28Z. --- **Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24.** Branch at `bef186b`. `cargo test --workspace --locked --no-fail-fast` -> 694 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.
upstream-sync closed this pull request 2026-11-25 22:03:05 +00:00
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
Marvisak/VIctory!1719
No description provided.