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

Fixes for using Python APIs from Rust. #7085

Merged
merged 6 commits into from
Mar 4, 2021

Conversation

jroesch
Copy link
Member

@jroesch jroesch commented Dec 10, 2020

cc @hypercubestart this is a bigger PR to fix the current bindings and enable calling them with the Python code, but it needs a bit of cleanup, there are some changes that I used to debug segfaults.

@jroesch
Copy link
Member Author

jroesch commented Feb 4, 2021

cc @hypercubestart @binarybana @imalsogreg updated this

@jroesch jroesch changed the title [WIP] Fixes for using Python APIs from Rust. Fixes for using Python APIs from Rust. Feb 18, 2021
@jroesch jroesch force-pushed the fix-for-therml branch 2 times, most recently from 56772fa to ce92b07 Compare February 19, 2021 03:11
This commit also updates the docs to remove outdated information.
Copy link
Contributor

@hypercubestart hypercubestart left a comment

Choose a reason for hiding this comment

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

does this test pass now?

let sys = py.import("tvm")?;
let version: String = sys.get("__version__")?.extract()?;
// py.run(TVMC_CODE, None, None)?;
let imported_mod = import_python(py, "tvm")?;
Copy link
Contributor

Choose a reason for hiding this comment

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

oops forgot to add the comment.

theres an ignored test test_run in this file, if everything works the ignore attribute should be removed

Copy link
Member Author

Choose a reason for hiding this comment

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

This test seems to pass on most platforms but not CI, going to keep disabled until I can be sure it won't cause CI flakiness.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, its strange to me that loading tvm into rust is flaky though

@vegaluisjose
Copy link
Member

There seems to be a problem with scipy in the CI @jroesch ?

Copy link
Member

@vegaluisjose vegaluisjose left a comment

Choose a reason for hiding this comment

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

LGTM

use crate::{errors, function::Function};

const ENTRY_FUNC: &str = "__tvm_main__";

/// Wrapper around TVM module handle which contains an entry function.
/// The entry function can be applied to an imported module through [`entry_func`].
///
/// [`entry_func`]:struct.Module.html#method.entry_func
Copy link
Contributor

Choose a reason for hiding this comment

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

is this comment still true?

let sys = py.import("tvm")?;
let version: String = sys.get("__version__")?.extract()?;
// py.run(TVMC_CODE, None, None)?;
let imported_mod = import_python(py, "tvm")?;
Copy link
Contributor

Choose a reason for hiding this comment

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

ok, its strange to me that loading tvm into rust is flaky though

///
/// * `config` - The configuration for the compiler.
/// * `module` - The IRModule to compile.
pub fn compile_module(config: CompilerConfig, module: IRModule) -> Result<RtModule, Error> {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a test for this?

@vegaluisjose vegaluisjose merged commit 6aae48b into apache:main Mar 4, 2021
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
* Rewrite the Rust Module API and change some imports causing crashes.

This commit also updates the docs to remove outdated information.

* Renable Python test and remove warnings

* Python test still flaky

* Fix broken module test

* Fix broken test

* Reset test file
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
* Rewrite the Rust Module API and change some imports causing crashes.

This commit also updates the docs to remove outdated information.

* Renable Python test and remove warnings

* Python test still flaky

* Fix broken module test

* Fix broken test

* Reset test file
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.

5 participants