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

Added JIT to MLIR lowering #724

Merged
merged 2 commits into from
Apr 14, 2022

Conversation

henrytwo
Copy link
Member

This PR adds the ability to generate MLIR using a custom LTC backend.

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MLIR in torch-mlir.

Note: This PR is based on #723, but GitHub does not allow for setting the base to a fork while keeping this PR in the upstream repo, so there are several shared commits. Only the last one is specifically part of this PR.

A future PR will include an example implementation and usage of the custom backend.

Marked as draft while waiting for a dependency PR to land: #723

cc: @antoniojkim @ke1337

Copy link
Contributor

@silvasean silvasean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's your general testing strategy for the backend? Are you going to write unittests with FileCheck? something like this perhaps? https://github.com/llvm/torch-mlir/blob/main/test/python/importer/jit_ir/node_import/prim.py

@henrytwo
Copy link
Member Author

what's your general testing strategy for the backend? Are you going to write unittests with FileCheck? something like this perhaps? https://github.com/llvm/torch-mlir/blob/main/test/python/importer/jit_ir/node_import/prim.py

I don't think we have solid plans for writing tests yet, but I think FileCheck would be great for verifying the MLIR matches what we expect.

@henrytwo henrytwo force-pushed the jit_to_mlir_lowering branch from 2de2f11 to 4b83a47 Compare April 1, 2022 19:47
@henrytwo henrytwo force-pushed the jit_to_mlir_lowering branch 2 times, most recently from f2c6e82 to 9a41d6c Compare April 13, 2022 20:28
Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.
@henrytwo henrytwo force-pushed the jit_to_mlir_lowering branch from 9a41d6c to f882273 Compare April 14, 2022 15:42
@henrytwo henrytwo force-pushed the jit_to_mlir_lowering branch from f882273 to c802a94 Compare April 14, 2022 16:23
@henrytwo henrytwo marked this pull request as ready for review April 14, 2022 16:39
@henrytwo henrytwo merged commit a4aa8e8 into llvm:torch_mlir_ltc_backend Apr 14, 2022
@henrytwo henrytwo deleted the jit_to_mlir_lowering branch April 14, 2022 16:40
antoniojkim pushed a commit that referenced this pull request May 26, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
antoniojkim pushed a commit that referenced this pull request Jun 30, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
antoniojkim pushed a commit that referenced this pull request Jun 30, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
antoniojkim pushed a commit that referenced this pull request Jul 5, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
antoniojkim pushed a commit that referenced this pull request Jul 7, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
henrytwo added a commit that referenced this pull request Jul 8, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
henrytwo added a commit that referenced this pull request Jul 8, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
henrytwo added a commit that referenced this pull request Jul 12, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
antoniojkim pushed a commit that referenced this pull request Jul 15, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
antoniojkim pushed a commit that referenced this pull request Jul 19, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
antoniojkim pushed a commit that referenced this pull request Jul 22, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
henrytwo added a commit that referenced this pull request Jul 29, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
henrytwo added a commit that referenced this pull request Jul 29, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
henrytwo added a commit that referenced this pull request Jul 30, 2022
* Added JIT to MLIR lowering

Lowering to JIT is performed in a way similar to how it's done in the TS LTC backend. After a jit::Graph is constructed, it gets converted to a jit::Function, which is fed into the existing utility to generate an MlirModule in torch-mlir.

* Renamed `csrc/backend` to `csrc/base_lazy_backend`
qedawkins pushed a commit to nod-ai/torch-mlir that referenced this pull request Oct 3, 2022
* Build JNI on Windows

This change makes JNI buildable on Windows. It also cleans up the logic for determining when to build JNI and adds the necessary dependency to MainUtils

Signed-off-by: Stella Stamenova <[email protected]>

* Undo a change made by clang-format locally because clang-format in the builds is complaining about it

Signed-off-by: Stella Stamenova <[email protected]>

* Check for null

Signed-off-by: Stella Stamenova <[email protected]>

* Make clang-format happy

Signed-off-by: Stella Stamenova <[email protected]>

Co-authored-by: Kevin O'Brien <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants