Skip to content

Commit 9223306

Browse files
committed
[mlir][python bindings] generate all the enums
This PR implements python enum bindings for *all* the enums - this includes `I*Attrs` (including positional/bit) and `Dialect/EnumAttr`. There are a few parts to this: 1. CMake: a small addition to `declare_mlir_dialect_python_bindings` and `declare_mlir_dialect_extension_python_bindings` to generate the enum, a boolean arg `GEN_ENUM_BINDINGS` to make it opt-in (even though it works for basically all of the dialects), and an optional `GEN_ENUM_BINDINGS_TD_FILE` for handling corner cases. 2. EnumPythonBindingGen.cpp: there are two weedy aspects here that took investigation: 1. If an enum attribute is not a `Dialect/EnumAttr` then the `EnumAttrInfo` record is canonical, as far as both the cases of the enum **and the `AttrDefName`**. On the otherhand, if an enum is a `Dialect/EnumAttr` then the `EnumAttr` record has the correct `AttrDefName` ("load bearing", i.e., populates `ods.ir.AttributeBuilder('<NAME>')`) but its `enum` field contains the cases, which is an instance of `EnumAttrInfo`. The solution is to generate an one enum class for both `Dialect/EnumAttr` and "independent" `EnumAttrInfo` but to make that class interopable with two builder registrations that both do the right thing (see next sub-bullet). 2. Because we don't have a good connection to cpp `EnumAttr`, i.e., only the `enum class` getters are exposed (like `DimensionAttr::get(Dimension value)`), we have to resort to parsing e.g., `Attribute.parse(f'#gpu<dim {x}>')`. This means that the set of supported `assemblyFormat`s (for the enum) is fixed at compile of MLIR (currently 2, the only 2 I saw). There might be some things that could be done here but they would require quite a bit more C API work to support generically (e.g., casting ints to enum cases and binding all the getters or going generically through the `symbolize*` methods, like `symbolizeDimension(uint32_t)` or `symbolizeDimension(StringRef)`). A few small changes: 1. In addition, since this patch registers default builders for attributes where people might've had their own builders already written, I added a `replace` param to `AttributeBuilder.insert` (`False` by default). 2. `makePythonEnumCaseName` can't handle all the different ways in which people write their enum cases, e.g., `llvm.CConv.Intel_OCL_BI`, which gets turned into `INTEL_O_C_L_B_I` (because `llvm::convertToSnakeFromCamelCase` doesn't look for runs of caps). So I dropped it. On the otherhand regularization does need to done because some enums have `None` as a case (and others might have other python keywords). 3. I turned on `llvm` dialect generation here in order to test `nvvm.WGMMAScaleIn`, which is an enum with [[ https://github.com/llvm/llvm-project/blob/d7e26b56207cbd8995296c5bb7c11ce676b649da/mlir/include/mlir/IR/EnumAttr.td#L22-L25 | no explicit discriminator ]] for the `neg` case. Note, dialects that didn't get a `GEN_ENUM_BINDINGS` don't have any enums to generate. Let me know if I should add more tests (the three trivial ones I added exercise both the supported `assemblyFormat`s and `replace=True`). Reviewed By: stellaraccident Differential Revision: https://reviews.llvm.org/D157934
1 parent be91bd0 commit 9223306

38 files changed

+559
-230
lines changed

mlir/cmake/modules/AddMLIRPython.cmake

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,21 @@ endfunction()
272272
# SOURCES: Same as declare_mlir_python_sources().
273273
# SOURCES_GLOB: Same as declare_mlir_python_sources().
274274
# DEPENDS: Additional dependency targets.
275+
# GEN_ENUM_BINDINGS: Generate enum bindings.
276+
# GEN_ENUM_BINDINGS_TD_FILE: Optional Tablegen file to generate enums for (relative to ROOT_DIR).
277+
# This file is where the *EnumAttrs are defined, not where the *Enums are defined.
278+
# **WARNING**: This arg will shortly be removed when the just-below TODO is satisfied. Use at your
279+
# risk.
275280
#
276281
# TODO: Right now `TD_FILE` can't be the actual dialect tablegen file, since we
277282
# use its path to determine where to place the generated python file. If
278283
# we made the output path an additional argument here we could remove the
279284
# need for the separate "wrapper" .td files
280285
function(declare_mlir_dialect_python_bindings)
281286
cmake_parse_arguments(ARG
282-
""
287+
"GEN_ENUM_BINDINGS"
283288
"ROOT_DIR;ADD_TO_PARENT;TD_FILE;DIALECT_NAME"
284-
"SOURCES;SOURCES_GLOB;DEPENDS"
289+
"SOURCES;SOURCES_GLOB;DEPENDS;GEN_ENUM_BINDINGS_TD_FILE"
285290
${ARGN})
286291
# Sources.
287292
set(_dialect_target "${ARG_ADD_TO_PARENT}.${ARG_DIALECT_NAME}")
@@ -306,11 +311,22 @@ function(declare_mlir_dialect_python_bindings)
306311
)
307312
add_public_tablegen_target(${tblgen_target})
308313

314+
set(_sources ${dialect_filename})
315+
if(ARG_GEN_ENUM_BINDINGS OR ARG_GEN_ENUM_BINDINGS_TD_FILE)
316+
if(ARG_GEN_ENUM_BINDINGS_TD_FILE)
317+
set(td_file "${ARG_ROOT_DIR}/${ARG_GEN_ENUM_BINDINGS_TD_FILE}")
318+
set(LLVM_TARGET_DEFINITIONS ${td_file})
319+
endif()
320+
set(enum_filename "${relative_td_directory}/_${ARG_DIALECT_NAME}_enum_gen.py")
321+
mlir_tablegen(${enum_filename} -gen-python-enum-bindings)
322+
list(APPEND _sources ${enum_filename})
323+
endif()
324+
309325
# Generated.
310326
declare_mlir_python_sources("${_dialect_target}.ops_gen"
311327
ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}"
312328
ADD_TO_PARENT "${_dialect_target}"
313-
SOURCES "${dialect_filename}"
329+
SOURCES ${_sources}
314330
)
315331
endif()
316332
endfunction()
@@ -331,11 +347,16 @@ endfunction()
331347
# SOURCES: Same as declare_mlir_python_sources().
332348
# SOURCES_GLOB: Same as declare_mlir_python_sources().
333349
# DEPENDS: Additional dependency targets.
350+
# GEN_ENUM_BINDINGS: Generate enum bindings.
351+
# GEN_ENUM_BINDINGS_TD_FILE: Optional Tablegen file to generate enums for (relative to ROOT_DIR).
352+
# This file is where the *Attrs are defined, not where the *Enums are defined.
353+
# **WARNING**: This arg will shortly be removed when the TODO for
354+
# declare_mlir_dialect_python_bindings is satisfied. Use at your risk.
334355
function(declare_mlir_dialect_extension_python_bindings)
335356
cmake_parse_arguments(ARG
336-
""
357+
"GEN_ENUM_BINDINGS"
337358
"ROOT_DIR;ADD_TO_PARENT;TD_FILE;DIALECT_NAME;EXTENSION_NAME"
338-
"SOURCES;SOURCES_GLOB;DEPENDS"
359+
"SOURCES;SOURCES_GLOB;DEPENDS;GEN_ENUM_BINDINGS_TD_FILE"
339360
${ARGN})
340361
# Source files.
341362
set(_extension_target "${ARG_ADD_TO_PARENT}.${ARG_EXTENSION_NAME}")
@@ -362,10 +383,21 @@ function(declare_mlir_dialect_extension_python_bindings)
362383
add_dependencies(${tblgen_target} ${ARG_DEPENDS})
363384
endif()
364385

386+
set(_sources ${output_filename})
387+
if(ARG_GEN_ENUM_BINDINGS OR ARG_GEN_ENUM_BINDINGS_TD_FILE)
388+
if(ARG_GEN_ENUM_BINDINGS_TD_FILE)
389+
set(td_file "${ARG_ROOT_DIR}/${ARG_GEN_ENUM_BINDINGS_TD_FILE}")
390+
set(LLVM_TARGET_DEFINITIONS ${td_file})
391+
endif()
392+
set(enum_filename "${relative_td_directory}/_${ARG_EXTENSION_NAME}_enum_gen.py")
393+
mlir_tablegen(${enum_filename} -gen-python-enum-bindings)
394+
list(APPEND _sources ${enum_filename})
395+
endif()
396+
365397
declare_mlir_python_sources("${_extension_target}.ops_gen"
366398
ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}"
367399
ADD_TO_PARENT "${_extension_target}"
368-
SOURCES "${output_filename}"
400+
SOURCES ${_sources}
369401
)
370402
endif()
371403
endfunction()

mlir/include/mlir/Dialect/Linalg/IR/LinalgEnums.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- LinalgBase.td - Linalg dialect base support ---------*- tablegen -*-===//
1+
//===- LinalgEnums.td - Linalg dialect base support ---------*- tablegen -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

mlir/lib/Bindings/Python/Globals.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ class PyGlobals {
5858
void loadDialectModule(llvm::StringRef dialectNamespace);
5959

6060
/// Adds a user-friendly Attribute builder.
61-
/// Raises an exception if the mapping already exists.
61+
/// Raises an exception if the mapping already exists and replace == false.
6262
/// This is intended to be called by implementation code.
6363
void registerAttributeBuilder(const std::string &attributeKind,
64-
pybind11::function pyFunc);
64+
pybind11::function pyFunc,
65+
bool replace = false);
6566

6667
/// Adds a user-friendly type caster. Raises an exception if the mapping
6768
/// already exists and replace == false. This is intended to be called by

mlir/lib/Bindings/Python/IRCore.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,23 @@ struct PyAttrBuilderMap {
242242
static py::function dundeGetItemNamed(const std::string &attributeKind) {
243243
auto builder = PyGlobals::get().lookupAttributeBuilder(attributeKind);
244244
if (!builder)
245-
throw py::key_error();
245+
throw py::key_error(attributeKind);
246246
return *builder;
247247
}
248248
static void dundeSetItemNamed(const std::string &attributeKind,
249-
py::function func) {
250-
PyGlobals::get().registerAttributeBuilder(attributeKind, std::move(func));
249+
py::function func, bool replace) {
250+
PyGlobals::get().registerAttributeBuilder(attributeKind, std::move(func),
251+
replace);
251252
}
252253

253254
static void bind(py::module &m) {
254255
py::class_<PyAttrBuilderMap>(m, "AttrBuilder", py::module_local())
255256
.def_static("contains", &PyAttrBuilderMap::dunderContains)
256257
.def_static("get", &PyAttrBuilderMap::dundeGetItemNamed)
257-
.def_static("insert", &PyAttrBuilderMap::dundeSetItemNamed);
258+
.def_static("insert", &PyAttrBuilderMap::dundeSetItemNamed,
259+
"attribute_kind"_a, "attr_builder"_a, "replace"_a = false,
260+
"Register an attribute builder for building MLIR "
261+
"attributes from python values.");
258262
}
259263
};
260264

mlir/lib/Bindings/Python/IRModule.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ void PyGlobals::loadDialectModule(llvm::StringRef dialectNamespace) {
6363
}
6464

6565
void PyGlobals::registerAttributeBuilder(const std::string &attributeKind,
66-
py::function pyFunc) {
66+
py::function pyFunc, bool replace) {
6767
py::object &found = attributeBuilderMap[attributeKind];
68-
if (found) {
68+
if (found && !found.is_none() && !replace) {
6969
throw std::runtime_error((llvm::Twine("Attribute builder for '") +
70-
attributeKind + "' is already registered")
70+
attributeKind +
71+
"' is already registered with func: " +
72+
py::str(found).operator std::string())
7173
.str());
7274
}
7375
found = std::move(pyFunc);

mlir/python/CMakeLists.txt

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ declare_mlir_dialect_python_bindings(
5252
TD_FILE dialects/AMDGPUOps.td
5353
SOURCES
5454
dialects/amdgpu.py
55-
DIALECT_NAME amdgpu)
55+
DIALECT_NAME amdgpu
56+
GEN_ENUM_BINDINGS)
5657

5758
declare_mlir_dialect_python_bindings(
5859
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -68,7 +69,10 @@ declare_mlir_dialect_python_bindings(
6869
SOURCES
6970
dialects/bufferization.py
7071
dialects/_bufferization_ops_ext.py
71-
DIALECT_NAME bufferization)
72+
DIALECT_NAME bufferization
73+
GEN_ENUM_BINDINGS_TD_FILE
74+
"../../include/mlir/Dialect/Bufferization/IR/BufferizationEnums.td"
75+
)
7276

7377
declare_mlir_dialect_python_bindings(
7478
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -109,7 +113,8 @@ declare_mlir_dialect_python_bindings(
109113
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
110114
TD_FILE dialects/GPUOps.td
111115
SOURCES_GLOB dialects/gpu/*.py
112-
DIALECT_NAME gpu)
116+
DIALECT_NAME gpu
117+
GEN_ENUM_BINDINGS)
113118

114119
declare_mlir_dialect_python_bindings(
115120
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -120,7 +125,17 @@ declare_mlir_dialect_python_bindings(
120125
SOURCES_GLOB
121126
dialects/linalg/*.py
122127
DIALECT_NAME linalg
123-
DEPENDS LinalgOdsGen)
128+
DEPENDS LinalgOdsGen
129+
GEN_ENUM_BINDINGS)
130+
131+
declare_mlir_dialect_python_bindings(
132+
ADD_TO_PARENT MLIRPythonSources.Dialects
133+
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
134+
TD_FILE dialects/LLVMOps.td
135+
SOURCES
136+
dialects/llvm.py
137+
DIALECT_NAME llvm
138+
GEN_ENUM_BINDINGS)
124139

125140
declare_mlir_dialect_extension_python_bindings(
126141
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -140,16 +155,10 @@ declare_mlir_dialect_python_bindings(
140155
dialects/_transform_ops_ext.py
141156
dialects/transform/__init__.py
142157
_mlir_libs/_mlir/dialects/transform/__init__.pyi
143-
DIALECT_NAME transform)
144-
145-
set(LLVM_TARGET_DEFINITIONS "${CMAKE_CURRENT_SOURCE_DIR}/mlir/dialects/TransformOps.td")
146-
mlir_tablegen("dialects/_transform_enum_gen.py" -gen-python-enum-bindings)
147-
add_public_tablegen_target(MLIRTransformDialectPyEnumGen)
148-
declare_mlir_python_sources(
149-
MLIRPythonSources.Dialects.transform.enum_gen
150-
ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}"
151-
ADD_TO_PARENT MLIRPythonSources.Dialects.transform
152-
SOURCES "dialects/_transform_enum_gen.py")
158+
DIALECT_NAME transform
159+
GEN_ENUM_BINDINGS_TD_FILE
160+
"../../include/mlir/Dialect/Transform/IR/TransformAttrs.td"
161+
)
153162

154163
declare_mlir_dialect_extension_python_bindings(
155164
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -161,15 +170,6 @@ declare_mlir_dialect_extension_python_bindings(
161170
DIALECT_NAME transform
162171
EXTENSION_NAME bufferization_transform)
163172

164-
set(LLVM_TARGET_DEFINITIONS "${CMAKE_CURRENT_SOURCE_DIR}/mlir/dialects/BufferizationTransformOps.td")
165-
mlir_tablegen("dialects/_bufferization_transform_enum_gen.py" -gen-python-enum-bindings)
166-
add_public_tablegen_target(MLIRBufferizationTransformDialectPyEnumGen)
167-
declare_mlir_python_sources(
168-
MLIRPythonSources.Dialects.bufferization_transform.enum_gen
169-
ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}"
170-
ADD_TO_PARENT MLIRPythonSources.Dialects.bufferization_transform
171-
SOURCES "dialects/_bufferization_transform_enum_gen.py")
172-
173173
declare_mlir_dialect_extension_python_bindings(
174174
ADD_TO_PARENT MLIRPythonSources.Dialects
175175
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
@@ -208,7 +208,10 @@ declare_mlir_dialect_extension_python_bindings(
208208
dialects/_structured_transform_ops_ext.py
209209
dialects/transform/structured.py
210210
DIALECT_NAME transform
211-
EXTENSION_NAME structured_transform)
211+
EXTENSION_NAME structured_transform
212+
GEN_ENUM_BINDINGS_TD_FILE
213+
"../../include/mlir/Dialect/Linalg/TransformOps/LinalgTransformEnums.td"
214+
)
212215

213216
declare_mlir_dialect_extension_python_bindings(
214217
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -227,16 +230,10 @@ declare_mlir_dialect_extension_python_bindings(
227230
SOURCES
228231
dialects/transform/vector.py
229232
DIALECT_NAME transform
230-
EXTENSION_NAME vector_transform)
231-
232-
set(LLVM_TARGET_DEFINITIONS "${CMAKE_CURRENT_SOURCE_DIR}/mlir/dialects/VectorTransformOps.td")
233-
mlir_tablegen("dialects/_vector_transform_enum_gen.py" -gen-python-enum-bindings)
234-
add_public_tablegen_target(MLIRVectorTransformPyEnumGen)
235-
declare_mlir_python_sources(
236-
MLIRPythonSources.Dialects.vector_transform.enum_gen
237-
ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}"
238-
ADD_TO_PARENT MLIRPythonSources.Dialects.vector_transform
239-
SOURCES "dialects/_vector_transform_enum_gen.py" )
233+
EXTENSION_NAME vector_transform
234+
GEN_ENUM_BINDINGS_TD_FILE
235+
"../../include/mlir/Dialect/Vector/Transforms/VectorTransformsBase.td"
236+
)
240237

241238
declare_mlir_dialect_python_bindings(
242239
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -252,7 +249,8 @@ declare_mlir_dialect_python_bindings(
252249
SOURCES
253250
dialects/arith.py
254251
dialects/_arith_ops_ext.py
255-
DIALECT_NAME arith)
252+
DIALECT_NAME arith
253+
GEN_ENUM_BINDINGS)
256254

257255
declare_mlir_dialect_python_bindings(
258256
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -278,15 +276,17 @@ declare_mlir_dialect_python_bindings(
278276
TD_FILE dialects/NVGPUOps.td
279277
SOURCES
280278
dialects/nvgpu.py
281-
DIALECT_NAME nvgpu)
279+
DIALECT_NAME nvgpu
280+
GEN_ENUM_BINDINGS)
282281

283282
declare_mlir_dialect_python_bindings(
284283
ADD_TO_PARENT MLIRPythonSources.Dialects
285284
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
286285
TD_FILE dialects/NVVMOps.td
287286
SOURCES
288287
dialects/nvvm.py
289-
DIALECT_NAME nvvm)
288+
DIALECT_NAME nvvm
289+
GEN_ENUM_BINDINGS)
290290

291291
declare_mlir_dialect_python_bindings(
292292
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -300,6 +300,7 @@ declare_mlir_python_sources(
300300
MLIRPythonSources.Dialects.quant
301301
ADD_TO_PARENT MLIRPythonSources.Dialects
302302
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
303+
GEN_ENUM_BINDINGS
303304
SOURCES
304305
dialects/quant.py
305306
_mlir_libs/_mlir/dialects/quant.pyi)
@@ -335,7 +336,10 @@ declare_mlir_dialect_python_bindings(
335336
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
336337
TD_FILE dialects/SparseTensorOps.td
337338
SOURCES dialects/sparse_tensor.py
338-
DIALECT_NAME sparse_tensor)
339+
DIALECT_NAME sparse_tensor
340+
GEN_ENUM_BINDINGS_TD_FILE
341+
"../../include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td"
342+
)
339343

340344
declare_mlir_dialect_python_bindings(
341345
ADD_TO_PARENT MLIRPythonSources.Dialects
@@ -351,14 +355,16 @@ declare_mlir_dialect_python_bindings(
351355
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
352356
TD_FILE dialects/TosaOps.td
353357
SOURCES dialects/tosa.py
354-
DIALECT_NAME tosa)
358+
DIALECT_NAME tosa
359+
)
355360

356361
declare_mlir_dialect_python_bindings(
357362
ADD_TO_PARENT MLIRPythonSources.Dialects
358363
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
359364
TD_FILE dialects/VectorOps.td
360365
SOURCES dialects/vector.py
361-
DIALECT_NAME vector)
366+
DIALECT_NAME vector
367+
GEN_ENUM_BINDINGS)
362368

363369
################################################################################
364370
# Python extensions.

mlir/python/mlir/dialects/LLVMOps.td

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- LlvmOps.td - Entry point for llvm bind ---------*- tablegen -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef PYTHON_BINDINGS_LLVM_OPS
10+
#define PYTHON_BINDINGS_LLVM_OPS
11+
12+
include "mlir/Dialect/LLVMIR/LLVMOps.td"
13+
14+
#endif

mlir/python/mlir/dialects/amdgpu.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
from ._amdgpu_ops_gen import *
6+
from ._amdgpu_enum_gen import *

mlir/python/mlir/dialects/arith.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
from ._arith_ops_gen import *
6+
from ._arith_enum_gen import *

mlir/python/mlir/dialects/bufferization.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
from ._bufferization_ops_gen import *
6+
from ._bufferization_enum_gen import *

mlir/python/mlir/dialects/gpu/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
from .._gpu_ops_gen import *
6+
from .._gpu_enum_gen import *

mlir/python/mlir/dialects/linalg/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# definitions following these steps:
1010
# DSL -> YAML -> tblgen -> pytblgen -> build/.../_linalg_ops_gen.py.
1111
from .._linalg_ops_gen import *
12+
from .._linalg_enum_gen import *
1213

1314
# These are the ground truth functions defined as:
1415
# ```

mlir/python/mlir/dialects/llvm.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
from ._llvm_ops_gen import *
6+
from ._llvm_enum_gen import *

mlir/python/mlir/dialects/nvgpu.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
from ._nvgpu_ops_gen import *
6+
from ._nvgpu_enum_gen import *

0 commit comments

Comments
 (0)