Skip to content

feat(rocDecode): add video_decode_caps example and skip unsupported codecs - #550

Merged
zichguan-amd merged 2 commits into
amd-stagingfrom
zichguan/rocdecode-caps-av1-skip
Oct 22, 2026
Merged

zichguan-amd merged 2 commits into
amd-stagingfrom
zichguan/rocdecode-caps-av1-skip

Conversation

@zichguan-amd

@zichguan-amd zichguan-amd commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

  • ROCM-31247: rocdecode_video_decode_raw-AV1 fails on gfx90a (MI210). Its VCN 2.6 has no AV1 decode, and the example treats an unsupported codec as an error.
  • New example: add a port of the upstream rocDecode videoDecodeCaps sample, which shows how to check codec support up front with rocDecGetDecoderCaps.

Technical Details

  • New Libraries/rocDecode/video_decode_caps example: a port of upstream videoDecodeCaps.
    • It queries rocDecGetDecoderCaps for 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.
    • It needs no test video and no FFmpeg, so it is built and tested outside the FFmpeg block, and its ctest is registered unconditionally.
    • It comes with CMake, Makefile and README, and is added to the root README and the rocDecode Makefile/CMakeLists.
  • Skipping unsupported codecs in video_decode_raw and video_decode:
    • Both now query rocDecGetDecoderCaps directly instead of using RocVideoDecoder::CodecSupported(), which returns false both when the query fails and when the codec is unsupported.
    • Unsupported codec (ROCDEC_SUCCESS, is_supported == 0): exit with the new skip_exit_code (77) from Common/example_utils.hpp.
    • Failed query: still an error (exit 1).
    • Their tests set SKIP_RETURN_CODE 77, and their Makefile test loops print a skip line on 77 instead of failing.
    • video_decode_batch already skips unsupported files internally and is unchanged.
  • skip_manifest.py: comment only. video_decode_caps is 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:

  • CMake build + ctest (caps + video_decode_raw-*).
  • make + make test in video_decode_caps and video_decode_raw.
  • The above repeated with an LD_PRELOAD shim that clears is_supported for AV1, to simulate gfx90a.
  • video_decode_raw with LIBVA_DRIVER_NAME=bogus to make the caps query itself fail.
  • pre-commit on the changed files.

Test Result

  • Normal run: all tests pass. video_decode_caps reports 8 supported combinations (AVC 8-bit; HEVC 8/10; AV1 8/10/12; VP9 8/10).
  • Shim run:
    • ctest reports rocdecode_video_decode_raw-AV1 as Skipped, the rest pass, and ctest exits 0.
    • make test prints ==> Skipping (codec not supported on this GPU): ...AV1.ivf and exits 0.
  • Failed query: Error: rocDecGetDecoderCaps failed: ROCDEC_RUNTIME_ERROR, exit 1.
  • pre-commit: passes.
  • Not yet run on actual gfx90a hardware.

The video_decode-* tests are only registered on non-TheRock installs, so on this machine their skip path was checked through make only.

Note: on this machine rocDecode needs LIBVA_DRIVERS_PATH=$ROCM_PATH/lib/rocm_sysdeps/lib LIBVA_DRIVER_NAME=radeonsi, otherwise vaInitialize fails. video_decode_caps reports that as a failure (exit 1), so it will fail on CI images where VA-API can't be initialized.

Added/Updated documentation?

  • Yes
  • No, does not apply to this PR.

Included Visual Studio files?

  • Yes
  • No, does not apply to this PR.

Submission Checklist

🤖 Generated with Claude Code

@zichguan-amd

Copy link
Copy Markdown
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)
zichguan-amd and others added 2 commits October 22, 2026 15:30
…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
zichguan-amd force-pushed the zichguan/rocdecode-caps-av1-skip branch from a8e2d36 to 0f7b7b4 Compare October 22, 2026 19:33
@zichguan-amd
zichguan-amd merged commit ebff63c into amd-staging Oct 22, 2026
22 of 23 checks passed
@zichguan-amd
zichguan-amd deleted the zichguan/rocdecode-caps-av1-skip branch October 22, 2026 19:40
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant