Skip to content

[runtime] Add Metadata classes for AOTExecutor - #10282

Merged
tmoreau89 merged 5 commits into
apache:mainfrom
areusch:aot-mbmr-metadata
Feb 22, 2022
Merged

[runtime] Add Metadata classes for AOTExecutor#10282
tmoreau89 merged 5 commits into
apache:mainfrom
areusch:aot-mbmr-metadata

Conversation

@areusch

Copy link
Copy Markdown
Contributor

This PR adds Metadata classes to hold model metadata needed to implement a Module-based Model Runtime interface for AOT. These Metadata implementations are distinct from others in the codebase in that all of the backing data can exist in C as const struct (meaning that on small targets, it can live along with the code in e.g. flash memory).

TODO: add test to verify that metadata.h compiles from a C compiler.

cc @Mousius@manupa-arm@kparzysz-quic@masahi@mehrdadh

 * These were autogenerated in the original PR, but checking them in
as plain code until we can revisit the auto-generator approach.
Comment threadsrc/target/metadata.h
Comment threadsrc/target/metadata.h
@masahi

Copy link
Copy Markdown
Member

I'm going to merge this tomorrow if there is no comment, to unblock @areusch development. This PR is hard to review without seeing how it is used - We are hoping to have an active discussion at #10283 which builds on this PR.

@manupakmanupak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@areusch I did have a look. My concerns are mostly around docs and I could not follow the need for all these polymorphic objects (maybe its due to missing docs).

Happy to take them in a follow up.

Comment threadinclude/tvm/runtime/metadata.h
Comment threadinclude/tvm/runtime/metadata.h
Comment threadinclude/tvm/runtime/metadata_base.h
Comment threadinclude/tvm/runtime/metadata_base.h
Comment threadinclude/tvm/support/span.h
Comment threadsrc/target/metadata.h
Comment threadsrc/target/metadata.h
}
};

class InMemoryMetadataNode : public ::tvm::target::metadata::VisitableMetadataNode {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you provide more explanation for the variants of InMemory* ? Also the reasons for needing a seperate object for that as opposed to having a constructor for MetadataNode

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

also added docs

@areuschareusch left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@manupa-arm I added a bunch of docs, PTAL when you get a minute!

Comment threadinclude/tvm/runtime/metadata.h
Comment threadinclude/tvm/runtime/metadata_base.h
Comment threadinclude/tvm/runtime/metadata_base.h
Comment threadinclude/tvm/support/span.h
Comment threadsrc/target/metadata.h
Comment threadsrc/target/metadata.h
}
};

class InMemoryMetadataNode : public ::tvm::target::metadata::VisitableMetadataNode {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

also added docs

@manupakmanupak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@tmoreau89
tmoreau89 merged commit 33082e0 into apache:mainFeb 22, 2022
@tmoreau89

Copy link
Copy Markdown
Contributor

Thank you @manupa-arm and @areusch ! This PR has been merged.

pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
* Add new Metadata classes and base implementation.
* These were autogenerated in the original PR, but checking them in
as plain code until we can revisit the auto-generator approach.
* address masa comments
* Add documentation per Manupa's comments, and move kMetadataVersion namespace.
* remove get_name function, used for debugging
* clang-format
Sign up for freeto 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.

4 participants

@areusch@masahi@tmoreau89@manupak