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 'static_library' runtime::Module #11442

Merged
merged 1 commit into from
May 26, 2022

Conversation

mbs-octoml
Copy link
Contributor

@mbs-octoml mbs-octoml commented May 24, 2022

(See https://discuss.tvm.apache.org/t/byoc-supporting-cutlass-byoc-with-collage/12796/6 for
context, which in turn is part of Collage (https://github.com/apache/tvm-rfcs/blob/main/rfcs/0062-collage.md).

This adds a new 'DSO exportable' runtime module representing the contents of a .o file. It
allows external codegen toolchains to yield a result which:

  • Like CSource modules, can be conveyed directly to the final export_library compilation
    step for linking into the final .so and saved to a know location without risk the
    underlying code artifact will be lost.
  • Like DSOLibrary modules, are self contained so that no additional compile-time arguments
    need be conveyed from the CSource module to the final export_library command line

Since this is the third flavor of 'DSO exportable' module, add a Module::IsDSOExportable.

Since adding the above, can't resist also adding a Module::ImplementsFunction virtual and
calling it from TEComplier to check if an external codegen function actually provided the
implementation it promised.

Note:

  • I've left the existing implementation of runtime.load_module alone which
    relinks .o files to .so files.
  • Though also contained in the .o metadata, I require static libraries to always
    carry their list of exported function names.

This is all pretty stop gap pending a good rework of TVM to supoprt the notion of artifacts
and, perhaps, build rules.

@tqchen
Copy link
Member

tqchen commented May 24, 2022

Thanks @mbs-octoml . I think we go with this as a temp workaround with a mind that the IsDSOExportable and ImplementsFunction likely should go to Artifact.

@mbs-octoml
Copy link
Contributor Author

mbs-octoml commented May 24, 2022

Yeah, we really need to put some love into that.

Collecting all the pieces needed for deployment along with their metadata a la Artifact is pretty clearly needed, though I suspect that will need to be abstract to cover the spectrum from firmware image to dynamically loadable .so to ready-to-call JITed code to tar.

I can't help thinking we should also think about build rules guarded by target kinds & attributes, since again there's just so may ways to proceed.

@tqchen
Copy link
Member

tqchen commented May 24, 2022

Perhaps we will end up building our own cmake/bazel :p in another time

(See https://discuss.tvm.apache.org/t/byoc-supporting-cutlass-byoc-with-collage/12796/6 for
context, which in turn is part of Collage (https://github.com/apache/tvm-rfcs/blob/main/rfcs/0062-collage.md).

This adds a new 'DSO exportable' runtime module representing the contents of a .o file. It
allows external codegen toolchains to yield a result which:
 - Like CSource modules, can be conveyed directly to the final export_library compilation
   step for linking into the final .so and saved to a know location without risk the
   underlying code artifact will be lost.
 - Like DSOLibrary modules, are self contained so that no additional compile-time arguments
   need be conveyed from the CSource module to the final export_library command line

Since this is the third flavor of 'DSO exportable' module, add a Module::IsDSOExportable.

Since adding the above, can't resist also adding a Module::ImplementsFunction virtual and
calling it from TEComplier to check if an external codegen function actually provided the
implementation it promised.

Note:
 - I've left the existing implementation of runtime.load_module alone which
   relinks .o files to .so files.
 - Though also contained in the .o metadata, I require static libraries to always
   carry their list of exported function names.

This is all pretty stop gap pending a good rework of TVM to supoprt the notion of artifacts
and, perhaps, build rules.
@mbs-octoml
Copy link
Contributor Author

mbs-octoml commented May 25, 2022

Thanks Tianqi. Let's see if this new fancy bot works...

@mbs-octoml
Copy link
Contributor Author

@tvm-bot merge

@github-actions
Copy link
Contributor

Cannot merge, did not find any approving reviews from users with write access on 96d4e62

@mbs-octoml
Copy link
Contributor Author

Hmff.

@github-actions
Copy link
Contributor

Cannot merge, did not find any approving reviews from users with write access on 96d4e62

driazati added a commit to driazati/tvm that referenced this pull request May 25, 2022
driazati added a commit to driazati/tvm that referenced this pull request May 25, 2022
@tqchen tqchen merged commit db5f4fe into apache:main May 26, 2022
@mbs-octoml mbs-octoml deleted the mbs-collage-static-module branch May 26, 2022 18:31
areusch pushed a commit that referenced this pull request May 26, 2022
* [ci] Clean up mergebot commit messages

Adds both bullets and closes #11433

* Fix error from pr #11442

Co-authored-by: driazati <driazati@users.noreply.github.com>
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