Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to get and set late-bound constants. #12664

Merged
merged 6 commits into from
Sep 1, 2022
Merged

Add methods to get and set late-bound constants. #12664

merged 6 commits into from
Sep 1, 2022

Conversation

rkimball
Copy link
Contributor

This PR adds methods to both get and set late-bound constants.

The current approach for saving and restoring a model's late-bound constants is via the either MoveLateBoundConstantsToFile and then this file can be reloaded to the Executable by calling LoadLateBoundConstantsFromFile. These methods save the constants to a file consts.

I have a need to save and restore the constants in a pre-existing format. In order to write these I added GetLateBoundConstants which returns a Map of all late-bound contants. To restore the constants back to the Executable LoadLateBoundConstantsFromMap was added.

The PR arranges the code so that both GetLateBoundConstants and LoadLateBoundConstantsFromMap are used in the existing methods to write and read late-bound constants. This means there is minimal code change, functions were mostly just rearranged to expose the two new entry points.

@jwfromm
Copy link
Contributor

jwfromm commented Aug 31, 2022

Thanks @rkimball, this overall looks like a solid change. The one thing I'd like to see is the addition of some tests to make sure this works as expected.

@jwfromm jwfromm self-requested a review August 31, 2022 19:32
@rkimball
Copy link
Contributor Author

Thank you Josh. I added some tests. Much of this new code is already tested as it is an integral part of the normal save/load. I added tests for the new API functions.

Copy link
Contributor

@jwfromm jwfromm left a comment

Choose a reason for hiding this comment

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

Thanks for adding the tests, this all LGTM!

@jwfromm jwfromm merged commit effcd22 into apache:main Sep 1, 2022
@jwfromm
Copy link
Contributor

jwfromm commented Sep 1, 2022

This is now merged, thanks @rkimball!

xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
* Add methods to read and restore late-bound constants on Executable.

* Add bindings for new functions

* Cleanup

* Fix function name

* Add tests for python API to access new load/save functions

* Add another tests for python API to access new load/save functions where there are no constants
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