Skip to content

Importer: carry model-level metadata_props onto the module - #1171

Open
t-henn wants to merge 1 commit into
release_mds_1_0_3from
thomhenn.metadata
Open

t-henn wants to merge 1 commit into
release_mds_1_0_3from
thomhenn.metadata

Conversation

@t-henn

@t-henn t-henn commented Dec 2, 2026

Copy link
Copy Markdown

Summary

metadata_props on ModelProto were dropped at import: only producer_name
was copied onto the module. They are now imported as a string-to-string
onnx.metadata_props dictionary attribute, next to producer.name.

The attribute is only set when the model has entries, so IR for models
without metadata is unchanged.

Tests

test/mlir/onnx/parse/test_metadata_props.onnxtext covers import, key
sorting and dotted keys; test_metadata_props_absent.onnxtext covers the
no-metadata case.

@jorickert jorickert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks

}
if (!metadataProps.empty()) {
module_->setAttr(
"onnx.metadata_props", builder_.getDictionaryAttr(metadataProps));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: This will assert for duplicate keys, but i think this is fine as this is not allowed by onnx either. Alternative would be to use NamedAttrList instead of llvm::SmallVector which will deduplicate

@jorickert

Copy link
Copy Markdown
Collaborator

Remember that we have no backport automation here, you will need to do it manually

@t-henn
t-henn force-pushed the thomhenn.metadata branch from 75b1b9f to 10e1a82 Compare December 4, 2026 13:26
@t-henn
t-henn force-pushed the thomhenn.metadata branch from 10e1a82 to 35f433c Compare December 4, 2026 13:50
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.

2 participants