fix(agent): the game gets /dev/udmabuf in the Linux sandbox (AMD ran at 1-7 fps) #75

Merged
HumanBean merged 1 commit from HumanBean/Beanstalk:fix/sandbox-udmabuf into main 2026-11-16 19:25:35 +00:00
Owner

Why

Every AMD PC on Linux ran the game at 1-7 fps in the farm: Alberania's RX 7900 XTX at 150-1070 ms a frame, the Steam Decks at about 150 ms. Windows PCs and Linux NVIDIA ran at full speed. The game's own log showed 1-30 ms of GPU work a frame, but submit 35.41 ms in each frame's replay time. That made Linux AMD frame-time comparisons meaningless, and it caused the "inputs did not finish in time" errors.

Longshot hands the game's memory to the GPU as dma-bufs made by /dev/udmabuf (gpu/vk/vk_memory.cpp). bwrap's --dev /dev has no udmabuf, so the game fell back to host-pointer imports, which amdgpu looks up again at every submission. That file measured exactly this: 15-45 ms a submission, 3-8 fps.

What changed

  • Bwrap.Arguments passes /dev/udmabuf in with --dev-bind, next to /dev/dri, when it exists. udmabuf only makes a dma-buf of a memfd the caller already owns, so it reaches nothing outside the sandbox.
  • Bwrap.UdmabufTrouble(): the capabilities say udmabuf: true/false on Linux. A job on an AMD or Intel GPU logs a warning when the device is missing or not openable, pointing to Longshot's README for the udev rule.
  • docs/using.md: setup note for Linux AMD/Intel testers.

Tests

  • On this PC (NVIDIA, which doesn't slow down without udmabuf), a headless rc.4 game ran at the same speed in the agent's exact bwrap as outside it: 217-230 vs 180-245 fps on the title, submit 0.39 vs 0.42 ms. jabbaxipil's Linux NVIDIA farm runs were at 49-59 fps. So the sandbox and the farm's Linux build are fine; the AMD-only slowdown matches the missing udmabuf.
  • The bwrap argument check now requires --dev-bind /dev/udmabuf. Agent: 1953 checks passed; the release build has no warnings.
  • Not yet run on an AMD tester: the next Linux AMD reports will show it (submit should drop to a few ms).
## Why Every AMD PC on Linux ran the game at 1-7 fps in the farm: Alberania's RX 7900 XTX at 150-1070 ms a frame, the Steam Decks at about 150 ms. Windows PCs and Linux NVIDIA ran at full speed. The game's own log showed 1-30 ms of GPU work a frame, but `submit 35.41` ms in each frame's replay time. That made Linux AMD frame-time comparisons meaningless, and it caused the "inputs did not finish in time" errors. Longshot hands the game's memory to the GPU as dma-bufs made by `/dev/udmabuf` (`gpu/vk/vk_memory.cpp`). bwrap's `--dev /dev` has no udmabuf, so the game fell back to host-pointer imports, which amdgpu looks up again at every submission. That file measured exactly this: 15-45 ms a submission, 3-8 fps. ## What changed - `Bwrap.Arguments` passes `/dev/udmabuf` in with `--dev-bind`, next to `/dev/dri`, when it exists. udmabuf only makes a dma-buf of a memfd the caller already owns, so it reaches nothing outside the sandbox. - `Bwrap.UdmabufTrouble()`: the capabilities say `udmabuf: true/false` on Linux. A job on an AMD or Intel GPU logs a warning when the device is missing or not openable, pointing to Longshot's README for the udev rule. - docs/using.md: setup note for Linux AMD/Intel testers. ## Tests - On this PC (NVIDIA, which doesn't slow down without udmabuf), a headless rc.4 game ran at the same speed in the agent's exact bwrap as outside it: 217-230 vs 180-245 fps on the title, submit 0.39 vs 0.42 ms. jabbaxipil's Linux NVIDIA farm runs were at 49-59 fps. So the sandbox and the farm's Linux build are fine; the AMD-only slowdown matches the missing udmabuf. - The bwrap argument check now requires `--dev-bind /dev/udmabuf`. Agent: 1953 checks passed; the release build has no warnings. - Not yet run on an AMD tester: the next Linux AMD reports will show it (submit should drop to a few ms).
fix(agent): the game gets /dev/udmabuf in the Linux sandbox (AMD ran at 1-7 fps)
Some checks are pending
CI / Coordinator tests (pull_request) Waiting to run
CI / Agent build and checks (pull_request) Waiting to run
CI / Coordinator image (pull_request) Waiting to run
CI / Conventional Commit title (pull_request) Successful in 4s
CI / Workflow lint (actionlint) (pull_request) Successful in 4s
087fe3d90c
Every AMD PC on Linux ran the game at 1-7 fps in the farm (Alberania's RX
7900 XTX, the Steam Decks), NVIDIA and Windows at full speed; 35 ms a frame
went to vkQueueSubmit. Longshot hands the game's memory to the GPU as
dma-bufs made by /dev/udmabuf (gpu/vk/vk_memory.cpp); bwrap's --dev /dev
had no udmabuf, so the game fell back to host-pointer imports, which
amdgpu looks up again at every submission: the same 15-45 ms a submission
that file measured. The device is now bound like /dev/dri. udmabuf makes a
dma-buf of a memfd the caller owns, so it reaches nothing outside.

Checked on this PC (NVIDIA, so no slowdown either way): the game runs at
the same speed in the agent's bwrap as outside it (217-230 vs 180-245 fps
on the title, submit 0.39 vs 0.42 ms), and jabbaxipil's Linux NVIDIA farm
runs were at 49-59 fps: the sandbox and the farm's build were fine.

A tester whose user may not open /dev/udmabuf is warned in the app's log at
each job, and its capabilities say udmabuf: false; docs/using.md points to
Longshot's README for the udev rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean deleted branch fix/sandbox-udmabuf 2026-11-16 19:25:35 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
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.

Dependencies

No dependencies set

Reference
MagicBeanDev/Beanstalk!75
No description provided.