Fused/callsite location information is now printed in a tree format unlike a single string format

Hello Everyone,

I see that fused/callsite location is now printed as below:

#loc759 = loc(fused[#loc7, #loc66])
#loc760 = loc(fused[#loc7, #loc67])
#loc761 = loc(fused[#loc7, #loc68])
#loc762 = loc(fused[#loc7, #loc69])
#loc763 = loc(fused[#loc7, #loc70])
#loc764 = loc(fused[#loc7, #loc71])

unlike earlier:

#loc1468 = loc(fused["MatMul:", "densenet121/predictions/MatMul"])
#loc1469 = loc(fused["MatMul:", "densenet121/predictions/MatMul_1"])
#loc1470 = loc(fused["BiasAdd:", "densenet121/predictions/BiasAdd"])
#loc1471 = loc(fused["Cast:", "densenet121/predictions/BiasAdd/Cast"])

This makes it harder to trace the location information as I have to go through the entire tree to get the complete location information.

I understand that the new format helps to reduce the redundancy by avoiding the duplication of common paths. However, it is not debug friendly.

Is there any flag that I can use to get it in the earlier format?

Please let me know if something is not clear.
Thanks in advance!

There is no flag for controlling this directly. You can however try --mlir-pretty-debuginfo which as side-effect may print it in a more friendly way here?

Thanks for the suggestion. I tried this but it didn’t help.

This is the output after passing it through --mlir-pretty-debuginfo

#loc218 = #loc217
 at #loc180
#loc219 = #loc217
 at #loc182
#loc220 = #loc217
 at #loc183
#loc221 = #loc217
 at #loc184
#loc222 = #loc217
 at #loc178

@mehdi_amini Can we move this to the MLIR channel? I had a couple of notes to post.

This does look like a significant debugging experience issue/regression. Having to walk through the chain of locations to determine the “leaf” (which often has meaningful information - as in a call site trace) is tedious. -mlir-print-local-var-scope is actually the option that does provide the entire chain on the op, but that makes IR completely unreadable/unnavigable in other ways due to the dozens of lines attached to each op.

It does appear essential to have an option that chains the locations together without indirection, while having the definition out of line. I looked at the commit history on lib/IR/Location.cpp and test/IR/locations.mlir but couldn’t immediately determine which commit caused this change. It may not have been properly captured in the commit summary.

I believe it was this commit: [mlir] Cleanup lingering problems surrounding attribute/type aliases · llvm/llvm-project@aef89c8 · GitHub

1 Like

@River707 Are you open to such an extra option/mechanism being added to make these locations navigable?