Files
clang-p2996/mlir/test/python/dialects/arith_dialect.py
Mehdi Amini ec5def5e20 Fix MLIR Python binding for arith.constant after argument has been changed to an interface
e179532284 removed the Type field from attributes and
arith::ConstantOp argument is now a TypedAttrInterface which isn't
supported by the python generator.
This patch temporarily restore the functionality for arith.constant but
won't generalize: we need to work on the generator instead.

Differential Revision: https://reviews.llvm.org/D130878
2022-08-01 09:06:55 +00:00

20 lines
491 B
Python

# RUN: %PYTHON %s | FileCheck %s
from mlir.ir import *
import mlir.dialects.func as func
import mlir.dialects.arith as arith
def run(f):
print("\nTEST:", f.__name__)
f()
# CHECK-LABEL: TEST: testConstantOp
@run
def testConstantOps():
with Context() as ctx, Location.unknown():
module = Module.create()
with InsertionPoint(module.body):
arith.ConstantOp(value=42.42, result=F32Type.get())
# CHECK: %cst = arith.constant 4.242000e+01 : f32
print(module)