Skip to content

launcher: wake the live shader worker for a request while jobs run - #283

Merged
brcly merged 1 commit into
brcly:mainfrom
NickStallman:perf/live-worker-wake
Nov 26, 2026
Merged

brcly merged 1 commit into
brcly:mainfrom
NickStallman:perf/live-worker-wake

Conversation

@NickStallman

Copy link
Copy Markdown
Contributor

Problem

While any job is running, the live shader worker waits on its futures with a 50 ms timeout and doesn't listen for the request directory's notification. A request published beside a running compile waits for the next rescan: about 50 ms at the median. An idle worker already wakes on the notification in 2-3 ms. Raised in Discussion #229.

Change

A finished job writes to a pipe that the notification wait polls together with the inotify descriptor. One wait now serves both, and the worker uses it whether or not jobs are running. Without inotify, the worker waits on its futures with the 50 ms rescan, as before. No compiler flags, cache identities, worker counts or request order change.

Measured

Host worker only: four workers, real xshader, DXC and dxv, no guest and no GPU. 30 quick recorded ProjectScarlett requests, with their DXIL already stored, were published one at a time beside one long compute compile that was still running at the end. Three runs each, median reply time:

main this change
beside a long compile 50.4, 50.5, 50.8 ms 1.8, 1.7, 2.4 ms
no other job running 2.3, 2.3, 2.9 ms 2.3, 2.4, 2.3 ms

This is the latency of one host worker request. It is not a frame-time or load-time measurement, and I haven't measured how often a title publishes a request beside a running compile.

Tests

  • New test in tests/test_runtime_shader_workers.py: a request published 10 ms after a blocked job starts must start within 20 ms. It takes 35 ms on main, so it fails there 3 times out of 3, and it passes 30 times out of 30 with the change. It runs through serve with real directory notifications.
  • No Lanes scenario: the change is in the host worker's scheduling, and Lanes has no timing gate for one request beside another.

Checks (on e76ff6a)

  • python -m unittest discover -s tests -q: OK.
  • AMD Raphael iGPU (1002:13c0), RADV (Mesa 26.0.8), GE-Proton11-14: the full python tuxbox.py check --adapter 1002:13c0 --proton … --prefix … --windows-dxc … passed, 120 gates. An earlier run on the previous base failed lanes-selftest-compute-frame once, while a game compile was loading the machine. It passed in 3 of 3 reruns on this branch, and in 3 of 3 on main, so I count it as load, not this change.
  • RTX 5090 (10de:2b85), driver 620.70.10, GE-Proton11-14: the same full check passed, 120 gates.

Note: #240 edits the same loop. It keeps the 50 ms wait, so the two are independent, but whichever merges second needs a small rebase.

🤖 Generated with Claude Code

While any job was running, the live worker waited on its futures with a
50 ms timeout and did not listen for the directory notification, so a
request published beside a running compile waited for the next rescan.
An idle worker already woke on the notification.

A finished job now writes to a pipe that the notification wait polls
with the inotify descriptor, so one wait serves both and the worker uses
it whether or not jobs are running. Without inotify the worker waits on
its futures with the bounded rescan, as before.

A serial stream of 30 quick recorded ProjectScarlett requests beside one
long compute compile, four workers, real xshader, DXC and dxv, three
runs each: the median reply went from 50.4-50.8 ms to 1.7-2.4 ms. With
no other job running it is 2.3-2.9 ms either way. This is the host
worker alone, with no guest and no GPU.

A new test publishes a request 10 ms after a blocked job starts and
expects it to start within 20 ms. It took 35 ms before the change. The
381 Python tests and the no-GPU check pass. The full GPU check was not
run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@brcly
brcly merged commit 9b90087 into brcly:main Nov 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants