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

[TVMScript][Relax] Preserve tir.SizeVar through TVMScript round-trip #17083

Merged

Conversation

Lunderberg
Copy link
Contributor

Prior to this commit, all symbolic variables were printed identically, regardless of whether the underlying variable was a tir.Var or tir.SizeVar. As a result, numeric simplifications that rely on a tir.SizeVar being non-negative may be skipped after a round-trip through TVMScript.

This commit updates the TVMScript printing and parsing of Relax functions to use var = T.int64(is_size_var=True) for tir.SizeVar, matching how tir.SizeVar is parsed for TIR functions. As an added benefit, this also allows Relax functions R.Prim arguments other than int64 to be benefit. This may be useful in the future, such as to specify the fill value for R.full.

Prior to this commit, all symbolic variables were printed identically,
regardless of whether the underlying variable was a `tir.Var` or
`tir.SizeVar`.  As a result, numeric simplifications that rely on a
`tir.SizeVar` being non-negative may be skipped after a round-trip
through TVMScript.

This commit updates the TVMScript printing and parsing of Relax
functions to use `var = T.int64(is_size_var=True)` for `tir.SizeVar`,
matching how `tir.SizeVar` is parsed for TIR functions.  As an added
benefit, this also allows Relax functions `R.Prim` arguments other
than `int64` to be benefit.  This may be useful in the future, such as
to specify the fill value for `R.full`.
@Lunderberg Lunderberg merged commit 5618628 into apache:main Jun 13, 2024
19 checks passed
@Lunderberg Lunderberg deleted the tvmscript_preserve_size_var_in_relax branch June 13, 2024 11:50
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.

None yet

2 participants