llvm-project/mlir/examples/standalone/python/StandaloneExtensionPybind11.cpp
vfdev ce8c64fc8e
Remove StandaloneExtensionPybind11.cpp FT update as does not work with python 3.8 and old pybind11 (#122697)
Description:
- Remove StandaloneExtensionPybind11.cpp FT update as does not work with
python 3.8 and old pybind11

This should also fix the failing toy.test:
https://github.com/llvm/llvm-project/pull/122684#issuecomment-2586802692

cc @jpienaar
2025-01-13 16:19:23 +02:00

34 lines
1.3 KiB
C++

//===- StandaloneExtensionPybind11.cpp - Extension module -----------------===//
//
// This is the pybind11 version of the example module. There is also a nanobind
// example in StandaloneExtensionNanobind.cpp.
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "Standalone-c/Dialects.h"
#include "mlir/Bindings/Python/PybindAdaptors.h"
using namespace mlir::python::adaptors;
PYBIND11_MODULE(_standaloneDialectsPybind11, m) {
//===--------------------------------------------------------------------===//
// standalone dialect
//===--------------------------------------------------------------------===//
auto standaloneM = m.def_submodule("standalone");
standaloneM.def(
"register_dialect",
[](MlirContext context, bool load) {
MlirDialectHandle handle = mlirGetDialectHandle__standalone__();
mlirDialectHandleRegisterDialect(handle, context);
if (load) {
mlirDialectHandleLoadDialect(handle, context);
}
},
py::arg("context") = py::none(), py::arg("load") = true);
}