Fg/deser pr4#18
Conversation
Introduce RocalPipelineParams struct to store all pipeline info
…ocs/sphinx (ROCm#418) Bumps [rocm-docs-core[api_reference]](https://github.com/ROCm/rocm-docs-core) from 1.29.0 to 1.30.0. - [Release notes](https://github.com/ROCm/rocm-docs-core/releases) - [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md) - [Commits](ROCm/rocm-docs-core@v1.29.0...v1.30.0) --- updated-dependencies: - dependency-name: rocm-docs-core[api_reference] dependency-version: 1.30.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds deserialization functionality to rocAL by implementing the rocalDeserialize API function. This allows reconstructing a rocAL pipeline from a serialized protobuf representation, complementing the existing serialization capability.
Key changes:
- Added
rocalDeserializefunction to parse serialized pipeline data and recreate a RocalContext - Introduced
RocalPipelineParamsstruct to allow optional overrides of pipeline parameters during deserialization - Added necessary protobuf header includes for deserialization support
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| rocAL/source/api/rocal_api.cpp | Implements the rocalDeserialize function with protobuf parsing and context creation logic |
| rocAL/include/api/rocal_api_types.h | Defines the RocalPipelineParams struct with optional pipeline configuration parameters |
| rocAL/include/api/rocal_api.h | Declares the public API for rocalDeserialize function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try { | ||
| // Parse from the serialized string. | ||
| rocal_proto::PipelineDef pipe; | ||
| google::protobuf::io::CodedInputStream coded_input( |
There was a problem hiding this comment.
The return value of ParseFromCodedStream is not checked. If parsing fails, the function will continue execution with an incompletely initialized pipe object, potentially causing undefined behavior. Add error handling: if (!pipe.ParseFromCodedStream(&coded_input)) { THROW(\"Failed to parse serialized pipeline\"); }
| google::protobuf::io::CodedInputStream coded_input( | |
| if (!pipe.ParseFromCodedStream(&coded_input)) { | |
| THROW("Failed to parse serialized pipeline"); | |
| } |
| RocalAffinity affinity = use_cpu ? RocalAffinity::CPU : RocalAffinity::GPU; | ||
| // Create the context | ||
| context = new Context(batch_size, affinity, | ||
| std::max(device_id, 0), |
There was a problem hiding this comment.
The inline comment indicates incomplete functionality ('Need to set dtype in protobuf/just use default value'). This TODO-style comment should either be addressed before merging or converted to a proper TODO/FIXME comment for tracking: // TODO: Support configurable dtype from protobuf instead of hardcoding FP32
| std::max(device_id, 0), | |
| RocalTensorDataType::FP32); // TODO: Support configurable dtype from protobuf instead of hardcoding FP32 |
| num_threads, | ||
| prefetch_queue_depth, | ||
| RocalTensorDataType::FP32); // Need to set dtype in protobuf/just use default value |
There was a problem hiding this comment.
The return value or potential exceptions from deserialize are not handled. If deserialization of the master graph fails, the partially constructed context will be returned without cleanup, causing a resource leak. Wrap this call in proper error handling and ensure context cleanup on failure.
| num_threads, | |
| prefetch_queue_depth, | |
| RocalTensorDataType::FP32); // Need to set dtype in protobuf/just use default value | |
| bool deserialized = static_cast<Context*>(context)->master_graph->deserialize(&pipe); | |
| if (!deserialized) { | |
| delete static_cast<Context*>(context); | |
| context = nullptr; | |
| } | |
| } catch (const std::exception& e) { | |
| if (context) { | |
| delete static_cast<Context*>(context); | |
| context = nullptr; | |
| } |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pipe_params.rocal_cpu = pipe.rocal_cpu(); | ||
|
|
||
| if (!pipe_params.prefetch_queue_depth.has_value() && pipe.has_prefetch_queue_depth()) | ||
| pipe_params.prefetch_queue_depth = pipe.prefetch_queue_depth(); |
There was a problem hiding this comment.
Inconsistent indentation: this line uses 3 spaces while surrounding lines use 4 spaces for indentation.
| pipe_params.prefetch_queue_depth = pipe.prefetch_queue_depth(); | |
| pipe_params.prefetch_queue_depth = pipe.prefetch_queue_depth(); |
…ocs/sphinx (ROCm#423) Bumps [rocm-docs-core[api_reference]](https://github.com/ROCm/rocm-docs-core) from 1.30.0 to 1.30.1. - [Release notes](https://github.com/ROCm/rocm-docs-core/releases) - [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md) - [Commits](ROCm/rocm-docs-core@v1.30.0...v1.30.1) --- updated-dependencies: - dependency-name: rocm-docs-core[api_reference] dependency-version: 1.30.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Use enums present in commons.h Remove the usage of API enums in internal node files * Remove unused include rocal_api_types.h * Introduce EnumRegistry Add support to register all internal enums * Introduce Argument class Creates an argument instance for each arg passed in the Node Handles different argument types i.e parameters, vectors, enums and predefined types * Introduce PipelineOperator class * Add support to create and return node name and tensor name * Add support in MasterGraph to store details of PipelineOperators * Add support to store the argument details in the node for brightness and ImageLoaderNode * Remove redundant static cast Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Remove semicolon for enum macro * Modify name of macro * Change enums to scoped enums in commons.h * Code reorganization Create single constructor with check for different data types in Argument class * Minor fix * Remove unused includes * Add compiler keywords * Update rocAL/include/pipeline/argument.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update rocAL/include/pipeline/argument.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Minor change * Update rocAL/include/pipeline/argument.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update rocAL/include/pipeline/argument.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Minor change * Fix shared pointer fetching * Minor fix * Minor fix * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CMakeLists version for rocAL * Update CHANGELOG * Update CHANGELOG.md * Minor change * Minor changes * Update CHANGELOG.md Co-authored-by: spolifroni-amd <Sandra.Polifroni@amd.com> * Add const qualifier * Add const correctness to get args list * Minor change * Add const correctness to get args list * Update CHANGELOG * Generate UID for tensors from MasterGraph * Minor change * Resolve copilot review comments * Minor change * Minor changes --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Fiona Gladwin <121928245+fgladwin@users.noreply.github.com> Co-authored-by: Sundar Rajan Vaithiyanathan <99159823+SundarRajan28@users.noreply.github.com> Co-authored-by: Kiriti Gowda <kiritigowda@gmail.com> Co-authored-by: spolifroni-amd <Sandra.Polifroni@amd.com> Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com>
Co-authored-by: Kiriti Gowda <kiritigowda@gmail.com>
* Update numpy reader example * Add new example and remove changes from other example * Update comment * Remove unused import Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Resolve review comments --------- Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com> Co-authored-by: Fiona-MCW <70996026+fiona-gladwin@users.noreply.github.com> Co-authored-by: Kiriti Gowda <kiritigowda@gmail.com> Co-authored-by: Sundar Rajan Vaithiyanathan <svaithiy@amd.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update CHANGELOG.md Updates for 7.2 * Changelog - bugfixes
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ocs/sphinx (ROCm#426) Bumps [rocm-docs-core[api_reference]](https://github.com/ROCm/rocm-docs-core) from 1.30.1 to 1.31.0. - [Release notes](https://github.com/ROCm/rocm-docs-core/releases) - [Changelog](https://github.com/ROCm/rocm-docs-core/blob/v1.31.0/CHANGELOG.md) - [Commits](ROCm/rocm-docs-core@v1.30.1...v1.31.0) --- updated-dependencies: - dependency-name: rocm-docs-core[api_reference] dependency-version: 1.31.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* initial commit of pipeline doc * added info about how run doesn't need to be explicitly called with iterators * added the pipeline howto * added generic iterators api; updated the pipeline info * updated the requirements.in to the latest minimum rocm-docs-core version * updates based on review feedback --------- Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com>
Store the args in a map in the Node Modify initializers to accept and obtain values from the ArgumentSet using the string
* Fix issue with decoder example notebook * Remove device parameter from show_images function * Remove hardcoded path --------- Co-authored-by: SundarRajan28 <sundarrajan@multicorewareinc.com> Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com> Co-authored-by: Sundar Rajan Vaithiyanathan <99159823+SundarRajan28@users.noreply.github.com>
Removed unused macro definition for INIT_ARGS_COUNT.
Removed unused macro definition for INIT_ARGS_COUNT.
remove the use of vector of arguments Add support to create new arguments and store in a map Fetch the values from the map using the name of the argument
* Updating snow API * Update vx_rpp version requirement to 3.2.0 * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: SundarRajan28 <sundarrajan@multicorewareinc.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com>
Adding deserialize to master graph --------- Co-authored-by: Fiona Gladwin <121928245+fgladwin@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Kiriti Gowda <kiritigowda@gmail.com> Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com>
If batch size is not passed to pipe in deserialize default 1 is assigned
* Add support for ColorCast * Add support for grid mask augmentation * Add NonLinearBlend support in rocAL * Add support for the Median Filter and Gaussian filter * Fix kernel size data type for Gaussian and Median Filters Change copyright Add unit tests for NonLinearBlend, Gaussian and Median filters * Add support for Warp perspective augmentation * Add support for Threshold augmentation and API * Add rocAL support for new augmentations Dilate Erode Magnitude Phase * Fix unit tests * Modify copyright * Warp Perspective fixes Remove per-iter updation of perspective array Add unit test for WarpPerspective * Fix Threshold augmentation Remove ThresholdFixed Modify params to accept vector * Change kernel size to unsigned for Dilate and Erode * Add support for erase augmentation in rocAL * Erase node with vector inputs * Fix erase augmentation * Change num boxes to vx_tensor type * Clean up erase augmentation codes * Add support for Crop and Patch augmentation * Add support for remap augmentation * Add unit trsts and python bindings for remap * Add support for RICAP * Add support for Bitwise NOT operation * Add support for Bitwise NOT * Reorganize code * Minor fix stddev for Non-linear blend * Add python support for newly added kernels Reorganize unit tests * Minor changes * Fix build issues * Minor change * Fix issues with Remap * Add new test cases * Fix params for Golden outputs * Fix the color ptr type in erase * Fix Erase color tensor * Add test cases for new augmentations * Add NonLinearBlend test cases Avoid running Grayscale for ColorCast * Update rocAL/include/api/rocal_api_augmentation.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Resolve PR comments * Add suitable python test cases and remove unwanted ones * Minor changes * Resolve copilot comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Resolve copilot comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Minor changes * Minor code clean up * Add test cases for Dilate, erode, magnitude, phase and warp perspective * Minor fixes threshold * Resolve copilot comments * Fix threshold pybind * Fix RICAP augmentation, create pinned memory for permutation * Minor change * Minor changes * Create a vx_tensor of UINT8 type for RGB array * Add python support for the new augmentations * Minor change * Add VX_RPP version check for new augmentations * Add version check for new augmentations * Fix version check in THROW statements * Add version check for new augmentations * Minor changes - resolve review comments * Update python description * Add border type for gaussian filter * Introduce ImageBorderType enum * Resolve PR comments * Address review comments * Address review comments * Address review comments * Update copyright --------- Co-authored-by: Fiona Gladwin <121928245+fgladwin@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Sundar Rajan Vaithiyanathan <svaithiy@amd.com> Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com>
* Add support for ColorCast * Add support for grid mask augmentation * Add NonLinearBlend support in rocAL * Add support for the Median Filter and Gaussian filter * Fix kernel size data type for Gaussian and Median Filters Change copyright Add unit tests for NonLinearBlend, Gaussian and Median filters * Add support for Warp perspective augmentation * Add support for Threshold augmentation and API * Add rocAL support for new augmentations Dilate Erode Magnitude Phase * Fix unit tests * Modify copyright * Warp Perspective fixes Remove per-iter updation of perspective array Add unit test for WarpPerspective * Fix Threshold augmentation Remove ThresholdFixed Modify params to accept vector * Change kernel size to unsigned for Dilate and Erode * Add support for erase augmentation in rocAL * Erase node with vector inputs * Fix erase augmentation * Change num boxes to vx_tensor type * Clean up erase augmentation codes * Add support for Crop and Patch augmentation * Add support for remap augmentation * Add unit trsts and python bindings for remap * Add support for RICAP * Add support for Bitwise NOT operation * Add support for Bitwise NOT * Reorganize code * Minor fix stddev for Non-linear blend * Add python support for newly added kernels Reorganize unit tests * Minor changes * Fix build issues * Minor change * Fix issues with Remap * Add new test cases * Fix params for Golden outputs * Fix the color ptr type in erase * Fix Erase color tensor * Add test cases for new augmentations * Add NonLinearBlend test cases Avoid running Grayscale for ColorCast * Update rocAL/include/api/rocal_api_augmentation.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Resolve PR comments * Add suitable python test cases and remove unwanted ones * Minor changes * Resolve copilot comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Resolve copilot comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Minor changes * Minor code clean up * Add test cases for Dilate, erode, magnitude, phase and warp perspective * Minor fixes threshold * Resolve copilot comments * Fix threshold pybind * Fix RICAP augmentation, create pinned memory for permutation * Minor change * Minor changes * Create a vx_tensor of UINT8 type for RGB array * Add python support for the new augmentations * Minor change * Add VX_RPP version check for new augmentations * Add version check for new augmentations * Fix version check in THROW statements * Add version check for new augmentations * Minor changes - resolve review comments * Update python description * Add border type for gaussian filter * Introduce ImageBorderType enum * Add rocAL support for Set 1 augmentations: GaussianNoise, ShotNoise, Spatter, Log, ColorJitter, Water - Add node headers and implementations for GaussianNoise, ShotNoise, Spatter, Log, ColorJitter, Water - Add C API declarations and implementations in rocal_api_augmentation.h/cpp - Add Python bindings in rocal_pybind.cpp and fn.py * Add VX_EXT_RPP version check for Set 1 augmentation APIs * Update vx_rpp version checks to 3.1.5 for Set 1 augmentations - Update VX_EXT_RPP_CHECK_VERSION to (3, 1, 5) in API file - Update THROW messages to indicate vx_rpp >= 3.1.5 - Add version checks in node files: node_gaussian_noise.cpp, node_shot_noise.cpp, node_spatter.cpp, node_water.cpp, node_color_jitter.cpp, node_log.cpp * Add C++ and Python tests for Set 1 augmentations C++ tests (unit_tests.cpp): - Case 64: rocalGaussianNoise (random) - Case 65: rocalGaussianNoiseFixed - Case 66: rocalShotNoise (random) - Case 67: rocalShotNoiseFixed - Case 68: rocalSpatter - Case 69: rocalLog - Case 70: rocalColorJitter (random) - Case 71: rocalColorJitterFixed - Case 72: rocalWater (random) - Case 73: rocalWaterFixed Python tests (unit_test.py): - gaussian_noise, shot_noise, spatter, water, color_jitter Shell scripts updated: - testAllScripts.sh: Added C++ test entries - unit_tests.sh: Added Python test entries * Fix issue with Log * Unit tests fix * Spatter API changes * Update copyright year to 2026 * Move VX_EXT_RPP_CHECK_VERSION to beginning of API functions Move version check to the very beginning of each function, before any variable assignments or context validation, for all Set 1 augmentation APIs. * Resolve PR comments * Address review comments * Address review comments * Address review comments * Update copyright --------- Co-authored-by: fiona-gladwin <fionagladwin@multicorewareinc.com> Co-authored-by: Fiona Gladwin <121928245+fgladwin@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Fiona-MCW <70996026+fiona-gladwin@users.noreply.github.com> Co-authored-by: SundarRajan28 <sundarrajan@multicorewareinc.com> Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com>
Integrates new RPP augmentations in rocAL: ChannelPermute ColorToGreyscale JpegCompressionDistortion Lut Posterize Solarize --------- Co-authored-by: fiona-gladwin <fionagladwin@multicorewareinc.com> Co-authored-by: Fiona Gladwin <121928245+fgladwin@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Fiona-MCW <70996026+fiona-gladwin@users.noreply.github.com> Co-authored-by: SundarRajan28 <sundarrajan@multicorewareinc.com> Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com> Co-authored-by: Sundar Rajan Vaithiyanathan <99159823+SundarRajan28@users.noreply.github.com>
* add __version__ option to rocAL and remove unnecessary files * copyright clean up
Integrates new RPP augmentations in rocAL: TensorSum TensorMin TensorMax TensorMean TensorStdDev --------- Co-authored-by: fiona-gladwin <fionagladwin@multicorewareinc.com> Co-authored-by: Fiona Gladwin <121928245+fgladwin@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Fiona-MCW <70996026+fiona-gladwin@users.noreply.github.com> Co-authored-by: SundarRajan28 <sundarrajan@multicorewareinc.com> Co-authored-by: Lakshmi Kumar <lakshmi.kumar@amd.com> Co-authored-by: Sundar Rajan Vaithiyanathan <99159823+SundarRajan28@users.noreply.github.com>
No description provided.