mvanhorn opened a new pull request, #20162:
URL: https://github.com/apache/tvm/pull/20162

   TVM sets `CMAKE_CXX_STANDARD` to 20 globally, then adds the vendored 
`tvm-ffi` project, whose sources are intended to compile as C++17. Because 
CMake's `cxx_std_17` feature is a minimum rather than an exact standard, the 
parent setting causes `tvm-ffi` sources to compile as C++20 and exposes a 
recursive `std::optional` constraint failure with the reporter's newer 
Clang/GCC standard-library combination. The reporter's attempted local standard 
isolation allowed compilation to progress through the original error, while the 
later LLVM link errors came from the separately configured ROCm LLVM toolchain. 
No prior or competing PR is recorded in the supplied issue bundle.
   
   ## Testing
   
   - Configure a normal Ninja build and confirm compile commands for 
`3rdparty/tvm-ffi` contain an explicit C++17 mode or no newer-standard flag, 
while TVM `src/` commands retain C++20.
   - Configure with a compiler whose default language mode is already C++17 and 
confirm the validation accepts an omitted explicit C++17 flag for `tvm-ffi` 
without weakening the C++20 assertion for TVM.
   - Exercise the existing CI build path and confirm the original 
`std::optional<tvm::ffi::Optional<VisitInterrupt>>` compilation failure no 
longer occurs on a modern Clang using GCC 16 standard-library headers.
   - Deliberately allow the dependency to inherit a C++20 flag and confirm the 
build driver stops before compilation with a diagnostic that identifies the 
mismatched `tvm-ffi` compile command.
   
   ## What changed
   
   In `CMakeLists.txt`, save TVM's C++20 setting immediately before 
`add_subdirectory(3rdparty/tvm-ffi)`, temporarily select C++17 while the 
dependency creates its targets, and restore the saved value immediately 
afterward so all subsequent TVM targets retain the project standard. Keep the 
change at the parent/dependency boundary rather than altering `tvm-ffi` headers 
or adding a source-level workaround for the reported template instantiation. 
Extend `tests/scripts/task_build.py` after CMake configuration to inspect the 
generated compile database and assert that C++ sources under `3rdparty/tvm-ffi` 
are not compiled with a C++20 flag while representative TVM C++ sources still 
are.
   
   Fixes #20042
   


-- 
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]

Reply via email to