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

[Relay] Introduce Executor and Runtime representations with associated registries #9246

Merged
merged 1 commit into from
Oct 26, 2021

Conversation

Mousius
Copy link
Member

@Mousius Mousius commented Oct 11, 2021

This is the underpinning Executor/Runtime objects for apache/tvm-rfcs#29, this doesn't change the wiring as yet since that's a pretty big change in itself. Most of this patch is TVM boilerplate, which I've tried to minimize - there's maybe some future work to decide how to more easily define some of these things.

Copy link
Contributor

@mbs-octoml mbs-octoml left a comment

Choose a reason for hiding this comment

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

This looks eminently sensible, thank you.

*
* \sa Executor
*/
class ExecutorNode : public Object {
Copy link
Contributor

Choose a reason for hiding this comment

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

Intended to be sub-classable right? Ie I don't have to reflect everything I care about into the generic attrs?

Copy link
Member Author

Choose a reason for hiding this comment

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

At the moment all the options are enclosed in the attributes, but I left it open for extension if we want to do class AOTExecutorNode : ExecutorNode or similar - I see this being more of a thing with Runtime which may well represent the runtime itself at some point.

* \brief Helper structure to register Executors
* \sa TVM_REGISTER_EXECUTOR
*/
class ExecutorRegEntry {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any hope of templating away all the gobs of boilerplate? Forgive me if there's an obvious catch I can't see.

Copy link
Member Author

Choose a reason for hiding this comment

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

I started down this path but realised that if we wanted to do this it'd make sense to do it in the context of:

I started doing this and ended up with what was essentially a templated mess - so I'd rather take it later and in isolation 😸

Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

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

@Mousius i think this makes lots of sense, thanks for the PR! a couple comments on the specifics of attributes--feel free to punt on these til the next PR, just wondering your intentions.


/********** Register Runtimes and options **********/

TVM_REGISTER_RUNTIME("c").add_attr_option<Bool>("system-lib");
Copy link
Contributor

Choose a reason for hiding this comment

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

before we were using crt which i admit is a bit of a double-naming. however, we also use crt to identify the C runtime in the source tree...so i sort of also see it as a name in and of itself.

additionally, we have quite a few more attributes that could be moved. just curious what your plan is here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can rename to crt in the next patch in the series, so that's simples.

Which other attributes were you meaning? I think I missed workspace-byte-alignment for AOT but I can't really dissect the other attributes on the other Targets, would appreciate some help and happy to tweak this list further as I get to the next patch 😸


TVM_REGISTER_EXECUTOR("graph").add_attr_option<Bool>("link-params", Bool(false));

TVM_REGISTER_EXECUTOR("vm");
Copy link
Contributor

Choose a reason for hiding this comment

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

should we register this now @mbs-octoml or after we actually merge all the compilation flows?

Copy link
Member Author

Choose a reason for hiding this comment

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

Whatever the outcome, I can add/remove it in the next PR in the series 😸

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not fussed -- the code paths are so independent at the moment the real work is to come anyway.


/********** Register Executors and options **********/

TVM_REGISTER_EXECUTOR("aot")
Copy link
Contributor

Choose a reason for hiding this comment

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

although we don't use the original link-params method at runtime for AOT, don't we use it as an enable for certain things in the AOT compilation flow?

Copy link
Member Author

Choose a reason for hiding this comment

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

I seem to remember this, I think the limitation is more that you had to have link-params for AOT as it didn't understand not having them? So if I remove this I have to add more checks for executor == AOT, I checked #7785 and #7988.

@Mousius
Copy link
Member Author

Mousius commented Oct 14, 2021

@areusch, just to clarify, this lands the infrastructure to start generating arguments in line with https://github.com/apache/tvm-rfcs/blob/main/rfcs/0028-command-line-registry-composition.md and work my way through the options there - so I expect a bit of change in the actual attrs when they're wired end-to-end (including relay.build(..., executor=..., runtime=...), so if there's anything missed feel free to drop it here or on that incoming PR 😸

…d registries

This is the underpinning Executor/Runtime objects for apache/tvm-rfcs#29, this doesn't change the wiring as yet since that's a pretty big change in itself. Most of this patch is TVM boilerplate, which I've tried to minimize - there's maybe some future work to decide how to more easily define some of these things.
Copy link
Contributor

@leandron leandron left a comment

Choose a reason for hiding this comment

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

LGTM

@leandron leandron merged commit ff43f99 into apache:main Oct 26, 2021
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
…d registries (apache#9246)

This is the underpinning Executor/Runtime objects for apache/tvm-rfcs#29, this doesn't change the wiring as yet since that's a pretty big change in itself. Most of this patch is TVM boilerplate, which I've tried to minimize - there's maybe some future work to decide how to more easily define some of these things.
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
…d registries (apache#9246)

This is the underpinning Executor/Runtime objects for apache/tvm-rfcs#29, this doesn't change the wiring as yet since that's a pretty big change in itself. Most of this patch is TVM boilerplate, which I've tried to minimize - there's maybe some future work to decide how to more easily define some of these things.
areusch added a commit to areusch/tvm that referenced this pull request Feb 22, 2022
areusch added a commit to areusch/tvm that referenced this pull request Feb 23, 2022
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.

4 participants