File tree Expand file tree Collapse file tree 5 files changed +55
-2
lines changed
include/mlir/Dialect/UB/IR Expand file tree Collapse file tree 5 files changed +55
-2
lines changed Original file line number Diff line number Diff line change 1212include "mlir/Interfaces/SideEffectInterfaces.td"
1313include "mlir/IR/AttrTypeBase.td"
1414
15- include "UBOpsInterfaces.td"
15+ include "mlir/Dialect/UB/IR/ UBOpsInterfaces.td"
1616
1717def UB_Dialect : Dialect {
1818 let name = "ub";
Original file line number Diff line number Diff line change @@ -453,6 +453,14 @@ declare_mlir_dialect_python_bindings(
453453 DIALECT_NAME tosa
454454)
455455
456+ declare_mlir_dialect_python_bindings(
457+ ADD_TO_PARENT MLIRPythonSources.Dialects
458+ ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR} /mlir"
459+ TD_FILE dialects/UBOps.td
460+ SOURCES dialects/ub.py
461+ DIALECT_NAME ub
462+ )
463+
456464declare_mlir_dialect_python_bindings(
457465 ADD_TO_PARENT MLIRPythonSources.Dialects
458466 ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR} /mlir"
@@ -847,4 +855,3 @@ add_mlir_python_modules(MLIRPythonModules
847855 COMMON_CAPI_LINK_LIBS
848856 MLIRPythonCAPI
849857)
850-
Original file line number Diff line number Diff line change 1+ //===-- UBOps.td - Entry point for UB bindings -------------*- 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_UB_OPS
10+ #define PYTHON_BINDINGS_UB_OPS
11+
12+ include "mlir/Dialect/UB/IR/UBOps.td"
13+
14+ #endif // PYTHON_BINDINGS_UB_OPS
Original file line number Diff line number Diff line change 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 ._ub_ops_gen import *
Original file line number Diff line number Diff line change 1+ # RUN: %PYTHON %s | FileCheck %s
2+ # This is just a smoke test that the dialect is functional.
3+ from array import array
4+
5+ from mlir .ir import *
6+ from mlir .dialects import ub
7+ from mlir .extras import types as T
8+
9+
10+ def constructAndPrintInModule (f ):
11+ print ("\n TEST:" , f .__name__ )
12+ with Context (), Location .unknown ():
13+ module = Module .create ()
14+ with InsertionPoint (module .body ):
15+ f ()
16+ print (module )
17+ return f
18+
19+
20+ # CHECK-LABEL: testSmoke
21+ @constructAndPrintInModule
22+ def testSmoke ():
23+ # CHECK: Value(%{{.*}} = ub.poison : f32
24+ f32 = F32Type .get ()
25+ poison = ub .poison (f32 )
26+ print (poison )
27+ assert isinstance (poison , Value )
You can’t perform that action at this time.
0 commit comments