Skip to content

Adds HIP kernel for yuv to rgb#691

Merged
LakshmiKumar23 merged 13 commits intoROCm:developfrom
LakshmiKumar23:lk/color_convert_kernels
Mar 27, 2026
Merged

Adds HIP kernel for yuv to rgb#691
LakshmiKumar23 merged 13 commits intoROCm:developfrom
LakshmiKumar23:lk/color_convert_kernels

Conversation

@LakshmiKumar23
Copy link
Copy Markdown
Contributor

Motivation

Adds HIP kernel for YUV (NV12 format) to RGB (Packed 24bit format)

Technical Details

Adds HIP implementation for 8-bit NV12 input, adopted from rocdecode and throws NOT_IMPLEMENTED for HOST backend.
Adds 3 test .yuv images, a .info file for their meta-data and output .rgb files.
Adds QA and non QA mode for test suite. Compares one image input to corresponding output (not batched tensor output)

Test Plan

Test case 103 - YUV_TO_RGB has been added.
test command:

  • For QA mode
cd utilities/test_suite/HIP
python3 runImageTests.py --case_list 103 --qa_mode 1 --batch_size 3
  • For non QA mode -- will dump 3 output images that can be viewed
cd utilities/test_suite/HIP
python3 runImageTests.py --case_list 103 --qa_mode 0 --batch_size 3

Test Result

lakshmi@kapu:~/work/lk/rpp/utilities/test_suite/HIP$ python3 runImageTests.py --case_list 103 --qa_mode 1 --batch_size 3
-- The C compiler identification is Clang 22.0.0
-- The CXX compiler identification is Clang 22.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/lakshmi/rock-03-13/install/lib/llvm/bin/amdclang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/lakshmi/rock-03-13/install/lib/llvm/bin/amdclang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- test_suite/HIP: rpp found with find_package(rpp QUIET)
--      rpp_INCLUDE_DIR -- /home/lakshmi/rock-03-13/install/include
--      rpp_LIBRARY -- /home/lakshmi/rock-03-13/install/lib/librpp.so
-- test_suite/HIP is supported to build and run with RPP HIP backend installation
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS - Success
-- Using Turbo JPEG --
        Libraries:/lib/libturbojpeg.so
        Includes:/usr/include
-- Performing Test STD_FILESYSTEM_PRESENT
-- Performing Test STD_FILESYSTEM_PRESENT - Success
-- HIP found at HIP_INCLUDE_DIRS - /home/lakshmi/rock-03-13/install/include and HIP_LIBRARIES - hip::host;hip::device
-- Python3 found
-- Python3 found at /usr/bin/python3.11
-- test_suite/HIP All Tensor HIP tests set to build with OpenMP
-- test_suite/HIP Tensor-Image HIP tests set to build with TurboJpeg
-- test_suite/HIP Tensor-Image HIP tests set to build with OpenCV
-- Tensor_image_hip -- Link Libraries: rpp::rpp;hip::host;hip::device;stdc++fs;OpenMP::OpenMP_CXX;/lib/libturbojpeg.so;opencv_core;opencv_features2d;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_photo;opencv_video;opencv_videoio
-- test_suite/HIP Tensor-Voxel HIP tests set to build with libniftiio
-- test_suite/HIP Tensor-Voxel HIP tests set to build with OpenCV
-- Tensor_voxel_hip -- Link Libraries: rpp::rpp;hip::host;hip::device;stdc++fs;OpenMP::OpenMP_CXX;/lib/libturbojpeg.so;opencv_core;opencv_features2d;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_photo;opencv_video;opencv_videoio
-- test_suite/HIP Tensor-Audio HIP tests set to build with RPP_AUDIO_SUPPORT set to ON
-- test_suite/HIP Tensor-Audio HIP tests set to build with libsnd
-- Tensor_audio_hip -- Link Libraries: rpp::rpp;hip::host;hip::device;stdc++fs;OpenMP::OpenMP_CXX;/lib/libturbojpeg.so;opencv_core;opencv_features2d;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_photo;opencv_video;opencv_videoio
-- Tensor_misc_hip -- Link Libraries: rpp::rpp;hip::host;hip::device;stdc++fs;OpenMP::OpenMP_CXX;/lib/libturbojpeg.so;opencv_core;opencv_features2d;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_photo;opencv_video;opencv_videoio
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lakshmi/work/lk/rpp/utilities/test_suite/HIP/build
[ 12%] Building CXX object CMakeFiles/Tensor_image_hip.dir/Tensor_image_hip.cpp.o
[ 25%] Building CXX object CMakeFiles/Tensor_voxel_hip.dir/Tensor_voxel_hip.cpp.o
[ 37%] Building CXX object CMakeFiles/Tensor_misc_hip.dir/Tensor_misc_hip.cpp.o
[ 50%] Building CXX object CMakeFiles/Tensor_audio_hip.dir/Tensor_audio_hip.cpp.o
[ 62%] Linking CXX executable Tensor_audio_hip
[ 75%] Linking CXX executable Tensor_misc_hip
[ 75%] Built target Tensor_audio_hip
[ 75%] Built target Tensor_misc_hip
[ 87%] Linking CXX executable Tensor_voxel_hip
[ 87%] Built target Tensor_voxel_hip
[100%] Linking CXX executable Tensor_image_hip
[100%] Built target Tensor_image_hip


./Tensor_image_hip /home/lakshmi/work/lk/rpp/utilities/test_suite/HIP/../TEST_IMAGES/three_images_yuv /home/lakshmi/work/lk/rpp/utilities/test_suite/HIP/../TEST_IMAGES/three_images_yuv /home/lakshmi/work/lk/rpp/utilities/test_suite/HIP/QA_RESULTS_HIP_2026-03-20_15-18-12 0 0 103 0 1 0 0

Running yuv_to_rgb_u8_Tensor_HIP_PKD3_toPKD3 1 times (each time with a batch size of 3 images) and computing mean statistics...

GPU Backend Wall Time: 2.95091 ms/batch

Results for yuv_to_rgb_u8_Tensor_PKD3_to_PKD3 :
PASSED!
------------------------------------------------------------------------------------------
---------------------------------- Results of QA Test - Tensor_image_hip ----------------------------------

yuv_to_rgb_u8_Tensor_PKD3_to_PKD3: PASSED

---------------------------------- Summary of QA Test - Tensor_image_hip ----------------------------------

Final Results of Tests:
    - Total test cases including all subvariants REQUESTED = 1
    - Total test cases including all subvariants PASSED = 1

General information on Tensor voxel test suite availability:
    - Total augmentations supported in Tensor test suite = 67
    - Total augmentations with golden output QA test support = 59
    - Total augmentations without golden ouput QA test support (due to randomization involved) = 8

Submission Checklist

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds NV12 (YUV) → packed RGB24 conversion support for the HIP backend in the tensor “data exchange operations” module, and extends the HIP test suite with a new test case and QA assets.

Changes:

  • Introduces rppt_yuv_to_rgb() public API and HIP implementation for NV12 8-bit YUV → RGB24.
  • Extends HIP test executable + Python harness to run a new test case (103) with the correct layout/bit-depth constraints.
  • Adds YUV test inputs with .info sidecars and corresponding per-image packed .rgb reference outputs; updates QA comparison path accordingly.

Reviewed changes

Copilot reviewed 13 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
utilities/test_suite/rpp_test_suite_image.h Adds YUV sidecar parsing, NV12 batch reader, YUV-specific ROI/max-dim helpers, and per-image QA compare path for .rgb references.
utilities/test_suite/common.py Registers new test case (103) and adds yuv_to_rgb under data exchange operations.
utilities/test_suite/TEST_IMAGES/three_images_yuv/mug_420_3840x2160_nv12.info Adds sidecar metadata (width/height) for NV12 input.
utilities/test_suite/TEST_IMAGES/three_images_yuv/driving_frame_2048x1024.info Adds sidecar metadata (width/height + color_range) for NV12 input.
utilities/test_suite/TEST_IMAGES/three_images_yuv/1_img150x150.yuv Adds a YUV NV12 test input (binary).
utilities/test_suite/TEST_IMAGES/three_images_yuv/1_img150x150.info Adds sidecar metadata for the 150×150 NV12 input.
utilities/test_suite/REFERENCE_OUTPUT/yuv_to_rgb/1_img150x150.rgb Adds packed RGB24 golden output (binary).
utilities/test_suite/HIP/runImageTests.py Adds yuv-specific input path routing and restricts yuv_to_rgb to PKD3 + U8-only variants (unit/perf/profile).
utilities/test_suite/HIP/Tensor_image_hip.cpp Adds YUV_TO_RGB case handling: file discovery for .yuv, sidecar-driven dims/ROI, NV12 reading, and per-image rppt_yuv_to_rgb() invocation.
src/modules/tensor/rppt_tensor_data_exchange_operations.cpp Implements rppt_yuv_to_rgb() dispatch for HIP backend.
src/modules/tensor/hip/kernel/color_space_conversion.cpp Adds the HIP kernel and executor implementation for NV12 → RGB24.
src/include/tensor/hip_tensor_executors.hpp Declares hip_exec_yuv_to_rgb() template executor.
api/rppt_tensor_data_exchange_operations.h Exposes the rppt_yuv_to_rgb() API and documents parameters/constraints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LakshmiKumar23 LakshmiKumar23 self-assigned this Mar 23, 2026
@LakshmiKumar23 LakshmiKumar23 added the enhancement New feature or request label Mar 23, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 74.71264% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...dules/tensor/hip/kernel/color_space_conversion.cpp 70.97% 18 Missing ⚠️
...es/tensor/rppt_tensor_data_exchange_operations.cpp 84.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #691      +/-   ##
===========================================
- Coverage    91.97%   91.93%   -0.04%     
===========================================
  Files          204      205       +1     
  Lines        92299    92386      +87     
===========================================
+ Hits         84884    84927      +43     
- Misses        7415     7459      +44     
Files with missing lines Coverage Δ
api/rppdefs.h 69.44% <ø> (ø)
...es/tensor/rppt_tensor_data_exchange_operations.cpp 93.97% <84.00%> (-0.86%) ⬇️
...dules/tensor/hip/kernel/color_space_conversion.cpp 70.97% <70.97%> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@AryanSalmanpour AryanSalmanpour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add set (HIP_PLATFORM amd CACHE STRING "HIP platform") before line 127 for running the test with TheRock

https://github.com/ROCm/rpp/blob/develop/utilities/test_suite/HIP/CMakeLists.txt#L127

@LakshmiKumar23
Copy link
Copy Markdown
Contributor Author

@LakshmiKumar23 LakshmiKumar23 merged commit d5a3a0b into ROCm:develop Mar 27, 2026
2 checks passed
@LakshmiKumar23 LakshmiKumar23 deleted the lk/color_convert_kernels branch March 30, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:precheckin enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants