-
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
[TVMSCRIPT] Using diagnostics for TVM Script #6797
Conversation
Please wait until the jenkinsfile get updated, we will need a separate PR to update the Jenkinsfile first after ensuring the docker staging pass (to prevent other test regressions), will send an update once the image get updated. |
f84943d
to
db004ab
Compare
python/tvm/script/diagnostics.py
Outdated
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
"""Bridge from synr DiagnosticContext to TVM's diagnostics""" |
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.
What is synr ? I don't obviously follow what it means - a quick google search doesn't indicate anything either.
regards
Ramana
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.
Synr is a small utility library we wrote to normalize the python ast between version changes. You can find it here: https://github.com/octoml/synr.
I'll reword this comment to make it clearer.
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.
The comment is not very clear as it only refers to linking a Diagnostic context in synr to tvm. Is there an RFC or something that relates to this that you could point people at who might be interested in what problem this is solving and why this is needed ?
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.
When you parse the AST with synr, you also pass in a object implementing synr's DiagnosticContext interface (https://synr.readthedocs.io/en/latest/#synr.DiagnosticContext). The DiagnosticContext is responsible for accumulating and reporting errors. This file defines a wrapper object that implements synr's DiagnosticContext and calls out to TVMCtx to report errors.
I think the closest RFC you will find is https://discuss.tvm.apache.org/t/rfc-meta-rfc-3-pronged-plan-for-improving-error-messages-in-tvm/7214.
docker images has been updated |
db004ab
to
e2b7319
Compare
@spectrometerHBH Would you like to take a look? Thanks! |
Is this PR ready for review? Looks like it encountered problems in CI. |
@spectrometerHBH Feel free to review it now, I need to bump the dependency in docker. |
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!
|
||
|
||
class MetaUnparser(ast.NodeVisitor): | ||
class MetaUnparser(Transformer): |
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.
We can consider renaming this class.
0a4a61b
to
c7518ae
Compare
Do we prefer to maintain synr as an external dependency, and make a release every time, or include synr as part of tvm? |
I think it is valuable to maintain outside of the TVM code base. I know monorepo'ing everything provides some conveniences but when there are reusable components which can be used outside of TVM it makes sense to maintain them as separate pieces of code. For example there have been multiple other projects which have built similar approaches to |
5fa9aa3
to
fd54e42
Compare
@leandron Does this PR look good to you now? Or are there any other changes you would like? |
* [TVMSCRIPT] Using diagnostics for TVM Script * fix lint * More documentation, improve some error messages * Apply suggestions from code review Co-authored-by: Leandro Nunes <[email protected]> * Add synr to ci setup and setup.py * remove typed_ast dependency Co-authored-by: Leandro Nunes <[email protected]>
* [TVMSCRIPT] Using diagnostics for TVM Script * fix lint * More documentation, improve some error messages * Apply suggestions from code review Co-authored-by: Leandro Nunes <[email protected]> * Add synr to ci setup and setup.py * remove typed_ast dependency Co-authored-by: Leandro Nunes <[email protected]>
* [TVMSCRIPT] Using diagnostics for TVM Script * fix lint * More documentation, improve some error messages * Apply suggestions from code review Co-authored-by: Leandro Nunes <[email protected]> * Add synr to ci setup and setup.py * remove typed_ast dependency Co-authored-by: Leandro Nunes <[email protected]>
This PR modifies TVM Script to use the new diagnostics interface. This should make error messages a lot clearer.
This PR depends on #6795.
@jroesch @tqchen @junrushao1994