feat(gpu): 添加 QSV 硬件加速支持

- 实现 QSV 设备初始化逻辑,支持 Intel 核显
- 区分 QSV 和 CUDA 设备初始化流程
- 添加 QSV 设备验证和配置处理
- 更新设备检测逻辑以支持不同硬件加速类型
- 实现 QSV 设备名称格式化和可用性设置
This commit is contained in:
2026-02-07 00:25:43 +08:00
parent 9b373dea34
commit 9d16d3c6af

View File

@@ -61,11 +61,14 @@ class GPUScheduler:
configured_devices = self._config.gpu_devices
if configured_devices:
# 使用配置指定的设备
if self._config.hw_accel == HW_ACCEL_QSV:
# QSV 使用 Intel 核显,无 nvidia-smi,直接按配置或默认设备初始化
self._devices = self._init_qsv_devices(configured_devices)
elif configured_devices:
# CUDA:使用配置指定的设备并通过 nvidia-smi 验证
self._devices = self._validate_configured_devices(configured_devices)
else:
# 自动检测所有设备
# CUDA:自动检测所有 NVIDIA 设备
self._devices = self._auto_detect_devices()
if self._devices:
@@ -75,6 +78,25 @@ class GPUScheduler:
else:
logger.warning("No GPU devices available, scheduler disabled")
def _init_qsv_devices(self, configured_indices: List[int]) -> List[GPUDevice]:
"""
初始化 QSV 设备列表
QSV 使用 Intel 核显,没有 nvidia-smi 可用于检测。
若配置了 GPU_DEVICES 则直接信任配置,否则使用默认设备 0。
Args:
configured_indices: 配置的设备索引列表(可为空)
Returns:
QSV 设备列表
"""
indices = configured_indices if configured_indices else [0]
return [
GPUDevice(index=idx, name=f"QSV-{idx}", available=True)
for idx in indices
]
def _validate_configured_devices(self, indices: List[int]) -> List[GPUDevice]:
"""
验证配置的设备列表