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
{{ message }}
Repository navigation
Print input/output values for each dispatch function to help debugging #2305
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.
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.
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!
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.
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.
+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.
Activity
stellaraccident commentedon Jun 24, 2020
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.
benvanik commentedon Jun 24, 2020
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 exposinghal.buffer_view.traceinto the IR so that we could emit the trace ops at the right places and then calling theiree_hal_buffer_view_format+ stdout to dump the value. Should be pretty easy to complete!stellaraccident commentedon Jun 24, 2020
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.
benvanik commentedon Jun 24, 2020
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
flowlevel by tensor creation source location and use that to identify things.rybakov commentedon Jun 29, 2020
+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.
hanhanW commentedon Jul 13, 2020
@benvanik Could you point out some files/reference to add this feature in, so I can take a look and work on this?
hanhanW commentedon Jul 20, 2020
quick update: talked to Ben, and start working on this.
Print input/output values for each dispatch function in DEBUG mode
Print input/output values for each dispatch function in DEBUG mode (#…