d3d12 checks: free the memory under an imported buffer #220

Merged
JeffreyBytes merged 1 commit from upstream-pr/220 into main 2026-11-26 11:19:35 +00:00
JeffreyBytes commented 2026-11-26 10:26:53 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-11-26T10:26:53Z.


Summary

Two controls for a hazard main has today on amdgpu (found in #191, used by #218): a host-pointer import whose pages go away while the import is still alive makes the kernel reject every later submit.

Both are modes of the existing buffer import guest. They place a 64 KiB buffer on private VirtualAlloc memory through slots 74 and 44, copy from it, free the pages, and then run unrelated upload-to-readback copies that are verified by readback (a lost device still completes the fence).

  • buffer-unmap-released destroys the buffer before freeing its pages. Later copies must arrive: mode=released later-submits=ok.
  • buffer-unmap-alive frees the pages while the buffer still exists. Whether later submits survive is the host driver's behavior, so the control reports later-submits=ok or later-submits=lost and passes with either. Nothing in the provider can prevent it for memory the title frees itself, so this is a record of the host, not a gate.

On the RX 6700 XT the alive mode prints radv/amdgpu: The CS has been rejected, see dmesg for more information (-14), vkd3d-proton reports VK_ERROR_DEVICE_LOST, and all three later copies read back 0 of 256 words, including the one made after the buffer is released. The released mode reads back 256 of 256. These are the same messages ProjectScarlett ends with after a page remap when imports are direct.

Not included: a variant on XMem pages (remap or unmap with the import alive, later submits still work). As discussed on #218, that belongs with the XMem side that has to honor the hold.

Verified on Lanes

  • python tuxbox.py check passed on this branch — all stages but "Shader translator on the GPU", which also fails on main here (#219)
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below

This adds regression controls only; no provider code changes.

GPU, driver and backend: AMD Radeon RX 6700 XT (1002:73df), Mesa RADV 26.3.1, Linux 7.3.6, Proton backend with GE-Proton11-14.

  • This changes code both vendors run, and the check passed on an AMD and an NVIDIA card. NVIDIA still needs to run it. I expect buffer-unmap-alive to report later-submits=ok there, but have no card to confirm.
  passed   Build the shader compiler (0s)
  passed   Python tests (3s)
  passed   Shader compiler tests (0s)
  passed   DXBC tests (0s)
  passed   XG layout tests (1s)
  passed   D3D12 Windows typecheck (0s)
  passed   Build (21s)
  passed   Lanes and fixtures on the GPU (152s)
  passed   D3D12 regression controls (357s)
  FAILED   Shader translator on the GPU (609s)

The translator stage fails the same way on main on this machine and this branch does not touch it: #219.

Receipts for the new cases:

d3d12-buffer-unmap PASS pci=1002:73df mode=alive later-submits=lost
d3d12-buffer-unmap PASS pci=1002:73df mode=released later-submits=ok

Checks

python -m unittest tests.test_d3d12_regressions covers the two receipt rules. No evidence JSON changes.

<!-- greyfinch-sync:brcly/TuxBox:issue:5508278044 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/220). Originally posted by [JeffreyBytes](https://github.com/JeffreyBytes) on 2026-11-26T10:26:53Z. --- ## Summary Two controls for a hazard `main` has today on amdgpu (found in #191, used by #218): a host-pointer import whose pages go away while the import is still alive makes the kernel reject every later submit. Both are modes of the existing buffer import guest. They place a 64 KiB buffer on private `VirtualAlloc` memory through slots 74 and 44, copy from it, free the pages, and then run unrelated upload-to-readback copies that are verified by readback (a lost device still completes the fence). - `buffer-unmap-released` destroys the buffer before freeing its pages. Later copies must arrive: `mode=released later-submits=ok`. - `buffer-unmap-alive` frees the pages while the buffer still exists. Whether later submits survive is the host driver's behavior, so the control reports `later-submits=ok` or `later-submits=lost` and passes with either. Nothing in the provider can prevent it for memory the title frees itself, so this is a record of the host, not a gate. On the RX 6700 XT the alive mode prints `radv/amdgpu: The CS has been rejected, see dmesg for more information (-14)`, vkd3d-proton reports `VK_ERROR_DEVICE_LOST`, and all three later copies read back 0 of 256 words, including the one made after the buffer is released. The released mode reads back 256 of 256. These are the same messages ProjectScarlett ends with after a page remap when imports are direct. Not included: a variant on XMem pages (remap or unmap with the import alive, later submits still work). As discussed on #218, that belongs with the XMem side that has to honor the hold. ## Verified on Lanes - [ ] `python tuxbox.py check` passed on this branch — **all stages but "Shader translator on the GPU", which also fails on `main` here (#219)** - [x] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below This adds regression controls only; no provider code changes. GPU, driver and backend: AMD Radeon RX 6700 XT (`1002:73df`), Mesa RADV 26.3.1, Linux 7.3.6, Proton backend with GE-Proton11-14. - [ ] This changes code both vendors run, and the check passed on an AMD and an NVIDIA card. **NVIDIA still needs to run it.** I expect `buffer-unmap-alive` to report `later-submits=ok` there, but have no card to confirm. ```text passed Build the shader compiler (0s) passed Python tests (3s) passed Shader compiler tests (0s) passed DXBC tests (0s) passed XG layout tests (1s) passed D3D12 Windows typecheck (0s) passed Build (21s) passed Lanes and fixtures on the GPU (152s) passed D3D12 regression controls (357s) FAILED Shader translator on the GPU (609s) ``` The translator stage fails the same way on `main` on this machine and this branch does not touch it: #219. Receipts for the new cases: ```text d3d12-buffer-unmap PASS pci=1002:73df mode=alive later-submits=lost d3d12-buffer-unmap PASS pci=1002:73df mode=released later-submits=ok ``` ## Checks `python -m unittest tests.test_d3d12_regressions` covers the two receipt rules. No evidence JSON changes.
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
brcly/TuxBox!220
No description provided.