mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
[mlir][python] Propagate error diagnostics when an op couldn't be created. (#169499)
This commit is contained in:
committed by
GitHub
parent
83d9c636b7
commit
012721d320
@@ -5,7 +5,7 @@ import io
|
||||
from tempfile import NamedTemporaryFile
|
||||
from mlir.ir import *
|
||||
from mlir.dialects.builtin import ModuleOp
|
||||
from mlir.dialects import arith, func, scf
|
||||
from mlir.dialects import arith, func, scf, shape
|
||||
from mlir.dialects._ods_common import _cext
|
||||
from mlir.extras import types as T
|
||||
|
||||
@@ -774,6 +774,21 @@ def testKnownOpView():
|
||||
print(repr(constant))
|
||||
|
||||
|
||||
# CHECK-LABEL: TEST: testFailedGenericOperationCreationReportsError
|
||||
@run
|
||||
def testFailedGenericOperationCreationReportsError():
|
||||
with Context(), Location.unknown():
|
||||
c0 = shape.const_shape([])
|
||||
c1 = shape.const_shape([1, 2, 3])
|
||||
try:
|
||||
shape.MeetOp.build_generic(operands=[c0, c1])
|
||||
except MLIRError as e:
|
||||
# CHECK: unequal shape cardinality
|
||||
print(e)
|
||||
else:
|
||||
assert False, "Expected exception"
|
||||
|
||||
|
||||
# CHECK-LABEL: TEST: testSingleResultProperty
|
||||
@run
|
||||
def testSingleResultProperty():
|
||||
|
||||
Reference in New Issue
Block a user