-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[torch-frontend] update torch-mlir (#139)
* update torch-mlir to latest * enable `torch_frontend.compile` to emit stablehlo versioned bytecode. Co-authored-by: Jiawei Wu <wujiawei.aml@bytedance.com>
- Loading branch information
Showing
12 changed files
with
84 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
frontends/torch-frontend/third_party/patches/torch_ops_cpp.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule torch-mlir
updated
252 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
frontends/torch-frontend/torch-frontend/python/test/test_stablehlo_bytecode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import torch | ||
import torch as tu | ||
|
||
import torch_frontend | ||
from torch_frontend import compile | ||
from torch_frontend._mlir_libs._stablehlo import deserialize_portable_artifact | ||
|
||
def serialize_helper(module, inputs): | ||
stablehlo_bytecode = compile(module, inputs, "stablehlo+0.16.2") | ||
deserialize_str = deserialize_portable_artifact(stablehlo_bytecode) | ||
print(deserialize_str) | ||
|
||
# ============================================================================== | ||
class SoftmaxModule(torch.nn.Module): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
def forward(self, x): | ||
return torch.ops.aten._softmax(x, dim=1, half_to_float=False) | ||
|
||
def test_softmax(): | ||
inputs = [tu.rand(3, 4)] | ||
serialize_helper(SoftmaxModule(), inputs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters