Skip to content

Conversation

@Lunderberg
Copy link
Contributor

As reported in #16877, shape inference performed during a Relax transformation may produce different results than shape inference performed during TVMScript parsing. While Relax transformations call Analyzer::MarkGlobalNonNegValue for each shape expression, this is not provided during TVMScript parsing. As a result, output shapes that are conditional on the sign of a variable may produce different results when simplifying.

This commit provides a partial resolution for this issue. Where prior to this commit, the TVMScript parser generated a tir.Var for each symbolic variable, the TVMScript parser now provides a tir.SizeVar for symbolic variables that are defined in contexts that require a non-negative size.

As reported in apache#16877, shape inference performed during a Relax
transformation may produce different results than shape inference
performed during TVMScript parsing.  While Relax transformations
call `Analyzer::MarkGlobalNonNegValue` for each shape expression, this
is not provided during TVMScript parsing.  As a result, output shapes
that are conditional on the sign of a variable may produce different
results when simplifying.

This commit provides a partial resolution for this issue.  Where prior
to this commit, the TVMScript parser generated a `tir.Var` for each
symbolic variable, the TVMScript parser now provides a `tir.SizeVar`
for symbolic variables that are defined in contexts that require a
non-negative size.
@tqchen
Copy link
Member

tqchen commented Feb 8, 2025

This is a nice PR that would be good to land it. cc @yongwww

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