mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
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
This commit is contained in:
19
mlir/test/python/dialects/arith_dialect.py
Normal file
19
mlir/test/python/dialects/arith_dialect.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# 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)
|
||||
Reference in New Issue
Block a user