-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix MLIR Python binding for arith.constant after argument has been ch…
…anged to an interface e179532 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
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |