Skip to content

Commit b779d77

Browse files
committed
[MLIR][Python] move Py* types
1 parent 9bec262 commit b779d77

File tree

16 files changed

+59
-59
lines changed

16 files changed

+59
-59
lines changed
File renamed without changes.
File renamed without changes.

mlir/lib/Bindings/Python/DialectSMT.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "NanobindUtils.h"
10-
119
#include "mlir-c/Dialect/SMT.h"
1210
#include "mlir-c/IR.h"
1311
#include "mlir-c/Support.h"
1412
#include "mlir-c/Target/ExportSMTLIB.h"
1513
#include "mlir/Bindings/Python/Diagnostics.h"
1614
#include "mlir/Bindings/Python/Nanobind.h"
1715
#include "mlir/Bindings/Python/NanobindAdaptors.h"
16+
#include "mlir/Bindings/Python/NanobindUtils.h"
1817

1918
namespace nb = nanobind;
2019

mlir/lib/Bindings/Python/IRAffine.cpp

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@
1313
#include <utility>
1414
#include <vector>
1515

16-
#include "IRModule.h"
17-
#include "NanobindUtils.h"
1816
#include "mlir-c/AffineExpr.h"
1917
#include "mlir-c/AffineMap.h"
20-
#include "mlir-c/Bindings/Python/Interop.h" // This is expected after nanobind.
2118
#include "mlir-c/IntegerSet.h"
22-
#include "mlir/Bindings/Python/Nanobind.h"
19+
#include "mlir/Bindings/Python/IRModule.h"
20+
#include "mlir/Bindings/Python/NanobindUtils.h"
2321
#include "mlir/Support/LLVM.h"
2422
#include "llvm/ADT/Hashing.h"
2523
#include "llvm/ADT/SmallVector.h"
2624
#include "llvm/ADT/StringRef.h"
2725
#include "llvm/ADT/Twine.h"
2826

27+
// clang-format off
28+
#include "mlir/Bindings/Python/Nanobind.h"
29+
#include "mlir-c/Bindings/Python/Interop.h" // ON WINDOWS This is expected after nanobind.
30+
// clang-format on
31+
2932
namespace nb = nanobind;
3033
using namespace mlir;
3134
using namespace mlir::python;
@@ -706,25 +709,24 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
706709
[](PyAffineMap &self) {
707710
return static_cast<size_t>(llvm::hash_value(self.get().ptr));
708711
})
709-
.def_static("compress_unused_symbols",
710-
[](const nb::list &affineMaps,
711-
DefaultingPyMlirContext context) {
712-
SmallVector<MlirAffineMap> maps;
713-
pyListToVector<PyAffineMap, MlirAffineMap>(
714-
affineMaps, maps, "attempting to create an AffineMap");
715-
std::vector<MlirAffineMap> compressed(affineMaps.size());
716-
auto populate = [](void *result, intptr_t idx,
717-
MlirAffineMap m) {
718-
static_cast<MlirAffineMap *>(result)[idx] = (m);
719-
};
720-
mlirAffineMapCompressUnusedSymbols(
721-
maps.data(), maps.size(), compressed.data(), populate);
722-
std::vector<PyAffineMap> res;
723-
res.reserve(compressed.size());
724-
for (auto m : compressed)
725-
res.emplace_back(context->getRef(), m);
726-
return res;
727-
})
712+
.def_static(
713+
"compress_unused_symbols",
714+
[](const nb::list &affineMaps, DefaultingPyMlirContext context) {
715+
SmallVector<MlirAffineMap> maps;
716+
pyListToVector<PyAffineMap, MlirAffineMap>(
717+
affineMaps, maps, "attempting to create an AffineMap");
718+
std::vector<MlirAffineMap> compressed(affineMaps.size());
719+
auto populate = [](void *result, intptr_t idx, MlirAffineMap m) {
720+
static_cast<MlirAffineMap *>(result)[idx] = (m);
721+
};
722+
mlirAffineMapCompressUnusedSymbols(maps.data(), maps.size(),
723+
compressed.data(), populate);
724+
std::vector<PyAffineMap> res;
725+
res.reserve(compressed.size());
726+
for (auto m : compressed)
727+
res.emplace_back(context->getRef(), m);
728+
return res;
729+
})
728730
.def_prop_ro(
729731
"context",
730732
[](PyAffineMap &self) { return self.getContext().getObject(); },

mlir/lib/Bindings/Python/IRAttributes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
#include <string_view>
1313
#include <utility>
1414

15-
#include "IRModule.h"
16-
#include "NanobindUtils.h"
1715
#include "mlir-c/BuiltinAttributes.h"
1816
#include "mlir-c/BuiltinTypes.h"
17+
#include "mlir/Bindings/Python/IRModule.h"
1918
#include "mlir/Bindings/Python/Nanobind.h"
2019
#include "mlir/Bindings/Python/NanobindAdaptors.h"
20+
#include "mlir/Bindings/Python/NanobindUtils.h"
2121
#include "llvm/ADT/ScopeExit.h"
2222
#include "llvm/Support/raw_ostream.h"
2323

mlir/lib/Bindings/Python/IRCore.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "Globals.h"
10-
#include "IRModule.h"
11-
#include "NanobindUtils.h"
12-
#include "mlir-c/Bindings/Python/Interop.h" // This is expected after nanobind.
139
#include "mlir-c/BuiltinAttributes.h"
1410
#include "mlir-c/Debug.h"
1511
#include "mlir-c/Diagnostics.h"
1612
#include "mlir-c/IR.h"
1713
#include "mlir-c/Support.h"
18-
#include "mlir/Bindings/Python/Nanobind.h"
14+
#include "mlir/Bindings/Python/Globals.h"
15+
#include "mlir/Bindings/Python/IRModule.h"
1916
#include "mlir/Bindings/Python/NanobindAdaptors.h"
17+
#include "mlir/Bindings/Python/NanobindUtils.h"
2018
#include "nanobind/nanobind.h"
2119
#include "llvm/ADT/ArrayRef.h"
2220
#include "llvm/ADT/SmallVector.h"
2321

22+
// clang-format off
23+
#include "mlir/Bindings/Python/Nanobind.h"
24+
#include "mlir-c/Bindings/Python/Interop.h" // ON WINDOWS This is expected after nanobind.
25+
// clang-format on
26+
2427
#include <optional>
2528

2629
namespace nb = nanobind;

mlir/lib/Bindings/Python/IRInterfaces.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#include <utility>
1313
#include <vector>
1414

15-
#include "IRModule.h"
1615
#include "mlir-c/BuiltinAttributes.h"
1716
#include "mlir-c/IR.h"
1817
#include "mlir-c/Interfaces.h"
1918
#include "mlir-c/Support.h"
19+
#include "mlir/Bindings/Python/IRModule.h"
2020
#include "mlir/Bindings/Python/Nanobind.h"
2121
#include "llvm/ADT/STLExtras.h"
2222
#include "llvm/ADT/SmallVector.h"

mlir/lib/Bindings/Python/IRModule.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "IRModule.h"
10-
119
#include <optional>
1210
#include <vector>
1311

14-
#include "Globals.h"
15-
#include "NanobindUtils.h"
16-
#include "mlir-c/Bindings/Python/Interop.h"
1712
#include "mlir-c/Support.h"
13+
#include "mlir/Bindings/Python/Globals.h"
14+
#include "mlir/Bindings/Python/IRModule.h"
15+
#include "mlir/Bindings/Python/NanobindUtils.h"
16+
17+
// clang-format off
1818
#include "mlir/Bindings/Python/Nanobind.h"
19+
#include "mlir-c/Bindings/Python/Interop.h" // ON WINDOWS This is expected after nanobind.
20+
// clang-format on
1921

2022
namespace nb = nanobind;
2123
using namespace mlir;

mlir/lib/Bindings/Python/IRTypes.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@
77
//===----------------------------------------------------------------------===//
88

99
// clang-format off
10-
#include "IRModule.h"
10+
#include "mlir/Bindings/Python/IRModule.h"
1111
#include "mlir/Bindings/Python/IRTypes.h"
1212
// clang-format on
1313

1414
#include <optional>
1515

16-
#include "IRModule.h"
17-
#include "NanobindUtils.h"
1816
#include "mlir-c/BuiltinAttributes.h"
1917
#include "mlir-c/BuiltinTypes.h"
2018
#include "mlir-c/Support.h"
19+
#include "mlir/Bindings/Python/NanobindUtils.h"
2120

2221
namespace nb = nanobind;
2322
using namespace mlir;

0 commit comments

Comments
 (0)