Skip to content

Conversation

@HectorSVC
Copy link
Contributor

@HectorSVC HectorSVC commented Jul 14, 2025

The existing API ReadOpAttr & CreateOpAttr for string type always assume there '\0' at the end. It blocks the EPs to embed/read the context binary byte buffer into EPContext node ep_cache_context attribute.
Update the customer op API ReadOpAttr for string type to avoid adding '\0' at the end.
Update CreateOpAttr API to construct the string with len.
Keep the strings type processing as it is for now.

@HectorSVC HectorSVC marked this pull request as draft July 14, 2025 20:49
@HectorSVC HectorSVC closed this Jul 15, 2025
@HectorSVC HectorSVC reopened this Jul 15, 2025
@HectorSVC HectorSVC marked this pull request as ready for review July 16, 2025 05:59
@yuslepukhin
Copy link
Member

  str->resize(total_attr_bytes, '\0');

I believe this just wastes cycles.


Refers to: include/onnxruntime/core/providers/utils/ort_graph_to_proto.h:668 in 3863990. [](commit_id = 3863990, deletion_comment = False)

Update example code
@HectorSVC
Copy link
Contributor Author

  str->resize(total_attr_bytes, '\0');

will remove it.


In reply to: 3080645591


Refers to: include/onnxruntime/core/providers/utils/ort_graph_to_proto.h:668 in 3863990. [](commit_id = 3863990, deletion_comment = False)

@yuslepukhin
Copy link
Member

  str->resize(total_attr_bytes, '\0');

will remove it.

resize() may still be necessary, but filling it with zeros, not really.

@HectorSVC HectorSVC changed the title Update the customer op API ReadOpAttr for string type to avoid adding '\0' to the end Update API ReadOpAttr and CreateOpAttr for string type to unblock EPs to process EPContext node for ep_cache_context with bytes stream Jul 18, 2025
@HectorSVC HectorSVC merged commit 12121aa into main Jul 18, 2025
90 checks passed
@HectorSVC HectorSVC deleted the get_node_attr_string branch July 18, 2025 18:04
@snnn
Copy link
Contributor

snnn commented Jul 25, 2025

Hi there! We haven't cut the release branch for this version yet, so I'm removing the release:1.23.0 label for now to keep things tidy. Thanks so much for your contribution! We'll make sure this gets included when the release is prepared. 🤖

qti-yuduo pushed a commit to CodeLinaro/onnxruntime that referenced this pull request Aug 8, 2025
… to process EPContext node for ep_cache_context with bytes stream (microsoft#25389)

The existing API ReadOpAttr & CreateOpAttr for string type always assume there '\0' at the end. It blocks the EPs to embed/read the context binary byte buffer into EPContext node ep_cache_context attribute.
Update the customer op API ReadOpAttr for string type to avoid adding '\0' at the end.
Update CreateOpAttr API to construct the string with len.
Keep the strings type processing as it is for now.
sanketkaleoss pushed a commit to sanketkaleoss/onnxruntime that referenced this pull request Aug 11, 2025
… to process EPContext node for ep_cache_context with bytes stream (microsoft#25389)

The existing API ReadOpAttr & CreateOpAttr for string type always assume there '\0' at the end. It blocks the EPs to embed/read the context binary byte buffer into EPContext node ep_cache_context attribute.
Update the customer op API ReadOpAttr for string type to avoid adding '\0' at the end.
Update CreateOpAttr API to construct the string with len.
Keep the strings type processing as it is for now.
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