petersktang commented on issue #20042:
URL: https://github.com/apache/tvm/issues/20042#issuecomment-5486734471
## tvm-ffi headers included by tvm has cxx standard compatibility issue
- when building `src/te/operation/create_primfunc.cc`, it in turn includes
`3rdparty/tvm-ffi/include/tvm/ffi/reflection/registry.h` and ultimately
`optional`.
### Build error included below
```
Building CXX object
CMakeFiles/tvm_objs.dir/src/te/operation/create_primfunc.cc.o
FAILED: [code=1]
CMakeFiles/tvm_objs.dir/src/te/operation/create_primfunc.cc.o
ccache /opt/rocm/llvm/bin/clang++ -DNDEBUG=1
-DTVM_FFI_CMAKE_LITTLE_ENDIAN=1 -DTVM_INDEX_DEFAULT_I64=1
-DTVM_KALLOC_ALIGNMENT=64 -DTVM_LLVM_HAS_AARCH64_TARGET=1
-DTVM_LLVM_VERSION=221 -DTVM_THREADPOOL_USE_OPENMP=0 -DTVM_USE_Z3
-DTVM_VERSION=\"0.27.dev85\" -D_GLIBCXX_USE_CXX11_ABI -D_GNU_SOURCE
-D__HIP_PLATFORM_AMD__=1 -D__HIP_PLATFORM_HCC__=1 -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I.../apache.tvm/include
-I.../apache.tvm/3rdparty/tvm-ffi/include
-I.../apache.tvm/3rdparty/tvm-ffi/3rdparty/dlpack/include -isystem
.../apache.tvm/3rdparty/compiler-rt -isystem /opt/rocm/include -isystem
/tmp/pip-build-env-rvtud5_k/overlay/lib/python3.14/site-packages/mlc_z3_static/static/include
-faligned-new -O2 -Wall -fPIC -fvisibility-inlines-hidden -fmessage-length=0
-march=x86-64-v2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong
-fno-plt -O2 -ffunction-sections -pipe -isystem
/home/petersktang/miniconda3/envs/tvm/include -I/home/petersktang/mi
niconda3/envs/tvm/targets/x86_64-linux/include
-I/home/petersktang/miniconda3/envs/tvm/targets/x86_64-linux/include/cccl -O3
-DNDEBUG -std=gnu++20 -fvisibility=hidden -Wno-c++98-compat
-Wno-c++98-compat-extra-semi -Wno-c++98-compat-pedantic -Wno-padded
-Wno-extra-semi -Wno-extra-semi-stmt -Wno-unused-parameter -Wno-sign-conversion
-Wno-weak-vtables -Wno-deprecated-copy-dtor -Wno-global-constructors
-Wno-double-promotion -Wno-float-equal -Wno-missing-prototypes
-Wno-implicit-int-float-conversion -Wno-implicit-float-conversion
-Wno-implicit-int-conversion -Wno-float-conversion -Wno-shorten-64-to-32
-Wno-covered-switch-default -Wno-unused-exception-parameter
-Wno-return-std-move -Wno-over-aligned -Wno-undef
-Wno-inconsistent-missing-destructor-override -Wno-unreachable-code
-Wno-deprecated-copy -Wno-implicit-fallthrough -Wno-unreachable-code-return
-Wno-non-virtual-dtor -Wreserved-id-macro -Wused-but-marked-unused
-Wdocumentation-unknown-command -Wcast-qual -Wzero-as-null-pointer-const
ant -Wno-documentation -Wno-shadow-uncaptured-local
-Wno-shadow-field-in-constructor -Wno-shadow -Wno-shadow-field
-Wno-exit-time-destructors -Wno-switch-enum -Wno-old-style-cast
-Wno-gnu-anonymous-struct -Wno-nested-anon-types -isystem
/home/petersktang/miniconda3/envs/tvm/include -D_GNU_SOURCE
-D_GLIBCXX_USE_CXX11_ABI -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -MD -MT
CMakeFiles/tvm_objs.dir/src/te/operation/create_primfunc.cc.o -MF
CMakeFiles/tvm_objs.dir/src/te/operation/create_primfunc.cc.o.d -o
CMakeFiles/tvm_objs.dir/src/te/operation/create_primfunc.cc.o -c
.../apache.tvm/src/te/operation/create_primfunc.cc
In file included from
.../apache.tvm/src/te/operation/create_primfunc.cc:20:
In file included from
.../apache.tvm/src/te/operation/create_primfunc.h:24:
In file included from .../apache.tvm/include/tvm/te/tensor.h:27:
In file included from .../apache.tvm/include/tvm/arith/bound.h:26:
In file included from .../apache.tvm/include/tvm/arith/int_set.h:27:
In file included from .../apache.tvm/include/tvm/ir/expr.h:29:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/reflection/registry.h:33:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/reflection/creator.h:28:
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/reflection/accessor.h:324:51:
warning: unknown command tag name [-Wdocumentation-unknown-command]
324 | * this wraps ``metadata->creator``; for Python ``@py_class``
types it is a
| ^~~~~~~~~
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/reflection/accessor.h:333:14:
warning: unknown command tag name 'c_class'; did you mean 'coclass'?
[-Wdocumentation-unknown-command]
333 | * Used by ``@c_class`` auto-generated ``__init__``: the
Python side calls
| ^~~~~~~~~
| coclass
In file included from
.../apache.tvm/src/te/operation/create_primfunc.cc:20:
In file included from
.../apache.tvm/src/te/operation/create_primfunc.h:24:
In file included from .../apache.tvm/include/tvm/te/tensor.h:27:
In file included from .../apache.tvm/include/tvm/arith/bound.h:26:
In file included from .../apache.tvm/include/tvm/arith/int_set.h:28:
In file included from .../apache.tvm/include/tvm/tirx/expr.h:37:
In file included from .../apache.tvm/include/tvm/tirx/buffer.h:31:
.../apache.tvm/include/tvm/tirx/layout.h:113:37: warning: unknown
command tag name [-Wdocumentation-unknown-command]
113 | * interleaved domain S_A \otimes S_B. If so, return
the left layout A.
| ^~~~~~~
.../apache.tvm/src/te/operation/create_primfunc.cc:78:8: warning:
'tvm::tirx::TensorLoadToBufferTransformer::VisitExpr_' hides overloaded virtual
functions [-Woverloaded-virtual]
78 | Expr VisitExpr_(const CallNode* op) final {
| ^
.../apache.tvm/include/tvm/tirx/stmt_functor.h:363:8: note: hidden
overloaded virtual function 'tvm::tirx::StmtExprMutator::VisitExpr_' declared
here: type mismatch at 1st parameter ('const VarNode *' (aka 'const
tvm::VarNode *') vs 'const CallNode *')
363 | Expr VisitExpr_(const VarNode* op) override;
| ^
.../apache.tvm/include/tvm/tirx/stmt_functor.h:364:8: note: hidden
overloaded virtual function 'tvm::tirx::StmtExprMutator::VisitExpr_' declared
here: type mismatch at 1st parameter ('const TensorLoadNode *' vs 'const
CallNode *')
364 | Expr VisitExpr_(const TensorLoadNode* op) override;
| ^
In file included from
.../apache.tvm/src/te/operation/create_primfunc.cc:20:
In file included from
.../apache.tvm/src/te/operation/create_primfunc.h:23:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/container/array.h:29:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/any.h:27:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/string.h:28:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/error.h:29:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/memory.h:26:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/object.h:28:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/type_traits.h:29:
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:900:7:
error: satisfaction of constraint 'is_constructible_v<_Tp, _Up>' depends on
itself
900 | && is_constructible_v<_Tp, _Up>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/type_traits:3683:70:
note: while checking constraint satisfaction for template 'optional<const
tvm::ffi::Optional<tvm::ffi::VisitInterrupt> &>' required here
3683 | inline constexpr bool is_constructible_v =
__is_constructible(_Tp, _Args...);
|
^~~~~
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/type_traits:3683:70:
note: while substituting deduced template arguments into function template
'optional' [with _Up = const tvm::ffi::Optional<tvm::ffi::VisitInterrupt> &]
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:900:7:
note: in instantiation of variable template specialization
'std::is_constructible_v<tvm::ffi::VisitInterrupt, const
tvm::ffi::Optional<tvm::ffi::VisitInterrupt> &>' requested here
900 | && is_constructible_v<_Tp, _Up>
| ^
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:900:7:
note: while substituting template arguments into constraint expression here
900 | && is_constructible_v<_Tp, _Up>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/type_traits:3718:41:
note: while checking constraint satisfaction for template 'optional<const
tvm::ffi::Optional<tvm::ffi::VisitInterrupt> &>' required here
3718 | = __is_trivially_constructible(_Tp, __add_lval_ref_t<const
_Tp>);
| ^~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/type_traits:3718:41:
note: while substituting deduced template arguments into function template
'optional' [with _Up = const tvm::ffi::Optional<tvm::ffi::VisitInterrupt> &]
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:499:12:
note: in instantiation of variable template specialization
'std::is_trivially_copy_constructible_v<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>>'
requested here
499 | bool = is_trivially_copy_constructible_v<_Tp>,
| ^
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:806:15:
note: in instantiation of default argument for
'_Optional_base<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>>' required here
806 | : private _Optional_base<_Tp>,
| ^~~~~~~~~~~~~~~~~~~
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/function.h:689:40:
note: in instantiation of template class
'std::optional<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>>' requested here
689 | if (auto val = result.template try_cast<T>()) {
| ^
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/extra/structural_visit.h:217:36:
note: in instantiation of function template specialization
'tvm::ffi::Function::CallExpected<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>,
tvm::ffi::StructuralVisitorObj *, tvm::ffi::AnyView &>' requested here
217 | return
attr.cast<Function>().CallExpected<Optional<VisitInterrupt>>(this, value);
| ^
In file included from
.../apache.tvm/src/te/operation/create_primfunc.cc:20:
In file included from
.../apache.tvm/src/te/operation/create_primfunc.h:23:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/container/array.h:29:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/any.h:27:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/string.h:28:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/error.h:29:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/memory.h:26:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/object.h:28:
In file included from
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/type_traits.h:29:
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:900:7:
error: satisfaction of constraint 'is_constructible_v<_Tp, _Up>' depends on
itself
900 | && is_constructible_v<_Tp, _Up>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/type_traits:3683:70:
note: while checking constraint satisfaction for template
'optional<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>>' required here
3683 | inline constexpr bool is_constructible_v =
__is_constructible(_Tp, _Args...);
|
^~~~~
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/type_traits:3683:70:
note: while substituting deduced template arguments into function template
'optional' [with _Up = tvm::ffi::Optional<tvm::ffi::VisitInterrupt>]
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:900:7:
note: in instantiation of variable template specialization
'std::is_constructible_v<tvm::ffi::VisitInterrupt,
tvm::ffi::Optional<tvm::ffi::VisitInterrupt>>' requested here
900 | && is_constructible_v<_Tp, _Up>
| ^
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:900:7:
note: while substituting template arguments into constraint expression here
900 | && is_constructible_v<_Tp, _Up>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/type_traits:3721:41:
note: while checking constraint satisfaction for template
'optional<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>>' required here
3721 | = __is_trivially_constructible(_Tp, __add_rval_ref_t<_Tp>);
| ^~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/type_traits:3721:41:
note: while substituting deduced template arguments into function template
'optional' [with _Up = tvm::ffi::Optional<tvm::ffi::VisitInterrupt>]
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:500:12:
note: in instantiation of variable template specialization
'std::is_trivially_move_constructible_v<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>>'
requested here
500 | bool = is_trivially_move_constructible_v<_Tp>>
| ^
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/optional:806:15:
note: in instantiation of default argument for
'_Optional_base<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>, false>' required
here
806 | : private _Optional_base<_Tp>,
| ^~~~~~~~~~~~~~~~~~~
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/function.h:689:40:
note: in instantiation of template class
'std::optional<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>>' requested here
689 | if (auto val = result.template try_cast<T>()) {
| ^
.../apache.tvm/3rdparty/tvm-ffi/include/tvm/ffi/extra/structural_visit.h:217:36:
note: in instantiation of function template specialization
'tvm::ffi::Function::CallExpected<tvm::ffi::Optional<tvm::ffi::VisitInterrupt>,
tvm::ffi::StructuralVisitorObj *, tvm::ffi::AnyView &>' requested here
217 | return
attr.cast<Function>().CallExpected<Optional<VisitInterrupt>>(this, value);
| ^
4 warnings and 2 errors generated.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]