-
Notifications
You must be signed in to change notification settings - Fork 13.4k
assert with more information to help debug #132194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
assert with more information to help debug #132194
Conversation
@llvm/pr-subscribers-mlir Author: drazi (fengxie) ChangesThis PR output debug message to assertion to help debug user python code. Will print out more friendly information
Full diff: https://github.com/llvm/llvm-project/pull/132194.diff 1 Files Affected:
diff --git a/mlir/python/mlir/dialects/_ods_common.py b/mlir/python/mlir/dialects/_ods_common.py
index 1e7e8244ed442..11c363abe2ecd 100644
--- a/mlir/python/mlir/dialects/_ods_common.py
+++ b/mlir/python/mlir/dialects/_ods_common.py
@@ -104,7 +104,7 @@ def get_op_result_or_value(
elif isinstance(arg, _cext.ir.OpResultList):
return arg[0]
else:
- assert isinstance(arg, _cext.ir.Value)
+ assert isinstance(arg, _cext.ir.Value), f"expects Value, got {type(arg)}"
return arg
@@ -137,11 +137,10 @@ def get_op_result_or_op_results(
return (
list(get_op_results_or_values(op))
if len(op.results) > 1
- else get_op_result_or_value(op)
- if len(op.results) > 0
- else op
+ else get_op_result_or_value(op) if len(op.results) > 0 else op
)
+
ResultValueTypeTuple = _cext.ir.Operation, _cext.ir.OpView, _cext.ir.Value
ResultValueT = _Union[ResultValueTypeTuple]
VariadicResultValueT = _Union[ResultValueT, _Sequence[ResultValueT]]
|
@@ -147,6 +147,7 @@ def get_op_result_or_op_results( | |||
else: | |||
return op | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spurious change here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suspect introduced by auto formatter :(
This PR output debug message to assertion to help debug user python code. Will print out more friendly information