Repository navigation
feat(rocDecode): add video_decode_caps example and skip unsupported codecs - #550
Merged
Merged
Conversation
1 task done
Collaborator
Author
|
rocgdb failures are expected and unrelated |
zichguan-amd
added a commit
to ROCm/rocm-systems
that referenced
this pull request
Oct 22, 2026
) ## Motivation `video_decodeRaw-AV1` and `video_decode-AV1` fail on GPUs whose VCN has no AV1 decode, e.g. gfx90a (MI210, VCN 2.6). On those GPUs `rocDecGetDecoderCaps` correctly returns `ROCDEC_SUCCESS` with `is_supported = 0`, but the samples treat an unsupported codec as an error and exit with 1. The tests should report these cases as skipped, not failed. This refines #8636 ("Fix fake CTest passes"). Before it, an unsupported codec exited with 0, so these tests passed without decoding anything. #8636 changed that to exit 1, which fixed the fake pass but made the AV1 tests fail on gfx90a. With this PR an unsupported codec is reported as skipped. A failed capability query still fails, which keeps the error case that #8636 covers. ## Technical Details - **`samples/videoDecodeRaw`, `samples/videoDecode`:** query `rocDecGetDecoderCaps` directly instead of calling `RocVideoDecoder::CodecSupported()`. That helper returns `false` for both a failed query and an unsupported codec, so the two couldn't be told apart. - Unsupported codec: print `info: Codec not supported on GPU, skipping!` and exit with 77, the conventional skip code. - Failed query (e.g. VA-API init failure): print the `rocDecStatus` name and exit with 1, as before. - Both samples keep the GPU query, so the FFmpeg host backend in `videoDecode` behaves as before; `CodecSupported()` there also queried the GPU caps. - **`test/CMakeLists.txt`:** new `set_codec_skip()` macro sets `SKIP_REGULAR_EXPRESSION` on the skip message. It's applied to the `video_decodeRaw-{HEVC,AVC,AV1,VP9}` and `video_decode-{HEVC,AVC,AV1,VP9}` tests. - `SKIP_RETURN_CODE 77` doesn't work here. These tests run the sample through `ctest --build-and-test ... --test-command`, which reports any non-zero exit code of the test command as 1. I checked this with CMake 3.29: a `--test-command` that returns 77 makes `ctest --build-and-test` exit with 1. The sample's output is passed through, so the regex matches. - Raises the test project's `cmake_minimum_required` from 3.10 to 3.16, the version that added `SKIP_REGULAR_EXPRESSION`. - **`CHANGELOG.md`:** entry under Resolved issues. Counterpart in rocm-examples: ROCm/rocm-examples#550. It ports `videoDecodeCaps` as the `video_decode_caps` example and applies the same unsupported-codec skip to its `video_decode_raw` and `video_decode` examples. Those tests run the example binary directly, so they use `SKIP_RETURN_CODE 77`. ## JIRA ID JIRA ID : ROCM-31247 ## Test Plan Tested on gfx1100 (RX 7900 XTX) with a TheRock install. `ROCM_PATH` pointed at a copy of the install whose `share/rocdecode/{samples,utils}` are this branch's sources, with `-DENABLE_EXTENDED_TESTS=ON`. Three runs of the `video_decodeRaw-*` and `video_decode-*` tests: 1. As is: AV1 is supported on gfx1100. 2. With an `LD_PRELOAD` shim that wraps `rocDecGetDecoderCaps` and clears `is_supported` for AV1, to simulate gfx90a. 3. With `LIBVA_DRIVER_NAME=bogus`, so the caps query itself fails. ## Test Result 1. All 8 tests pass. 2. The shim run gives `video_decodeRaw-AV1` and `video_decode-AV1` **Skipped**. The other 6 pass, and ctest exits 0. Running `videodecoderaw` directly prints the skip message and exits with 77. 3. The `bogus` run makes both AV1 tests **Fail** (`rocDecGetDecoderCaps failed: ROCDEC_RUNTIME_ERROR`). A broken environment is still reported as a failure, not hidden as a skip. Not yet run on actual gfx90a hardware. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…odecs Port the upstream rocDecode videoDecodeCaps sample as video_decode_caps. It queries rocDecGetDecoderCaps for every codec, chroma format and bit depth and prints the supported combinations. It needs no test video. The rocdecode_video_decode_raw-AV1 test fails on gfx90a (MI210), whose VCN 2.6 has no AV1 decode. video_decode_raw and video_decode now query rocDecGetDecoderCaps directly instead of RocVideoDecoder::CodecSupported(), which can't tell a failed query from an unsupported codec. An unsupported codec exits with skip_exit_code (77, new in Common/example_utils.hpp), which the tests report as skipped via SKIP_RETURN_CODE and the Makefile test loops report as a skip. A failed query is still an error. Co-Authored-By: Claude <noreply@anthropic.com>
HipPlatform.cmake and ROCmPath.cmake moved from Common/ to cmake/ in #533. Co-Authored-By: Claude <noreply@anthropic.com>
zichguan-amd
force-pushed
the
zichguan/rocdecode-caps-av1-skip
branch
from
October 22, 2026 19:33
a8e2d36 to
0f7b7b4
Compare
3 of 8 tasks
zichguan-amd
added a commit
that referenced
this pull request
Oct 27, 2026
## Motivation `rocdecode_video_decode_caps` (added in #550) has failed every nightly since 2026-10-23 on `Ubuntu 24.04 (ROCm 10.1) - gfx1151 - preinstalled`. It passes on stable gfx1100 and on all nightly gfx1151 jobs. ``` AVC/H.264 YUV 4:2:0 8-bit 2 64x64 4096x4096 NV12 [0, Critical] vaapi_videodecoder.cpp:1015: ... CheckDecCapForCodecType(): VAAPI failure: vaCreateConfig(...) Error: rocDecGetDecoderCaps failed: ROCDEC_RUNTIME_ERROR ``` The ROCm 10.1 rocDecode maps unmapped codec/bit-depth combinations (e.g. HEVC 12-bit) to `VAProfileNone` and then calls `vaCreateConfig` on it. Mesa only advertises `VAProfileNone` on GPUs with a VPE block. gfx1151 has one and gfx1100 doesn't, so on gfx1151 `rocDecGetDecoderCaps` returns `ROCDEC_RUNTIME_ERROR` instead of reporting the combination as unsupported. This was fixed upstream in ROCm/rocm-systems#11724, which is not in ROCm 10.1. The nightly rocDecode has the fix, which is why the nightly gfx1151 jobs pass. ## Technical Details - `.github/build_tools/skip_manifest.py`: add a test-only skip for `rocdecode_video_decode_caps` (ctest key plus `make test` path), scoped to `channels: ["stable"]` and `targets: ["gfx1151"]`. - The example is still built everywhere and still tested on stable gfx1100 and every nightly job. - The entry can be removed once the stable image moves to a ROCm release that includes ROCm/rocm-systems#11724. ## Test Plan - Ran `generate_skip_tests.py` for stable/gfx1151/preinstalled, stable/gfx1100/preinstalled, nightly/gfx1151/tarball-multi-arch and nightly/gfx1151/whl-multi-arch. - On gfx1100, in `ghcr.io/rocm/rocm-examples-ubuntu-24.04-rocm:10.1`: - configured `Libraries/rocDecode` with CMake and ran `ctest -R video_decode_caps` with and without the generated `skip_tests.txt`; - ran `make -n -C Libraries/rocDecode test` with the generated `SKIP_FROM_TEST`. ## Test Result - The entry appears only in the stable gfx1151 output (`skip_tests.txt` and `SKIP_FROM_TEST`). - ctest finds no matching test with the exclude file. Without it, the test passes. - `make test` drops `video_decode_caps` and keeps the other 10 rocDecode examples. - `black --check` passes on the changed file. - I didn't run the gfx1151 job itself locally because no gfx1151 is available here. ## Added/Updated documentation? - [ ] Yes - [x] No, does not apply to this PR. ## Included Visual Studio files? - [ ] Yes - [x] No, does not apply to this PR. ## Submission Checklist - [ ] New examples contain proper CMake and Make files. - [ ] I have updated relevant CI workflows and the new examples are being built and tested in CI. - [ ] Check and guard against unsupported ASICs if relevant dependent libraries have limited support. - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
3 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
rocdecode_video_decode_raw-AV1fails on gfx90a (MI210). Its VCN 2.6 has no AV1 decode, and the example treats an unsupported codec as an error.videoDecodeCapssample, which shows how to check codec support up front withrocDecGetDecoderCaps.Technical Details
Libraries/rocDecode/video_decode_capsexample: a port of upstreamvideoDecodeCaps.rocDecGetDecoderCapsfor every codec / chroma format / bit depth on the selected GPU (-d, default 0). For each supported combination it prints the decoder count, min/max resolution and output surface formats.video_decode_rawandvideo_decode:rocDecGetDecoderCapsdirectly instead of usingRocVideoDecoder::CodecSupported(), which returnsfalseboth when the query fails and when the codec is unsupported.ROCDEC_SUCCESS,is_supported == 0): exit with the newskip_exit_code(77) fromCommon/example_utils.hpp.SKIP_RETURN_CODE 77, and their Makefiletestloops print a skip line on 77 instead of failing.video_decode_batchalready skips unsupported files internally and is unchanged.skip_manifest.py: comment only.video_decode_capsis intentionally not in the rocDecode whl-install skip list because it needs no test data.Upstream counterpart for the rocDecode CTests: ROCm/rocm-systems#13518.
Test Plan
On gfx1100 (RX 7900 XTX) with a TheRock install:
ctest(caps +video_decode_raw-*).make+make testinvideo_decode_capsandvideo_decode_raw.LD_PRELOADshim that clearsis_supportedfor AV1, to simulate gfx90a.video_decode_rawwithLIBVA_DRIVER_NAME=bogusto make the caps query itself fail.pre-commiton the changed files.Test Result
video_decode_capsreports 8 supported combinations (AVC 8-bit; HEVC 8/10; AV1 8/10/12; VP9 8/10).rocdecode_video_decode_raw-AV1as Skipped, the rest pass, and ctest exits 0.make testprints==> Skipping (codec not supported on this GPU): ...AV1.ivfand exits 0.Error: rocDecGetDecoderCaps failed: ROCDEC_RUNTIME_ERROR, exit 1.The
video_decode-*tests are only registered on non-TheRock installs, so on this machine their skip path was checked throughmakeonly.Note: on this machine rocDecode needs
LIBVA_DRIVERS_PATH=$ROCM_PATH/lib/rocm_sysdeps/lib LIBVA_DRIVER_NAME=radeonsi, otherwisevaInitializefails.video_decode_capsreports that as a failure (exit 1), so it will fail on CI images where VA-API can't be initialized.Added/Updated documentation?
Included Visual Studio files?
Submission Checklist
🤖 Generated with Claude Code