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

Manually merged
github merged 1 commit from github-bot/gh-220 into main 2026-11-26 11:23:33 +00:00 AGit
Owner

@⁠JeffreyBytes on GitHub · 2026-11-26 10:26 UTC · original
JeffreyBytes:test/buffer-unmap-control → main · +112 −1 · 3 files · 1 commits · merged 2026-11-26 11:19 UTC

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.

**@⁠JeffreyBytes** on GitHub · 2026-11-26 10:26 UTC · [original](https://github.com/brcly/TuxBox/pull/220) `JeffreyBytes:test/buffer-unmap-control` → `main` · +112 −1 · 3 files · 1 commits · merged 2026-11-26 11:19 UTC ## 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.
Two controls for the buffer import guest, with private VirtualAlloc
memory placed through slots 74 and 44.

buffer-unmap-released destroys the buffer, frees its pages, and then
requires unrelated upload-to-readback copies to arrive.

buffer-unmap-alive frees the pages while the buffer still exists. On
amdgpu every later submit is then rejected ("The CS has been rejected
(-14)") and the device is lost, which is how ProjectScarlett dies after
a page remap when imports are direct. Whether this happens is the host
driver's behaviour, so the control reports later-submits=ok or lost and
passes with either.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:55:56 +00:00
github manually merged commit 1ef7732182 into main 2026-11-26 11:23:33 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.