Skip to content

A run chooses the GPU adapter the sidecar works on - #11

Merged
imbcmdth merged 3 commits into
mainfrom
gpu-adapter
Oct 16, 2026
Merged

imbcmdth merged 3 commits into
mainfrom
gpu-adapter

Conversation

@imbcmdth

Copy link
Copy Markdown
Owner

A run can choose the GPU adapter the sidecar works on, for its modules, the decoder, the encoders and the filters together, since all of them share the sidecar's one device.

  • Choosing: --gpu-adapter SPEC on ffrwd run and compile, or FFRWD_GPU_ADAPTER where the flag is absent; the sidecar's -gpu-adapter. A spec is an index into the adapter list or a case-insensitive part of a name, looked up in the preferred backend first (the 4090 is listed on both D3D12 and Vulkan here). No match, or two matches in one backend, is refused with the list of adapters and a hint, and no other adapter is opened; unset, nothing changes, pins included.
  • Listing: ffrwd-wasm --gpu-info prints the adapters as JSON (index, name, backend, type, vendor and device ids, the default); ffrwd setup gpu prints them as a table and says which one a run opens.
  • Spelling: the compiler passes -gpu-adapter to each sidecar that opens the device (a gpu grant, or a decode, encode or filter node) and to compile-time calls into a module granted the GPU.

On the RTX 4090 machine: the 4090 opens by 4090, nvidia, 0 and 2 (Vulkan); WARP opens by 1 or basic render and runs gpu_box with frames identical to the host path; radeon and 99 are refused with the message. Tests: Rust unit tests over synthetic adapter lists, four gpu_frames tests that run unchanged on any machine, and CLI tests of the argv spelling, the refusal, the remote refusal and setup gpu. conftest unsets the variable so a developer's setting cannot move a pin.

Not covered without a second hardware adapter: whether d3d12va decode, the _d3d12va encoders and scale_d3d12 run on a chosen non-default card. Paths that open a device of their own stay on the default card: hw=auto decoding into host memory, nvenc and AMF from host memory, ONNX Runtime's CUDA provider, and DirectML with no module granted the GPU.

Checks: cargo fmt and clippy -D warnings clean with default features and --no-default-features; lib and bins 223 and 80; gpu_frames 20; ruff and mypy clean; unit tier 5148; cookbook exec 174 passed, 1 skipped.

🤖 Generated with Claude Code

imbcmdth and others added 3 commits October 16, 2026 11:27
`-gpu-adapter <spec>`, or FFRWD_GPU_ADAPTER where the flag is absent,
names the adapter the process's one device is opened on, so the modules
granted -gpu, the decoder, the encoders and the filters sharing that
device move together. The spec is an index into the list `--gpu-info`
prints or a case-insensitive part of an adapter's name, looked for in
the preferred backend first. A spec naming no one adapter ends the run
with exit 2 when the device is first opened, naming the adapters there
are; no other adapter is opened in its place. Unset, the device opens
where it always has.

`ffrwd-wasm --gpu-info` prints each adapter's index, name, backend,
vendor and device ids, type, and whether it is the default, and with a
spec which one it names or why it is refused.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`ffrwd run` and `ffrwd compile` take `--gpu-adapter SPEC`, with
FFRWD_GPU_ADAPTER as the default where the flag is absent. Each sidecar
that opens the GPU device (a module granted -gpu, or a decode, encode
or filter node) is given `-gpu-adapter SPEC` after its grants, and so
is a compile-time call into a module granted the GPU. With neither set
no argv changes, so the printed commands and the cookbook pins stay as
they are.

Before spawning, a run checks the spec against `ffrwd-wasm --gpu-info`
and refuses one naming no one adapter as RUNTIME_NOT_FOUND, naming the
adapters there are. `ffrwd setup gpu` prints them as a table, with the
one a run opens. A remote run refuses the flag, since it runs on the
runner's own adapter.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The dialect's grants, recipe 157's paragraph on the device, and the
README's command table say how `--gpu-adapter` or FFRWD_GPU_ADAPTER
puts the device on another adapter, and that `ffrwd setup gpu` lists
them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@imbcmdth
imbcmdth merged commit 1d73326 into main Oct 16, 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.

1 participant