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

Add shapelib and Torch ODS gen tests #1318

Merged
merged 1 commit into from
Aug 31, 2022
Merged

Conversation

powderluv
Copy link
Collaborator

@powderluv powderluv commented Aug 31, 2022

Also update the scripts to return 1 when there are changes. The tests can check and report if there are any changes. But you get a warning even when you run it outside of the CI.

TEST:
The passing tests look like:
:::: Run shapelib update tests
Shape Lib is up to date
:::: Run torch_ods update tests
Torch ODS is up to date

Failing would like like:

~/github/torch-mlir % time ./build_tools/update_shape_lib.sh
PYTHONPATH=/home/anush/github/torch-mlir/build/tools/torch-mlir/python_packages/torch_mlir python -m torch_mlir.dialects.torch.importer.jit_ir.build_tools.shape_lib_gen --pytorch_op_extensions= --torch_transforms_cpp_dir=/home/anush/github/torch-mlir/lib/Dialect/Torch
/Transforms
Generated files are not up to date (see diff below)
>>> Please run ./build_tools/update_torch_ods.sh and ./build_tools/update_shape_lib.sh <<<
diff --git a/lib/Dialect/Torch/Transforms/ShapeLibrary.cpp b/lib/Dialect/Torch/Transforms/ShapeLibrary.cpp
index f7a8f69c..a780ee33 100644
--- a/lib/Dialect/Torch/Transforms/ShapeLibrary.cpp
+++ b/lib/Dialect/Torch/Transforms/ShapeLibrary.cpp
@@ -14,6 +14,8 @

 #include "torch-mlir/Dialect/Torch/Transforms/Passes.h"

+foo
+
 using namespace mlir;

 StringRef mlir::torch::Torch::getShapeLibrary() {
./build_tools/update_shape_lib.sh  0.02s user 0.01s system 104% cpu 0.035 total

Fixes Issue #1317

Also update the scripts to return 1 when there are changes. The
tests can check and report if there are any changes.

TEST:
The passing tests look like:
:::: Run shapelib update tests
Shape Lib is up to date
:::: Run torch_ods update tests
Torch ODS is up to date

Failing would like like:

anush@sdp ~/github/torch-mlir % time ./build_tools/update_shape_lib.sh
PYTHONPATH=/home/anush/github/torch-mlir/build/tools/torch-mlir/python_packages/torch_mlir python -m torch_mlir.dialects.torch.importer.jit_ir.build_tools.shape_lib_gen --pytorch_op_extensions= --torch_transforms_cpp_dir=/home/anush/github/torch-mlir/lib/Dialect/Torch
/Transforms
Generated files are not up to date (see diff below)
>>> Please run ./build_tools/update_torch_ods.sh and ./build_tools/update_shape_lib.sh <<<
diff --git a/lib/Dialect/Torch/Transforms/ShapeLibrary.cpp b/lib/Dialect/Torch/Transforms/ShapeLibrary.cpp
index f7a8f69c..a780ee33 100644
--- a/lib/Dialect/Torch/Transforms/ShapeLibrary.cpp
+++ b/lib/Dialect/Torch/Transforms/ShapeLibrary.cpp
@@ -14,6 +14,8 @

 #include "torch-mlir/Dialect/Torch/Transforms/Passes.h"

+foo
+
 using namespace mlir;

 StringRef mlir::torch::Torch::getShapeLibrary() {
./build_tools/update_shape_lib.sh  0.02s user 0.01s system 104% cpu 0.035 total

I updated the CI to not hard fail when there is diff. If we pin Pytorch
we can hard fail in the future
@powderluv powderluv merged commit 928c815 into llvm:main Aug 31, 2022
AmosLewis pushed a commit to AmosLewis/torch-mlir that referenced this pull request Sep 1, 2022
AmosLewis pushed a commit to AmosLewis/torch-mlir that referenced this pull request Sep 2, 2022
AmosLewis pushed a commit to AmosLewis/torch-mlir that referenced this pull request Sep 2, 2022
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.

3 participants