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

[Relax] Ignore non-relax functions in relax.transform.RunCodegen #16586

Merged
merged 2 commits into from
Feb 17, 2024

Conversation

Lunderberg
Copy link
Contributor

The relax.transform.RunCodegen pass replaces calls to relax functions with the "Codegen" attribute with calls into a compiled module. Prior to this commit, while calls to relax functions without the "Codegen" attribute were ignored, calls to non-relax functions would raise an error.

This commit updates relax.transform.RunCodegen to also ignore calls to non-relax functions.

The `relax.transform.RunCodegen` pass replaces calls to relax functions
with the `"Codegen"` attribute with calls into a compiled module.
Prior to this commit, while calls to relax functions without the
`"Codegen"` attribute were ignored, calls to non-relax functions would
raise an error.

This commit updates `relax.transform.RunCodegen` to also ignore calls
to non-relax functions.
Copy link
Member

@yongwww yongwww left a comment

Choose a reason for hiding this comment

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

good addition!

@@ -40,7 +40,7 @@
)

# Global variable in pytest that applies markers to all tests.
pytestmark = [has_tensorrt_codegen, has_tensorrt_runtime]
# pytestmark = [has_tensorrt_codegen, has_tensorrt_runtime]
Copy link
Member

Choose a reason for hiding this comment

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

I guess we will need this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, thank you for the catch. This was commented out for debugging, and the PR is updated to remove the change.

@@ -350,6 +350,36 @@ def main(

after = relax.transform.RunCodegen()(Before)
tvm.ir.assert_structural_equal(after["main"], Expected["main"])
after.show()
Copy link
Member

Choose a reason for hiding this comment

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

remove this printing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, and cleaned up!

@tqchen tqchen merged commit a692453 into apache:main Feb 17, 2024
20 checks passed
@Lunderberg Lunderberg deleted the relax_codegen_ignore_primfunc branch February 17, 2024 15:05
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.

3 participants