mirror of https://github.com/llvm/torch-mlir
build: enable update scripts to work with out-of-tree builds (#1553)
Before this patch, the update_shape_lib.sh and update_torch_ods.sh scripts only worked on in-tree builds, which implied that the RollPyTorch action was forced to run the longer-running in-tree build. As a result of this patch, we should be able to run through the basic checks in the RollPyTorch action faster, while running the full suite of tests off the critical path. The key change in this patch is that the update scripts now look for the directory that is most recently modified between in-tree or out-of-tree build directories. The change also correctly handles the case when only one of the two directories exists.pull/1555/head
parent
de4bcbfe9b
commit
db5a496eb4
|
@ -14,7 +14,21 @@ set -euo pipefail
|
|||
src_dir="$(realpath "$(dirname "$0")"/..)"
|
||||
build_dir="$(realpath "${TORCH_MLIR_BUILD_DIR:-$src_dir/build}")"
|
||||
torch_transforms_cpp_dir="${src_dir}/lib/Dialect/Torch/Transforms"
|
||||
python_packages_dir="${build_dir}/tools/torch-mlir/python_packages"
|
||||
|
||||
in_tree_pkg_dir="${build_dir}/tools/torch-mlir/python_packages"
|
||||
out_of_tree_pkg_dir="${build_dir}/python_packages"
|
||||
|
||||
if [[ ! -d "${in_tree_pkg_dir}" && ! -d "${out_of_tree_pkg_dir}" ]]; then
|
||||
echo "Couldn't find in-tree or out-of-tree build, exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The `-nt` check works even if one of the two directories is missing.
|
||||
if [[ "${in_tree_pkg_dir}" -nt "${out_of_tree_pkg_dir}" ]]; then
|
||||
python_packages_dir="${in_tree_pkg_dir}"
|
||||
else
|
||||
python_packages_dir="${out_of_tree_pkg_dir}"
|
||||
fi
|
||||
|
||||
TORCH_MLIR_EXT_PYTHONPATH="${TORCH_MLIR_EXT_PYTHONPATH:-""}"
|
||||
pypath="${python_packages_dir}/torch_mlir"
|
||||
|
|
|
@ -14,7 +14,21 @@ set -euo pipefail
|
|||
src_dir="$(realpath "$(dirname "$0")"/..)"
|
||||
build_dir="$(realpath "${TORCH_MLIR_BUILD_DIR:-$src_dir/build}")"
|
||||
torch_ir_include_dir="${src_dir}/include/torch-mlir/Dialect/Torch/IR"
|
||||
python_packages_dir="${build_dir}/tools/torch-mlir/python_packages"
|
||||
|
||||
in_tree_pkg_dir="${build_dir}/tools/torch-mlir/python_packages"
|
||||
out_of_tree_pkg_dir="${build_dir}/python_packages"
|
||||
|
||||
if [[ ! -d "${in_tree_pkg_dir}" && ! -d "${out_of_tree_pkg_dir}" ]]; then
|
||||
echo "Couldn't find in-tree or out-of-tree build, exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The `-nt` check works even if one of the two directories is missing.
|
||||
if [[ "${in_tree_pkg_dir}" -nt "${out_of_tree_pkg_dir}" ]]; then
|
||||
python_packages_dir="${in_tree_pkg_dir}"
|
||||
else
|
||||
python_packages_dir="${out_of_tree_pkg_dir}"
|
||||
fi
|
||||
|
||||
TORCH_MLIR_EXT_PYTHONPATH="${TORCH_MLIR_EXT_PYTHONPATH:-""}"
|
||||
pypath="${python_packages_dir}/torch_mlir"
|
||||
|
|
Loading…
Reference in New Issue