Skip to content

Commit 8ae7d2d

Browse files
committed
[mlir][python] automatically bundle builtin dialect with core
1 parent 1d1fede commit 8ae7d2d

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

mlir/python/CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ declare_mlir_python_sources(MLIRPythonCAPI.HeaderSources
4444
SOURCES_GLOB "mlir-c/*.h"
4545
)
4646

47+
# The builtin dialect is special (e.g., type casters and such expect it to be loaded
48+
# in order to work) so we add it to Core instead of Dialects so that anyone depending on
49+
# Core will get it automatically.
50+
declare_mlir_dialect_python_bindings(
51+
ADD_TO_PARENT MLIRPythonSources.Core
52+
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
53+
TD_FILE dialects/BuiltinOps.td
54+
SOURCES
55+
dialects/builtin.py
56+
DIALECT_NAME builtin)
57+
4758
################################################################################
4859
# Dialect bindings
4960
################################################################################
@@ -84,14 +95,6 @@ declare_mlir_dialect_python_bindings(
8495
"../../include/mlir/Dialect/Bufferization/IR/BufferizationEnums.td"
8596
)
8697

87-
declare_mlir_dialect_python_bindings(
88-
ADD_TO_PARENT MLIRPythonSources.Dialects
89-
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
90-
TD_FILE dialects/BuiltinOps.td
91-
SOURCES
92-
dialects/builtin.py
93-
DIALECT_NAME builtin)
94-
9598
declare_mlir_dialect_python_bindings(
9699
ADD_TO_PARENT MLIRPythonSources.Dialects
97100
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"

0 commit comments

Comments
 (0)