-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[TIR][Hybrid] Hybrid Script Support for TIR #6227
Conversation
Thanks @spectrometerHBH , some quick items:
|
cc @Hzfengsy @weberlo @junrushao1994 @were please help to review the PR |
Thanks! I will take a look this weekend :-) |
""" | ||
|
||
_binop_maker = { | ||
ast.Add: tir.Add, |
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.
For followup PR.
To enable automatic conversion in frontend(syntax sugar), we might want to be able change to the operator version instead of the tir.Add(requires both operands to share the same type).
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.
Overall LTGTM, we can handle more syntax sugar and error reporting support in the follow up PRs. wait feedbacks from @junrushao1994 @Hzfengsy
return "\n " + src_line + "\n " + " " * col_offset + "^\n" + "ParserError in line " \ | ||
+ str(lineno) + " : " + message | ||
|
||
def report_error(self, message, lineno=None, col_offset=None): |
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.
Please add a test case of parsing error to make sure report error works properly(e.g. report the right line). Use pytest.raises
cc @Hzfengsy @junrushao1994 please take another look. @spectrometerHBH please add the testcase about report error then it looks good from my side. |
@@ -60,6 +60,9 @@ | |||
# tvm.parser | |||
from . import parser | |||
|
|||
# tvm tir hybrid script |
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.
# tvm tir hybrid script | |
# tvm hybrid script |
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.
LGTM
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.
LGTM
Thanks @spectrometerHBH @junrushao1994 @Hzfengsy . This PR is now merged |
In [RFC] Hybrid Script Support for TIR, we plans to utilize a subset of Python AST that can express every TIR node. In this PR, we introduce hybrid script printer&parser with basic infra and a complete parsing/printing feature.