Skip to content

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

Merged
tqchen merged 2 commits into
apache:mainfrom
Lunderberg:relax_codegen_ignore_primfunc
Feb 17, 2024
Merged

tqchen merged 2 commits into
apache:mainfrom
Lunderberg:relax_codegen_ignore_primfunc

Conversation

@Lunderberg

Copy link
Copy Markdown
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.

@yongwww yongwww left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good addition!


# 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
Copy Markdown
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
Copy Markdown
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.


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

Copy link
Copy Markdown
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
Copy Markdown
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
@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