Skip to content

Print input/output values for each dispatch function to help debugging #2305

Closed

Description

@hanhanW

Now we got more and more models to test. This kind of integration tests is hard to debug since it would output many stuff together. It would be good if we can dump input/output values for each dispatch function. It's easier to debug because we can simply compare the log with different backends. E.g., since VMLA usually and should always be a reference, any other backends can compare their output with it to debug. And it's easier to debug with VMLA in my experience, e.g., better tool, easier to print out values in a kernel or even an operation (like conv op), etc.

Activity

  1. added
    enhancement ➕
    on Jun 24, 2020
  2. stellaraccident commented on Jun 24, 2020

    @stellaraccident
    Collaborator

    These kinds of diagnostic dumps are incredibly important for debugging. Personally, I would find a way to eventually enable them for all backends, even if full interpretability requires a special build or something.

  3. benvanik commented on Jun 24, 2020

    @benvanik
    Collaborator

    I got pretty far along on doing this by moving buffer view printing into the HAL (iree_hal_buffer_view_format) - the last piece to wire it up was actually exposing hal.buffer_view.trace into the IR so that we could emit the trace ops at the right places and then calling the iree_hal_buffer_view_format + stdout to dump the value. Should be pretty easy to complete!

  4. stellaraccident commented on Jun 24, 2020

    @stellaraccident
    Collaborator

    I'd be interested to have a look and see if there are any identifiers or such missing so that dumps can be directly compared across backends (i.e. even if they emit out of order, there is some correlation key that can get this back). Mainly looking for something that a not terribly complicated python diff script could go through, line things up, apply tolerances and highlight diffs.

  5. benvanik commented on Jun 24, 2020

    @benvanik
    Collaborator

    Today (and in the future with flags) we can serialize work such that the order is always the same - that's what I did on the existing BDI code and was able to just use normal diff tools. We'd probably need to insert the tracing ops at the flow dialect level in order to get stability as if inserted lower down there's a possibility of backend-specific things sneaking in (such as combined bindings/buffer arena allocations/etc). We could hash on the flow level by tensor creation source location and use that to identify things.

  6. rybakov commented on Jun 29, 2020

    @rybakov
    Contributor

    +1 on this feature. In python we use save function "result.save()" which dumps outputs of all backends in different files in human(and python) readable txt, it is easy to compared backend outputs. It would be great to have something similar on dispatch or layer level for every backends.

  7. self-assigned this
    on Jul 13, 2020
  8. hanhanW commented on Jul 13, 2020

    @hanhanW
    ContributorAuthor

    @benvanik Could you point out some files/reference to add this feature in, so I can take a look and work on this?

  9. hanhanW commented on Jul 20, 2020

    @hanhanW
    ContributorAuthor

    quick update: talked to Ben, and start working on this.

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

Metadata

Metadata

Assignees

Labels

enhancement ➕

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions