[Mlir-commits] [mlir] [MLIR] Erase location of folded constants (PR #75415)

Billy Zhu llvmlistbot at llvm.org
Sun Jan 7 00:55:15 PST 2024


zyx-billy wrote:

> Honestly this feel weird: whenever I see an unknown loc in a module I think somebody messed up and didn't do a good job tracking. I see unknown locations as bugs, where information was lost.

@jpienaar I agree with the sentiment... Today we're jumping between two extremes: tracking everything & tracking nothing. Our first approach was to track everything, which lead to the OOM error and had to be reverted, so we went with tracking nothing instead.

One middle ground I see is to mark deduplicated constants with the common parent region's location (similar in spirit to what llvm does when merging locations. Without the ability to just fuse a bunch of locations like mlir, it had to create a single "common" location). If this seems reasonable, I'm happy to make this change. I'm about to submit a similar patch for CSE too, so it'd be great to solidify the approach.

At the end of the day, I don't feel like we have much of a choice when two ops are merged... We either track both locations, track a common parent, or track nothing (there may be different ways to encode this, of course). In contrast, the previous approach was to just track an arbitrary one, so I do think we're moving in the right direction. Of course please LMK if you have any alternative suggestions 🙏.

https://github.com/llvm/llvm-project/pull/75415


More information about the Mlir-commits mailing list