Skip to content

Conversation

Lunderberg
Copy link
Contributor

@Lunderberg Lunderberg commented Apr 12, 2024

Because Relax struct inference is performed while the function is being built, all constraints on symbolic variables that are used for simplifications must be provided to the analyzer. This is not currently the case, nor is there a clear way to fix this issue.

This PR adds a failing unit test to document this limitation.

Because Relax struct inference is performed while the function is
being built, all constraints on symbolic variables that are used
for simplifications must be provided to the analyzer.  This is not
currently the case, nor is there a clear way to fix this issue.
@vinx13 vinx13 merged commit 4cb4605 into apache:main Apr 16, 2024
@Lunderberg Lunderberg deleted the tvmscript_bug_symbolic_shape_bounds branch April 17, 2024 15:59
Lunderberg added a commit to Lunderberg/tvm that referenced this pull request Apr 28, 2024
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.
yongwww pushed a commit to yongwww/tvm that referenced this pull request Mar 17, 2025
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.
yongwww pushed a commit to yongwww/tvm that referenced this pull request Mar 17, 2025
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.
yongwww pushed a commit to yongwww/tvm that referenced this pull request Mar 17, 2025
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.
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