You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a compiler error, if the saved model was saved with debug information (i.e. tf.saved_model.save(..., options=tf.saved_model.SaveOptions(save_debug_info=True))) we do get stack traces with original source locations, but they print horrendously using the default diagnostic printer (i.e. callsite(...) tags all run together on one line. We should find/make/use a pretty standard diagnostic printer in all of our compiler tools.
Could you provide an example log? I think this is specific to the Python integration, right? The issue is that the source locations from Python don't print nicely with the standard diagnostic printer?
The exact case I'm looking at is a private model, and we do try to keep in tree tests from having compiler errors, so no :)
It is printing basically as one long line of loc(.... 2 lines of huge file path...:{line}:{col}) all run together with one for each level of the python stack trace. I'm going to do some ad-hoc formatting and make it better. Then see if that is something to make more common. I don't think there is really a "great" option given how TensorFlow represents debug info, but "better" should be attainable.
It doesn't fully help, but -mlir-pretty-debuginfo at least gives one-line-per-callsite.
Also, some thoughts:
The ugliness here is the result of 2 things:
TF capturing the entire Python stack trace at the callsite -- arguably correct and good, but not the best experience for users. As a developer that cares about internals, I've found myself using various parts of the stack trace, but perhaps users only care about the top entry, or at least the the stuff that is not "internal to tensorflow", which we could heuristically identify by whehter the path contains tensorflow/python/ or some other special string.
Unreasonably long bazel paths usually.
River mentioned that this was a real usability issue for folks he was talking to, so if this is becoming a problem, we can write a pass "TF adjust locations" which:
strips of everything up to the last bazel workspace root in the path (or something like that).
trims down those callsite locations such that only paths that don't contain tensorflow/python/ are retained.
Having tried to fix this upstream at various points in the past by being smarter about filtering, etc, I think I am in favor of the "TF adjust locations" pass, probably with a default flag that strips it to one heuristically determined entry. Possibly there is some way to model this so that only the "best" callsite is stored in a way that the default location formatters use (which are also not active here) but all are preserved. This would allow us to have flags at any stage of the tooling to "dump everything" but not bother most people with that.
Ho there! This bug hasn't been updated in a long time. Good intentions and all, but we're moving this to the backlog. Feel free to bring it back if you think there's a reasonable chance it'll get worked on in the next 6mo!
Activity
GMNGeoffrey commentedon Apr 2, 2021
Could you provide an example log? I think this is specific to the Python integration, right? The issue is that the source locations from Python don't print nicely with the standard diagnostic printer?
stellaraccident commentedon Apr 5, 2021
The exact case I'm looking at is a private model, and we do try to keep in tree tests from having compiler errors, so no :)
It is printing basically as one long line of
loc(.... 2 lines of huge file path...:{line}:{col})all run together with one for each level of the python stack trace. I'm going to do some ad-hoc formatting and make it better. Then see if that is something to make more common. I don't think there is really a "great" option given how TensorFlow represents debug info, but "better" should be attainable.silvasean commentedon Apr 15, 2021
It doesn't fully help, but
-mlir-pretty-debuginfoat least gives one-line-per-callsite.Also, some thoughts:
The ugliness here is the result of 2 things:
TF capturing the entire Python stack trace at the callsite -- arguably correct and good, but not the best experience for users. As a developer that cares about internals, I've found myself using various parts of the stack trace, but perhaps users only care about the top entry, or at least the the stuff that is not "internal to tensorflow", which we could heuristically identify by whehter the path contains
tensorflow/python/or some other special string.Unreasonably long bazel paths usually.
River mentioned that this was a real usability issue for folks he was talking to, so if this is becoming a problem, we can write a pass "TF adjust locations" which:
tensorflow/python/are retained.stellaraccident commentedon Apr 16, 2021
Having tried to fix this upstream at various points in the past by being smarter about filtering, etc, I think I am in favor of the "TF adjust locations" pass, probably with a default flag that strips it to one heuristically determined entry. Possibly there is some way to model this so that only the "best" callsite is stored in a way that the default location formatters use (which are also not active here) but all are preserved. This would allow us to have flags at any stage of the tooling to "dump everything" but not bother most people with that.
stellaraccident commentedon Apr 17, 2021
This is so tangled. I think I have an approach in my head to simplify it, though.
Enable SourceMgrDiagnosticHandler in importers.
Enable SourceMgrDiagnosticHandler in importers. (#5600)
Disable printing op on diagnostics in user tools by default.
Disable printing op on diagnostics in user tools by default. (#5806)
allieculp commentedon Jul 13, 2022
@stellaraccident Old issue alert! Still active?
aaron-schneider commentedon Apr 17, 2023
Ho there! This bug hasn't been updated in a long time. Good intentions and all, but we're moving this to the backlog. Feel free to bring it back if you think there's a reasonable chance it'll get worked on in the next 6mo!
GMNGeoffrey commentedon Apr 17, 2023
Well iree-import-tf has been removed, so I think safe to close this entirely.