Skip to content

Commit

Permalink
Add shapelib and Torch ODS gen tests (llvm#1318)
Browse files Browse the repository at this point in the history
  • Loading branch information
powderluv authored and AmosLewis committed Sep 1, 2022
1 parent b16a38a commit 82f414b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build_tools/python_deploy/build_linux_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,20 @@ function test_in_tree() {
cd /main_checkout/torch-mlir/
export PYTHONPATH="/main_checkout/torch-mlir/build/tools/torch-mlir/python_packages/torch_mlir"

echo ":::: Run shapelib update tests"
if ! ./build_tools/update_shape_lib.sh; then
echo Shape Lib is out of date with the installed PyTorch version
else
echo Shape Lib is up to date
fi

echo ":::: Run torch_ods update tests"
if ! ./build_tools/update_torch_ods.sh; then
echo Torch ODS is out of date with the installed PyTorch version
else
echo Torch ODS is up to date
fi

echo ":::: Run refbackend e2e integration tests"
python -m e2e_testing.main --config=refbackend -v

Expand Down
9 changes: 9 additions & 0 deletions build_tools/update_shape_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ PYTHONPATH="${pypath}" python \
-m torch_mlir.dialects.torch.importer.jit_ir.build_tools.shape_lib_gen \
--pytorch_op_extensions=${ext_module:-""} \
--torch_transforms_cpp_dir="${torch_transforms_cpp_dir}"

if ! git diff --quiet ./lib/Dialect/Torch/Transforms/ShapeLibrary.cpp &> /dev/null; then
echo "#######################################################"
echo "Generated files are not up to date (see diff below)"
echo ">>> Please verify you are running the latest PyTorch nightly or source build and if required push these changes up for review <<<"
echo "#######################################################"
git diff --color=always ./lib/Dialect/Torch/Transforms/ShapeLibrary.cpp
exit 1
fi
9 changes: 9 additions & 0 deletions build_tools/update_torch_ods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,12 @@ PYTHONPATH="${pypath}" python \
--torch_ir_include_dir="${torch_ir_include_dir}" \
--pytorch_op_extensions="${ext_module}" \
--debug_registry_dump="${torch_ir_include_dir}/JITOperatorRegistryDump.txt"

if ! git diff --quiet ./include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td &> /dev/null; then
echo "#######################################################"
echo "Generated files are not up to date (see diff below)"
echo ">>> Please verify you are running the latest PyTorch nightly or source build and if required push these changes up for review <<<"
echo "#######################################################"
git diff --color=always ./include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td
exit 1
fi

0 comments on commit 82f414b

Please sign in to comment.