You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rocm: simplify decoder to hardware-only backend and remove test infra
rocJPEG only supports the HARDWARE backend (per AMD). Remove all HYBRID
backend code (handle, lazy init, split_images_by_backend, decode_hybrid,
is_hw_decodable_jpeg, force_hybrid workaround) and replace the two-handle
design with a single handle_ created at construction. The decoder now
calls rocJpegDecode directly for every image using the hardware backend.
Also remove test infrastructure from linux_rocm.yaml that was added to
work around VA-API initialization failures: LD_LIBRARY_PATH/LIBVA env
var setup, ldd diagnostics, test dependency install, and the pytest
runner. The install-and-test job now only verifies that the wheel
installs cleanly.
Co-authored-with: AI assistant
Co-authored-by: Cursor <cursoragent@cursor.com>
# ROCm 7.14 pip-wheel layout: librocjpeg lives in _rocm_sdk_core/lib and
166
-
# its transitive deps (librocm_sysdeps_va.so.2 etc.) are in
167
-
# _rocm_sdk_core/lib/rocm_sysdeps/lib. The RPATH on libtorchcodec_image.so
168
-
# points to _rocm_sdk_core/lib, and AMD's own RPATH on librocjpeg handles
169
-
# the sysdeps. Set LD_LIBRARY_PATH as belt-and-suspenders for the HIP
170
-
# runtime (libamdhip64) that librocjpeg needs.
171
165
rocm_core_lib=$(python -c "import importlib.util, pathlib, os; spec = importlib.util.find_spec('_rocm_sdk_core'); p = pathlib.Path(spec.submodule_search_locations[0]) if spec else None; dirs = [str(p/'lib'), str(p/'lib'/'rocm_sysdeps'/'lib')] if p else []; print(os.pathsep.join(d for d in dirs if pathlib.Path(d).is_dir()))" 2>/dev/null || true)
# ROCm 7.14 ships mesa inside _rocm_sdk_core (no separate dnf install
177
-
# needed). libva auto-detects the DRM driver name as "radeonsi" from the
178
-
# kernel, then looks for "${driver}_drv_video.so" in LIBVA_DRIVERS_PATH.
179
-
# AMD vendored the driver as "librocm_sysdeps_gallium_drv_video.so", so
180
-
# we must also set LIBVA_DRIVER_NAME to that basename (minus _drv_video.so)
181
-
# to override the DRM-reported name. We derive both values from the actual
182
-
# file found via rglob so the code stays resilient to future AMD renames.
183
169
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)
184
170
rocm_va_driver=$(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(hits[0].name.replace('_drv_video.so','')) if hits else None" 2>/dev/null || true)
185
171
if [ -n "${rocm_core_dri}" ] && [ -n "${rocm_va_driver}" ]; then
186
172
export LIBVA_DRIVERS_PATH="${rocm_core_dri}"
187
173
export LIBVA_DRIVER_NAME="${rocm_va_driver}"
188
-
echo "LIBVA_DRIVERS_PATH: ${rocm_core_dri}"
189
-
echo "LIBVA_DRIVER_NAME: ${rocm_va_driver}"
190
-
else
191
-
echo "WARNING: no *_drv_video.so found in _rocm_sdk_core/lib; VA-API driver missing?"
192
-
echo "Contents of _rocm_sdk_core/lib (recursive *_drv_video.so search):"
193
-
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
194
-
fi
195
-
# Diagnostics: dump ldd on the image .so so any missing dep is visible.
# Also check AMD's own librocjpeg RPATH (not bundled; lives in _rocm_sdk_core).
203
-
# This tells us whether AMD's RPATH handles the transitive deps for real users
204
-
# (who have no LD_LIBRARY_PATH set), vs. only working because LD_LIBRARY_PATH
205
-
# is set above.
206
-
rocjpeg_sdk=$(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(str(p/'lib'/'librocjpeg.so.1') if p and (p/'lib'/'librocjpeg.so.1').exists() else '')" 2>/dev/null || true)
0 commit comments