This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new c737bf79fb [Fix][TIRx] Fix MSVC build of IndexDataTypeNormalizer
(#20098)
c737bf79fb is described below
commit c737bf79fb0dfcb2d951776b879db8feef7d626f
Author: Ruihang Lai <[email protected]>
AuthorDate: Wed Aug 5 18:32:15 2026 -0400
[Fix][TIRx] Fix MSVC build of IndexDataTypeNormalizer (#20098)
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
---
src/tirx/ir/data_type_rewriter.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tirx/ir/data_type_rewriter.cc
b/src/tirx/ir/data_type_rewriter.cc
index d8a6fff6cc..b2f66d06f6 100644
--- a/src/tirx/ir/data_type_rewriter.cc
+++ b/src/tirx/ir/data_type_rewriter.cc
@@ -693,7 +693,7 @@ Expr IndexDataTypeNormalizer::VisitExpr_(const CastNode*
op) {
// has some other purpose, and we should not unwrap the cast.
PrimType dtype = op->ty.as_or_throw<PrimType>();
if (is_enabled_ && CanRewriteDType(dtype)) {
- PrimExpr value = IndexDataTypeNormalizer::VisitPrimExpr(op->value);
+ PrimExpr value = this->VisitPrimExpr(op->value);
return value.ty() == target_data_type_ ? value : Cast(target_data_type_,
value);
}
return IndexDataTypeRewriter::VisitExpr_(op);