This is an automated email from the ASF dual-hosted git repository.
junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git
The following commit(s) were added to refs/heads/main by this push:
new ed067c1 Update the logic of checking `#embed` (#418)
ed067c1 is described below
commit ed067c17b259774f4ddc23ba7de937a90642bbb1
Author: Yichen Yan <[email protected]>
AuthorDate: Tue Jan 27 11:08:24 2026 +0800
Update the logic of checking `#embed` (#418)
This PR slightly update the example to use cubin launcher with c++'s
`#embed`, make it fail earlier if compiler do not support the feature.
---
.../cubin_launcher/embedded_cubin/cpp_embed/CMakeLists.txt | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/examples/cubin_launcher/embedded_cubin/cpp_embed/CMakeLists.txt
b/examples/cubin_launcher/embedded_cubin/cpp_embed/CMakeLists.txt
index 084648e..efe8cb9 100644
--- a/examples/cubin_launcher/embedded_cubin/cpp_embed/CMakeLists.txt
+++ b/examples/cubin_launcher/embedded_cubin/cpp_embed/CMakeLists.txt
@@ -20,6 +20,16 @@ project(embedded_cubin_example LANGUAGES CXX CUDA)
set(CMAKE_CXX_STANDARD 26)
+# Check for `#embed` after setting C++ standard, otherwise compilers (e.g.
GCC) won't define the
+# macro.
+include(CheckCXXSymbolExists)
+check_cxx_symbol_exists(__cpp_pp_embed "" HAVE_EMBED)
+if (NOT HAVE_EMBED)
+ message(FATAL_ERROR "Compiler does not support `#embed`."
+ "Please use a newer compiler (e.g. GCC 15+, Clang 19+)"
+ )
+endif ()
+
set(CMAKE_TVM_FFI_CUBIN_LAUNCHER_USE_DRIVER_API
OFF
CACHE BOOL "Use driver API in cubin launcher"