Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mlir/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,15 @@ declare_mlir_dialect_python_bindings(
"../../include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td"
)

declare_mlir_dialect_python_bindings(
ADD_TO_PARENT MLIRPythonSources.Dialects
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
TD_FILE dialects/SMTOps.td
GEN_ENUM_BINDINGS
SOURCES
dialects/smt.py
DIALECT_NAME smt)

declare_mlir_dialect_python_bindings(
ADD_TO_PARENT MLIRPythonSources.Dialects
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
Expand Down
14 changes: 14 additions & 0 deletions mlir/python/mlir/dialects/SMTOps.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===- SMTOps.td - Entry point for SMT bindings ------------*- tablegen -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef BINDINGS_PYTHON_SMT_OPS
#define BINDINGS_PYTHON_SMT_OPS

include "mlir/Dialect/SMT/IR/SMT.td"

#endif // BINDINGS_PYTHON_SMT_OPS
5 changes: 5 additions & 0 deletions mlir/python/mlir/dialects/smt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 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

from ._smt_ops_gen import *
16 changes: 16 additions & 0 deletions mlir/test/python/dialects/smt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# REQUIRES: bindings_python
# RUN: %PYTHON% %s | FileCheck %s

import mlir

from mlir.dialects import smt
from mlir.ir import Context, Location, Module, InsertionPoint

with Context() as ctx, Location.unknown():
m = Module.create()
with InsertionPoint(m.body):
true = smt.constant(True)
false = smt.constant(False)
# CHECK: smt.constant true
# CHECK: smt.constant false
print(m)
Loading