Skip to content

Fg/ser2 pipe serialize#20

Open
fgladwin wants to merge 135 commits into
fgladwin:developfrom
fiona-gladwin:fg/ser2_pipe_serialize
Open

Fg/ser2 pipe serialize#20
fgladwin wants to merge 135 commits into
fgladwin:developfrom
fiona-gladwin:fg/ser2_pipe_serialize

Conversation

@fgladwin
Copy link
Copy Markdown
Owner

@fgladwin fgladwin commented May 5, 2026

No description provided.

fiona-gladwin and others added 30 commits September 22, 2025 02:30
Remove the usage of API enums in internal node files
Add support to register all internal enums
Creates an argument instance for each arg passed in the Node
Handles different argument types i.e parameters, vectors, enums and predefined types
Add support to serialize the args and pipeline details
Add support to serialize the tensors.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Create single constructor with check for different data types in Argument class
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
fiona-gladwin and others added 27 commits November 12, 2025 04:00
…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>
Copy link
Copy Markdown

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

This PR introduces pipeline serialization support for rocAL by adding a protobuf schema and a serializer that captures pipeline config, operators, arguments, and tensor metadata, then exposes this via new public C APIs.

Changes:

  • Added rocal.proto and a new PipelineSerializer to emit a binary protobuf representation of the built pipeline.
  • Added public APIs rocalSerialize() and rocalGetSerializedString() and wired them through MasterGraph.
  • Adjusted several tensor/node/operator accessors to return const& for more efficient, const-correct access, and updated build/docs dependencies accordingly.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
rocAL/source/pipeline/pipeline_serializer.cpp Implements protobuf population + serialization for pipeline config, operators, args, and tensors
rocAL/source/pipeline/master_graph.cpp Adds MasterGraph::serialize() entry point to build the serialized pipeline string
rocAL/source/api/rocal_api.cpp Exposes serialization through new C APIs and copies serialized bytes to user buffer
rocAL/proto/rocal.proto Defines protobuf messages for pipeline/operator/argument/tensor serialization
rocAL/include/pipeline/tensor.h Makes tensor_name() return const std::string& and const-qualifies it
rocAL/include/pipeline/pipeline_serializer.h Declares PipelineSerializer interface
rocAL/include/pipeline/pipeline_operator.h Adds helpers to retrieve operator arguments and node IO tensors
rocAL/include/pipeline/node.h Changes input()/output() to return const std::vector<Tensor*>&
rocAL/include/pipeline/master_graph.h Declares serialization APIs and stores serialized pipeline string
rocAL/include/api/rocal_api.h Declares new public serialization APIs and documents buffer requirements
rocAL/CMakeLists.txt Adds protobuf generation/build integration for rocal.proto
docs/sphinx/requirements.txt Adjusts Sphinx-related dependency versions
docs/sphinx/requirements.in Bumps rocm-docs-core dependency version
CHANGELOG.md Notes new serialization functionality and APIs for upcoming release

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

Comment on lines +25 to +26
#include <fstream>


void PipelineSerializer::serialize_to_string(std::string& serialized_string) {
if (!_pipeline_proto.SerializeToString(&serialized_string)) {
THROW("Failed to serialize pipeline to string.");
Comment on lines +42 to +52
void set_tensor_proto(rocal_proto::InputOutput *in_out_proto, Tensor *tensor, bool is_input) {
in_out_proto->set_name(tensor->tensor_name());
in_out_proto->set_device(static_cast<int>(tensor->info().mem_type()));
in_out_proto->set_dtype(static_cast<int>(tensor->info().data_type()));
in_out_proto->set_layout(static_cast<int>(tensor->info().layout()));
in_out_proto->set_color_format(static_cast<int>(tensor->info().color_format()));
for (auto &dim : tensor->info().dims())
in_out_proto->add_dims(dim);
in_out_proto->set_num_dims(tensor->info().num_of_dims());
in_out_proto->set_is_argument_input(is_input);
}
Comment on lines +82 to +85
if (op_arg.values.empty()) {
// Represent empty vector by adding an empty vector message of the right type
if (op_arg.type_name == "int" || op_arg.type_name == "shared_ptr"
|| op_arg.type_name == "unsigned" || op_arg.type_name == "size_t") {
Comment on lines +56 to +60
void serialize_output_tensors(TensorList& output_tensors_list);
/**
* @brief Serialize all operators in the pipeline, their arguments, and IO tensors.
*/
void serialize_operators(std::vector<std::shared_ptr<PipelineOperator>>& operators);
*/
void serialize(size_t *serialized_string_size); // Serialize the current pipeline to an internal string and return its size.
// Returns the last serialized pipeline string, Should be called after serialize(). Returns an empty string if serialize() hasn't been called.
std::string& get_serialized_string() { return _serialized_pipeline; }
auto context = static_cast<Context*>(rocal_context);
try {
if (!serialized_string) {
THROW("String copy failed, Invalid pointer passed for serialize.")
Comment on lines +126 to +139
* into the user-provided buffer. The buffer must be pre-allocated with size
* at least serialized_string_size + 1 bytes to accommodate the null terminator.
*
* \warning The caller is responsible for ensuring the destination buffer has
* sufficient capacity (at least serialized_string_size + 1 bytes as returned by
* rocalSerialize). Passing an insufficiently sized buffer will result in buffer
* overflow and undefined behavior.
*
* \param [in] rocal_context the rocAL context
* \param [out] serialized_string destination buffer to receive the serialized string (null-terminated).
* Must be pre-allocated with at least serialized_string_size + 1 bytes.
* \return A \ref RocalStatus - A status code indicating the success or failure.
*/
extern "C" RocalStatus ROCAL_API_CALL rocalGetSerializedString(RocalContext rocal_context, char* serialized_string);
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.

6 participants