mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-08 11:31:25 +00:00
SAM 2: read the wgpu env variables and refuse adapters without compute shaders (#2900)
SAM 2's instance now reads wgpu's environment variables, as the render context's does, so a driver such as Mesa's Dozen (WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER=1) is visible to it, and WGPU_POWER_PREF applies. An adapter without compute shaders is refused before a device is made on it, so the CPU takes over with one line instead of a validation error per kernel. The refused adapter is kept for the life of the process, as the device on it was: dropping it crashed the tests on WSL2's GL driver. Gpu::shared no longer repeats "SAM 2 compute:" in its errors.
This commit is contained in:
1 parent
a646bdcc2e
commit
50e5a7970e
4 files changed
+75
-11
No files matched your search
@@ -155,7 +155,9 @@ of clicks, and measured confidence collapses with many (0.99 with 1–7 points,
|
||||
## Speed (this PC: AMD RX 7900 GRE and a 16-thread CPU, release build)
|
||||
SAM 2 runs on the GPU when there is one (wgpu compute kernels, so AMD, NVIDIA and Intel alike; candle itself has no AMD
|
||||
backend) and on the CPU otherwise. The model loads on the GPU automatically; `EFFECTCRAFT_SAM2_DEVICE=cpu` (or `gpu`)
|
||||
overrides it. A GPU that fails (no adapter, out of memory, a lost device) makes the CPU take over for the rest of the
|
||||
overrides it. wgpu's environment variables apply to the adapter it picks (`WGPU_BACKEND`, `WGPU_POWER_PREF`,
|
||||
`WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER`…); a software adapter, or one without compute shaders, leaves SAM 2 on
|
||||
the CPU. A GPU that fails (no adapter, out of memory, a lost device) makes the CPU take over for the rest of the
|
||||
session, and `roto.status` reports `tracker.device` (the GPU's name, or `CPU`).
|
||||
|
||||
| Step | CPU | GPU |
|
||||
|
||||
Reference in new issue
Block a user