Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with TCP #17

Open
burmako opened this issue Aug 17, 2022 · 17 comments
Open

Integration with TCP #17

burmako opened this issue Aug 17, 2022 · 17 comments
Assignees

Comments

@burmako
Copy link
Contributor

burmako commented Aug 17, 2022

TCP dialect is a super exciting initiative in MLIR upstream (previous Discourse thread, current Discourse thread, design document)! Let's contribute to this effort by providing converters to/from TCP, so that TCP work can potentially leverage them to connect with the existing MHLO and, in the future, StableHLO producers (which currently include JAX, PyTorch and TensorFlow).

@burmako burmako self-assigned this Aug 17, 2022
@bhack
Copy link

bhack commented Aug 18, 2022

@burmako
Copy link
Contributor Author

burmako commented Aug 18, 2022

Thank you! Looks like I accidentally copy/pasted the wrong link from the design document :)

@burmako
Copy link
Contributor Author

burmako commented Aug 26, 2022

Current status: there is a proposal to add TCP to the LLVM Incubator (Discourse post, and there'll be an MLIR open design meeting to discuss the proposed spec next Thursday 9/1 (agenda). Nothing actionable for the StableHLO side just, but we're really looking forward to further progress!

@burmako
Copy link
Contributor Author

burmako commented Sep 6, 2022

Great progress on the TCP side which now has a dedicated category on Discourse and an initial draft of the spec which we discussed at an MLIR ODM last Thursday 9/1.

It looks like a code repository with the TCP dialect is going to be created very soon, and I'm looking forward to starting working on the conversion once it's there!

I've also looked into the logistics of integrating a potential GitHub-first dependency from StableHLO to TCP into the Google-first MLIR-HLO repository. On the technical side, the machinery is fairly straightforward. On the organizational side, this will depend on the eventual license that TCP adopts.

@burmako
Copy link
Contributor Author

burmako commented Sep 16, 2022

Exciting news! TCP is being bootstrapped in Torch-MLIR (llvm/torch-mlir#1366), and there's a pull request that introduces the needed boilerplate for the TCP dialect as well as a few ops - tanh, add and matmul (llvm/torch-mlir#1375).

As far as conversions between StableHLO and TCP go, the current plan is to wait until the above mentioned pull request lands and then start developing the conversions in Torch-MLIR. Torch-MLIR depends on MLIR-HLO, and StableHLO is shipped as part of MLIR-HLO, so we're already all set dependency-wise. I can't wait!

@bhack
Copy link

bhack commented Sep 20, 2022

Do you mean that initially you will work on this conversion inside the torch-mlir incubator repo?

I suppose this cause I don't think we could create a dependency here between this project and torch-mlir repo.

@burmako
Copy link
Contributor Author

burmako commented Sep 20, 2022

"Do you mean that initially you will work on this conversion inside the torch-mlir incubator repo?". Yes, that's what I briefly discussed with Raghavan, Sean and Stella a few days ago. Planning to send a PR along those lines once TCP lands.

@burmako
Copy link
Contributor Author

burmako commented Sep 27, 2022

llvm/torch-mlir#1375 has just landed in the Torch-MLIR repository, creating a TCP dialect and setting up all the related boilerplate + a tcp.dummy op. I'm extremely excited for the future development that this PR unlocks! 👏

@burmako
Copy link
Contributor Author

burmako commented Oct 10, 2022

@navahgar What next steps for TCP do you have in mind? Anything we need to prepare to on the StableHLO side? In the the SIG MLIR Open Design Meeting document, I saw "Broadcasting op & broadcasting semantics in TCP (Raghavan Raman, Cruise)", and I'm looking forward to the ODM :)

@navahgar
Copy link

@burmako Our plan is to get to the elementwise ops in TCP first. But that requires broadcasting, which in turn touches several important design points. We are hoping to get through with a decision on broadcasting and elementwise ops soon, preferably in the ODM.

@burmako
Copy link
Contributor Author

burmako commented Oct 17, 2022

Here are the corresponding design documents: Broadcast and Elementwise. We've discussed the former at the ODM last Thursday 10/13 and came to an intermediate resolution which will be followed by prototyping. Elementwise proposal still needs to be discussed.

@burmako burmako changed the title Create a bidirectional conversion between StableHLO and TCP Integration with TCP Nov 24, 2022
@burmako burmako assigned GleasonK and unassigned burmako Dec 27, 2022
@bhack
Copy link

bhack commented Jan 24, 2023

Is TCP still an active upstream project? As It seems to me not.

@sjarus
Copy link

sjarus commented Jan 24, 2023

Is TCP still an active upstream project? As It seems to me not.

It's very much in active development - we'd shifted focus to internally prototyping some of its important constructs and transformations for use in our deployment flows, and to enable us to provide feedback from that experience publicly. We'll be sharing some of this through additional design documents and code in the near future.

@bhack
Copy link

bhack commented Jan 24, 2023

Ok thanks for the clarification as I saw no more public activities on Github.

@burmako
Copy link
Contributor Author

burmako commented Mar 13, 2023

llvm/torch-mlir#1932 introduces the boilerplate for the StableHLO => TCP pass as well as an implementation of converting stablehlo.tanh to tcp.tanh to make sure that all the boilerplate works. Once we're aligned on logistics, I'll implement the rest.

@bhack
Copy link

bhack commented Mar 13, 2023

Is TCP actively maintained?

llvm/torch-mlir#1366

@navahgar
Copy link

Is TCP actively maintained?

Yes. This branch all the code: https://github.com/llvm/torch-mlir/tree/mlir-tcp

We have also been posting PRs to the discord channel : https://discord.com/channels/636084430946959380/1020532515720671332

sjain-stanford pushed a commit to llvm/torch-mlir that referenced this issue Mar 28, 2023
* [TCP] Add boilerplate for the -convert-stablehlo-to-tcp pass

When TCP was introduced, we discussed that it would be interesting to
have a StableHLO => TCP pass that lives alongside TCP in Torch-MLIR.

This PR adds the boilerplate for such a pass as well as an
implementation of converting stablehlo.tanh to tcp.tanh to make sure
that all the boilerplate works.

Also tagging openxla/stablehlo#17 to
kickstart tracking the work on implementing this converter and keeping
it in sync with the evolution of TCP.

* Address feedback

* Fix Bazel build

* Fix CMake build

* Run buildifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants