Fix NPU turbo key and priviledges set (#24138)

This commit is contained in:
Nicolas Mowen 2026-08-30 11:15:49 -06:00 committed by GitHub
parent 890512b054
commit ab20815584
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 8 deletions

View File

@ -24,6 +24,7 @@ shopt -s nullglob
device_globs=(
"/dev/dri/*"
"/dev/accel/*"
"/dev/apex_*"
"/dev/hailo*"
"/dev/video*"

View File

@ -124,7 +124,7 @@ The escape hatch never changes ownership, and it clears the record of the last s
Frigate grants the runtime user access to your devices at startup. Pass your hardware with `--device` (or `devices:` in compose) and detection and hardware acceleration work with no group or udev setup on the host.
The grant covers the common accelerator and camera nodes: GPU render nodes, Coral, Hailo, Rockchip, Jetson, `/dev/video*`, and the USB bus. For hardware it misses, add your own paths with `DEVICE_ACL_PATHS`, a comma separated list of globs:
The grant covers the common accelerator and camera nodes: GPU render nodes, Intel/AMD NPUs (`/dev/accel`), Coral, Hailo, Rockchip, Jetson, `/dev/video*`, and the USB bus. For hardware it misses, add your own paths with `DEVICE_ACL_PATHS`, a comma separated list of globs:
```yaml
environment:

View File

@ -338,6 +338,8 @@ models:
### Intel NPU host requirements {#intel-npu-requirements}
The NPU device must be passed into the container by adding `/dev/accel:/dev/accel` to the `devices` section of your compose file. Frigate grants the runtime user access to the device automatically; see [hardware device access](/configuration/non_root#hardware-device-access) if you manage device permissions yourself.
The NPU firmware is loaded by the host kernel and is not part of the Frigate image. Everything else the NPU needs is bundled in the container, so host NPU libraries should never be mounted in.
Frigate bundles a specific version of Intel's [linux-npu-driver](https://github.com/intel/linux-npu-driver/releases), and the host firmware must come from that release or a newer one. Firmware older than the bundled driver may fail with `MAPPED_INFERENCE_VERSION is NOT compatible with the ELF`, where `Expected` is the version the firmware supports and `received` is the version the bundled compiler produced. Distributions often package older firmware than the driver Frigate ships, so check the build date on the host with `sudo dmesg | grep -i vpu` and update it there if needed.

View File

@ -320,17 +320,28 @@ class OpenVINOModelRunner(BaseModelRunner):
except Exception as e:
logger.debug(f"GPU_QUEUE_THROTTLE not supported: {e}")
# Some keys must be passed as compile-time config so that it can be caught
compile_config = {}
if device == "NPU" and OpenVINOModelRunner.is_detection_model(model_type):
try:
self.ov_core.set_property(device, {"NPU_TURBO": "YES"})
except Exception as e:
logger.debug(f"NPU_TURBO not supported by driver: {e}")
compile_config["NPU_TURBO"] = "YES"
# Compile model under the shared lock
with _OPENVINO_LOCK:
self.compiled_model = self.ov_core.compile_model(
model=model_path, device_name=device
)
try:
self.compiled_model = self.ov_core.compile_model(
model=model_path, device_name=device, config=compile_config
)
except RuntimeError as e:
if not compile_config:
raise
logger.debug(
f"Failed to compile with {compile_config}, retrying without: {e}"
)
self.compiled_model = self.ov_core.compile_model(
model=model_path, device_name=device
)
# Create reusable inference request
self.infer_request = self.compiled_model.create_infer_request()