Skip to content

Commit 535957e

Browse files
fix: single-line python in CI yaml and improve mesa driver discovery
The multi-line python block inside $() in the YAML run: | block had lines starting at column 0, which breaks the YAML scalar parser (same issue as before). Collapse to a single line. Also improve the *_drv_video.so search: use rglob instead of checking a hardcoded lib/dri/ path so the mesa VA-API backend driver is found regardless of the exact subdirectory AMD chose inside _rocm_sdk_core. The fallback diagnostic now greps the full recursive listing for dri/va/video/mesa/gallium/radeon keywords to pinpoint the layout if the driver isn't found. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f58d326 commit 535957e

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/linux_rocm.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,16 @@ jobs:
176176
# ROCm 7.14 ships mesa inside _rocm_sdk_core (no separate dnf install
177177
# needed). Point libva's driver search path at the DRI drivers bundled
178178
# there so vaInitialize() can find the amdgpu/radeonsi VA-API backend.
179-
rocm_core_dri=$(python -c "import importlib.util, pathlib; spec = importlib.util.find_spec('_rocm_sdk_core'); p = pathlib.Path(spec.submodule_search_locations[0]) if spec else None; d = p/'lib'/'dri' if p else None; print(str(d) if d and d.is_dir() else '')" 2>/dev/null || true)
179+
# Search recursively for *_drv_video.so so we find it regardless of
180+
# the exact subdirectory AMD chose (typically lib/dri/).
181+
rocm_core_dri=$(python -c "import importlib.util, pathlib; spec = importlib.util.find_spec('_rocm_sdk_core'); p = pathlib.Path(spec.submodule_search_locations[0]) if spec else None; hits = list((p/'lib').rglob('*_drv_video.so')) if p else []; print(str(hits[0].parent)) if hits else None" 2>/dev/null || true)
180182
if [ -n "${rocm_core_dri}" ]; then
181183
export LIBVA_DRIVERS_PATH="${rocm_core_dri}"
182184
echo "LIBVA_DRIVERS_PATH: ${rocm_core_dri}"
183185
else
184-
echo "WARNING: _rocm_sdk_core/lib/dri not found; listing _rocm_sdk_core/lib/ to diagnose:"
185-
python -c "import importlib.util, pathlib; spec = importlib.util.find_spec('_rocm_sdk_core'); p = pathlib.Path(spec.submodule_search_locations[0]) if spec else None; [print(x) for x in sorted((p/'lib').iterdir())] if p else None" 2>/dev/null || true
186+
echo "WARNING: no *_drv_video.so found in _rocm_sdk_core/lib; VA-API driver missing?"
187+
echo "Contents of _rocm_sdk_core/lib (recursive *_drv_video.so search):"
188+
python -c "import importlib.util, pathlib; spec = importlib.util.find_spec('_rocm_sdk_core'); p = pathlib.Path(spec.submodule_search_locations[0]) if spec else None; [print(x) for x in sorted((p/'lib').rglob('*'))] if p else None" 2>/dev/null | grep -E "dri|va|video|mesa|gallium|radeon" || true
186189
fi
187190
# Diagnostics: dump ldd on the image .so so any missing dep is visible.
188191
image_so=$(python -c "import importlib.util, pathlib; spec = importlib.util.find_spec('torchcodec'); print(pathlib.Path(spec.origin).parent / 'libtorchcodec_image.so')" 2>/dev/null || true)

packaging/install_rocjpeg.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ hits = (glob.glob('/opt/conda/**/librocjpeg.so*', recursive=True) +
4343
sys.exit(0 if hits else 1)
4444
" 2>/dev/null; then
4545
echo "librocjpeg already present (ROCm pip-wheel install); skipping dnf install."
46-
# librocjpeg links libva.so.2 at load time. The AMD VA-API backend driver
47-
# (mesa) ships inside _rocm_sdk_core since ROCm 7.14; it does NOT need a
48-
# separate dnf install. Install only the base libva soname so the dynamic
49-
# linker can resolve libva.so.2 at load time (rocJPEG's vendored
50-
# librocm_sysdeps_va.so.2 handles everything else internally).
46+
# librocjpeg links libva.so.2 at load time. Since ROCm 7.14, AMD bundles
47+
# mesa (incl. the amdgpu/radeonsi VA-API backend DRI driver) inside
48+
# _rocm_sdk_core — no separate dnf install needed. Install only the base
49+
# libva soname so the dynamic linker can resolve libva.so.2.
5150
dnf install -y libva 2>/dev/null || true
5251
else
5352
dnf install -y --refresh rocjpeg-devel libva-amdgpu mesa-amdgpu-va-drivers \

0 commit comments

Comments
 (0)