Optimize memory usage on UMA Host(Integrated graphics) #649

Open
opened 2026-12-02 09:11:54 +00:00 by revonateB0T · 2 comments
revonateB0T commented 2026-12-02 09:11:54 +00:00 (Migrated from github.com)
Contributor

Imported from brcly/TuxBox. Originally posted by revonateB0T on 2026-12-02T09:11:54Z.


I will try make it work on 16GB 7840HS + Radeon 780M
Now that Xbox S have 10GB GDDR6, 4 TFLOPS RDNA2 Gpu, in theory, there should be a way to get it running on my machine.

<!-- greyfinch-sync:brcly/TuxBox:issue:6741151888 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/issues/649). Originally posted by [revonateB0T](https://github.com/revonateB0T) on 2026-12-02T09:11:54Z. --- I will try make it work on 16GB 7840HS + Radeon 780M Now that Xbox S have 10GB GDDR6, 4 TFLOPS RDNA2 Gpu, in theory, there should be a way to get it running on my machine.
brcly commented 2026-12-02 21:35:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from brcly/TuxBox. Originally posted by brcly on 2026-12-02T21:35:40Z.


Thanks. The work for this is in #653 (hold less memory on an integrated GPU), which was measured on a Radeon 780M and includes docs/UMA.md describing where memory goes on a UMA host. It reaches the title screen there but not yet the scene, because of the render-target copies. Let's keep this issue open as the tracking issue for that work. #653 needs a rebase onto main and an NVIDIA run before it can merge.

<!-- greyfinch-sync:brcly/TuxBox:comment:7359501489 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/issues/649#issuecomment-7359501489). Originally posted by [brcly](https://github.com/brcly) on 2026-12-02T21:35:40Z. --- Thanks. The work for this is in #653 (hold less memory on an integrated GPU), which was measured on a Radeon 780M and includes `docs/UMA.md` describing where memory goes on a UMA host. It reaches the title screen there but not yet the scene, because of the render-target copies. Let's keep this issue open as the tracking issue for that work. #653 needs a rebase onto main and an NVIDIA run before it can merge.
revonateB0T commented 2026-12-02 21:44:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from brcly/TuxBox. Originally posted by revonateB0T on 2026-12-02T21:44:05Z.


Thanks for the pointer. #653 stays open as the tracking issue.

Most of my work sits on top of c1139ab287f9b112b95c3c3862204da806b56b82, which was main when I started. It has moved a long way since — #659, #660 and #662 are in it now — so #653 needs the rebase, and I have not pushed anything of my own yet.

I split out the two commits that make a visible difference on this host, both on top of master:

  • d3d12: share one budget for the buffers kept for reuse — the staging and readback buffers the provider keeps for reuse were per queue and per worker: twelve check pools of their own, and a readback pool for every queue. They share one pool and one budget now.
  • d3d12: keep digests of game memory, not a second copy — a shadow heap kept a full copy of the guest's bytes so the CPU's changes could be told from the GPU's. It keeps a 64-bit digest per 64-byte block instead, so the shadow is 1.125 times the range rather than 2.

Measured on a Radeon 780M under GE-Proton11-16, section path, same prefix and profile:

shadows provider heap driver system memory
before 1481 MiB 1762 MiB 1575 MiB
after 834 MiB 1080 MiB 927 MiB

Both are for the section path, and neither helps the private path: with private pages the provider makes no shadow at all, so the digest change is unused, and the check pool the shared budget is about never starts. I measured that rather than assuming it — in private mode the driver's video memory stays at 3738 MiB and the render target heaps stay at 3127 MiB (572 of them) on every build I ran; the only thing that moves is the provider's own heap, by about 50 MiB, from the cache limits following the host's memory.

That is also why I have been running the private path: the section path's own overhead is what does not fit on this host.

The private path did not run at all before. The GPU lost the device within seconds, because a tile import maps a whole private span while the hold covered one page, so the pages beside it could be released while the GPU still mapped them, and the kernel refused the submission. That is #660, and it is merged now. With it the title reaches the scene — its streaming requests reach zero — at about 120 frames a second instead of 5, and it does not go green, because the green screen is the page-table refusal of #656, which the private path does not meet.

So the plan now: rebase onto the current main, re-measure the section path under the same conditions, and confirm those two commits still do what they measured on c1139ab2. The rest of #653 is the UMA detection and the ledger, and on this host they do not move the numbers — the driver reports a non-zero dedicated video memory for this adapter, so the "one memory pool" path does not trigger, and forcing it with TUXBOX_HOST_PROFILE=memory=unified only moves the same 3749 MiB from the driver's video memory to the host's.

One thing I cannot do here is the NVIDIA run: this machine has a Radeon 780M and no NVIDIA card.

<!-- greyfinch-sync:brcly/TuxBox:comment:7359704422 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/issues/649#issuecomment-7359704422). Originally posted by [revonateB0T](https://github.com/revonateB0T) on 2026-12-02T21:44:05Z. --- Thanks for the pointer. #653 stays open as the tracking issue. Most of my work sits on top of `c1139ab287f9b112b95c3c3862204da806b56b82`, which was `main` when I started. It has moved a long way since — #659, #660 and #662 are in it now — so #653 needs the rebase, and I have not pushed anything of my own yet. I split out the two commits that make a visible difference on this host, both on top of master: - **`d3d12: share one budget for the buffers kept for reuse`** — the staging and readback buffers the provider keeps for reuse were per queue and per worker: twelve check pools of their own, and a readback pool for every queue. They share one pool and one budget now. - **`d3d12: keep digests of game memory, not a second copy`** — a shadow heap kept a full copy of the guest's bytes so the CPU's changes could be told from the GPU's. It keeps a 64-bit digest per 64-byte block instead, so the shadow is 1.125 times the range rather than 2. Measured on a Radeon 780M under GE-Proton11-16, section path, same prefix and profile: | | shadows | provider heap | driver system memory | | --- | --- | --- | --- | | before | 1481 MiB | 1762 MiB | 1575 MiB | | after | 834 MiB | 1080 MiB | 927 MiB | Both are for the section path, and neither helps the private path: with private pages the provider makes no shadow at all, so the digest change is unused, and the check pool the shared budget is about never starts. I measured that rather than assuming it — in private mode the driver's video memory stays at 3738 MiB and the render target heaps stay at 3127 MiB (572 of them) on every build I ran; the only thing that moves is the provider's own heap, by about 50 MiB, from the cache limits following the host's memory. That is also why I have been running the private path: the section path's own overhead is what does not fit on this host. The private path did not run at all before. The GPU lost the device within seconds, because a tile import maps a whole private span while the hold covered one page, so the pages beside it could be released while the GPU still mapped them, and the kernel refused the submission. That is #660, and it is merged now. With it the title reaches the scene — its streaming requests reach zero — at about 120 frames a second instead of 5, and it does not go green, because the green screen is the page-table refusal of #656, which the private path does not meet. So the plan now: rebase onto the current `main`, re-measure the section path under the same conditions, and confirm those two commits still do what they measured on `c1139ab2`. The rest of #653 is the UMA detection and the ledger, and on this host they do not move the numbers — the driver reports a non-zero dedicated video memory for this adapter, so the "one memory pool" path does not trigger, and forcing it with `TUXBOX_HOST_PROFILE=memory=unified` only moves the same 3749 MiB from the driver's video memory to the host's. One thing I cannot do here is the NVIDIA run: this machine has a Radeon 780M and no NVIDIA card.
Sign in to join this conversation.
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#649
No description provided.