Files
TheRock/rocm-libraries/projects/rpp/utilities/test_suite/scripts/README.md
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

3.5 KiB

Test suite scripts

Utilities used when preparing or debugging RPP test-suite inputs. They are not linked into the C++ Tensor_image binaries.

JPEG → RGB Conversion (Tensor-Image decoder_type 0)

Script: jpeg_to_rgb_conversion.py

Dependency: libjpeg-turbo libturbojpeg at runtime (the script loads libturbojpeg.so via Python ctypes). Install the distro package that provides the libturbojpeg shared library, for example:

  • Debian/Ubuntu: sudo apt install libturbojpeg0 (or libjpeg-turbo8 / libturbojpeg depending on release; ensure python3 can load libturbojpeg.so)

No PyPI packages are required.

Usage: decode every *.jpg / *.jpeg in a directory and write .rgb files with embedded headers:

python3 jpeg_to_rgb_conversion.py /path/to/folder/with/jpeg [--out-dir /path/to/output] [--recursive]

For each input stem.jpg the script writes:

  • stem.rgb — 24-byte binary header (magic "RGBB", version, width, height, channels, reserved) followed by packed RGB pixels (RGB, gray, or CMYK as appropriate)

The .rgb format is consumed by read_image_batch_packed() in rpp_test_suite_image.h and supports grayscale-to-RGB automatic conversion during loading.

Generating Golden Outputs (.bin files)

Golden outputs (reference .bin files) are used by QA mode to validate test correctness. To generate these files:

Step 1: Enable DEBUG_MODE

Edit rpp_test_suite_common.h and set:

#define DEBUG_MODE 1

This enables binary output generation during test execution.

Step 2: Run Test Suite

Run the test suite with the desired test cases. The .bin files will be generated in the current working directory:

For Image Test Suite:

cd utilities/test_suite/HOST  # or HIP
python3 runImageTests.py --case_start 0 --case_end 102 --test_type 0 --batch_size 3

For Misc Test Suite:

cd utilities/test_suite/HOST  # or HIP
python3 runMiscTests.py --case_start 1 --case_end 1 --test_type 0 --batch_size 3

The generated .bin files will have names like:

  • brightness_u8.bin
  • blend_f32.bin
  • resize_u8_interpolationTypeBILINEAR.bin

Step 3: Organize Reference Outputs

Use the organize_reference_outputs.py script to automatically organize the .bin files into the correct directory structure under REFERENCE_OUTPUT/:

cd utilities/test_suite
python3 scripts/organize_reference_outputs.py --source HOST --dest REFERENCE_OUTPUT

Options:

  • --source <dir>: Source directory containing .bin files (default: current directory)
  • --dest <dir>: Destination REFERENCE_OUTPUT directory (default: ../REFERENCE_OUTPUT)
  • --copy: Copy files instead of moving them
  • --force: Overwrite existing files without prompting

Example:

# Move .bin files from HIP build directory to REFERENCE_OUTPUT
python3 scripts/organize_reference_outputs.py --source HIP --dest REFERENCE_OUTPUT

# Copy instead of move
python3 scripts/organize_reference_outputs.py --source HOST --dest REFERENCE_OUTPUT --copy

The script automatically:

  • Extracts function names from filenames (e.g., brightness_u8.bin → brightness/)
  • Creates subdirectories under REFERENCE_OUTPUT/ as needed
  • Moves/copies .bin files to their respective function directories

Note: After generating reference outputs, remember to set DEBUG_MODE back to 0 for normal test runs.

Constants in the script (TJPF_*, TJFLAG_*, …) must match the installed turbojpeg.h or decompression can misbehave or crash.