MatchBufferLower::Bind vs ArgBinder::Bind

Is there a difference between the binding done in MatchBufferLower::Bind and the binding done in ArgBinder::Bind ? I’m working on some changes that impact the buffer binding, and would like to understand if there are any differences, or any reasons to avoid refactoring out common functionality. From a quick look through, it looks like they are handling very similar use cases, just with MatchBufferLower::Bind being on the TensorIR flow and ArgBinder::Bind being called by BufferBindUnwrapper on the TE flow.

Are there any differences between these that I should be aware of while working on them?

I agree that the binding is pretty similar between MatchBufferLower and ArgBinder.

However, the lowering result may be some different. MatchBufferLower works for TensorIR (blocks) while ArgBinder is used in storage_flatten.

It would be great if we can refactor some common part (e.g. binding), but I’m not sure wether we can combine them into only one.

Thank you, and that was what I was wondering on. The main differences that I can see is that MatchBufferLower::Bind also collects the bindings into an analyzer for later use, and it has more detailed comments.

Definitely agreed that combining the MatchBufferLower and ArgBinder classes wouldn’t be desirable, and this is more me trying to determine if the var/buffer binding code could be consolidated.