Skip to content

[Fix][TIRx] Fix MSVC build of IndexDataTypeNormalizer - #20098

Merged
tqchen merged 1 commit into
apache:mainfrom
MasterJH5574:tvm-dev/2026-08-05-main-msvc-fix
Aug 5, 2026
Merged

[Fix][TIRx] Fix MSVC build of IndexDataTypeNormalizer#20098
tqchen merged 1 commit into
apache:mainfrom
MasterJH5574:tvm-dev/2026-08-05-main-msvc-fix

Conversation

@MasterJH5574

Copy link
Copy Markdown
Contributor

Port of #20096, which landed on the v0.26.0 release branch first to unblock the v0.26.0.rc0 Windows wheel. main has the same breakage.

MSVC fails to compile the class-qualified call:

src\tirx\ir\data_type_rewriter.cc(696,47): error C2352:
  'tvm::tirx::ExprMutator::VisitPrimExpr': a call of a non-static member function requires an object

StmtExprMutator derives from both ExprMutator and StmtMutator and re-exports the name via using ExprMutator::VisitPrimExpr;. MSVC resolves the qualified IndexDataTypeNormalizer::VisitPrimExpr down to ExprMutator::VisitPrimExpr and then fails to form the implicit object conversion. GCC and Clang accept the same expression, so only the Windows leg broke — macOS and both Linux wheels built fine.

The fix calls it through this, matching every other VisitPrimExpr call site in this file. VisitPrimExpr is a non-virtual inline helper, so the qualification was suppressing nothing and behavior is unchanged. The other class-qualified call sites in the tree name StmtExprMutator directly — that is where the using-declaration lives, so they resolve fine and are left alone.

The call was introduced in #19931, which changed IndexDataTypeNormalizer::VisitExpr to IndexDataTypeNormalizer::VisitPrimExpr; the former resolved unambiguously.

Original failing job: https://github.com/apache/tvm/actions/runs/31033249253/job/92400739674

MSVC rejects the class-qualified call with C2352 ("a call of a non-static
member function requires an object"). StmtExprMutator derives from both
ExprMutator and StmtMutator and re-exports the name via
`using ExprMutator::VisitPrimExpr;`. MSVC resolves the qualified
IndexDataTypeNormalizer::VisitPrimExpr down to ExprMutator::VisitPrimExpr
and then fails to form the implicit object conversion. GCC and Clang accept
the same expression, so only the Windows build broke.

Call it through this instead, matching every other VisitPrimExpr call site
in this file. VisitPrimExpr is a non-virtual inline helper, so the
qualification was suppressing nothing and behavior is unchanged. The other
class-qualified call sites in the tree name StmtExprMutator directly, which
is where the using-declaration lives, so they resolve fine.

Port of apache#20096, which landed on the v0.26.0 release branch first to unblock
the v0.26.0.rc0 Windows wheel.
@tqchen
tqchen merged commit c737bf7 into apache:main Aug 5, 2026
8 checks passed
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