Skip to content

iree-tf-import stack traces are an eyesore #5295

Closed as not planned
Closed as not planned

Description

@stellaraccident

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.

Activity

  1. added
    help wanted
    quality of life 😊
    on Apr 2, 2021
  2. GMNGeoffrey commented on Apr 2, 2021

    @GMNGeoffrey
    Member

    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?

  3. stellaraccident commented on Apr 5, 2021

    @stellaraccident
    CollaboratorAuthor

    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.

  4. silvasean commented on Apr 15, 2021

    @silvasean
    Contributor

    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:

    1. 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.

    2. 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:

    1. strips of everything up to the last bazel workspace root in the path (or something like that).
    2. trims down those callsite locations such that only paths that don't contain tensorflow/python/ are retained.
  5. stellaraccident commented on Apr 16, 2021

    @stellaraccident
    CollaboratorAuthor

    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.

  6. stellaraccident commented on Apr 17, 2021

    @stellaraccident
    CollaboratorAuthor

    This is so tangled. I think I have an approach in my head to simplify it, though.

  7. added
    integrations/tensorflow
    and removed on Jun 13, 2022
  8. allieculp commented on Jul 13, 2022

    @allieculp

    @stellaraccident Old issue alert! Still active?

  9. aaron-schneider commented on Apr 17, 2023

    @aaron-schneider

    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!

  10. moved this from Not Started to Backlog in (Deprecated) IREEon Apr 17, 2023
  11. GMNGeoffrey commented on Apr 17, 2023

    @GMNGeoffrey
    Member

    Well iree-import-tf has been removed, so I think safe to close this entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

help wantedintegrations/tensorflowquality of life 😊

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions