[Mlir-commits] [llvm] [mlir] [mlir python] Port in-tree dialects to nanobind. (PR #119924)

Jacques Pienaar llvmlistbot at llvm.org
Thu Dec 19 15:59:41 PST 2024


https://github.com/jpienaar approved this pull request.

Overall looks good, I think we can do the following to avoid more of the nanobind warnings (else it just results in too much logging)

```diff
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index 67619a90c90b..e5952d1873ef 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -142,6 +142,9 @@ function(declare_mlir_python_extension name)
     mlir_python_DEPENDS ""
     mlir_python_BINDINGS_LIBRARY "${ARG_PYTHON_BINDINGS_LIBRARY}"
   )
+  if (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL)
+    set_target_properties(${name} PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-cast-qual;-Wno-zero-length-array;-Wno-extra-semi;-Wno-nested-anon-types;-Wno-pedantic")
+  endif()

   # Set the interface source and link_libs properties of the target
   # These properties support generator expressions and are automatically exported
diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt
index 4f3a4e67d6f1..84b43a70ec61 100644
--- a/mlir/python/CMakeLists.txt
+++ b/mlir/python/CMakeLists.txt
@@ -476,9 +476,6 @@ declare_mlir_python_extension(MLIRPythonExtension.Core
     # Dialects
     MLIRCAPIFunc
 )
-if (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL)
-set_target_properties(MLIRPythonExtension.Core PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-cast-qual;-Wno-zero-length-array;-Wno-extra-semi;-Wno-nested-anon-types;-Wno-pedantic")
-endif()

 # This extension exposes an API to register all dialects, extensions, and passes
 # packaged in upstream MLIR and it is used for the upstream "mlir" Python
@@ -750,9 +747,6 @@ if(MLIR_INCLUDE_TESTS)
     EMBED_CAPI_LINK_LIBS
       MLIRCAPIPythonTestDialect
   )
-  if (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL)
-    set_target_properties(MLIRPythonTestSources.PythonTestExtensionNanobind PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-cast-qual;-Wno-zero-length-array;-Wno-extra-semi;-Wno-nested-anon-types;-Wno-pedantic")
-  endif()
 endif()
```

https://github.com/llvm/llvm-project/pull/119924


More information about the Mlir-commits mailing list