Skip to content

Commit

Permalink
Fix fromIntArrayRef call (llvm#1479)
Browse files Browse the repository at this point in the history
* Fix fromSymint call

* Update PyTorch requirement

* Re-enable LTC
  • Loading branch information
antoniojkim authored Oct 11, 2022
1 parent aefbf65 commit 3e08f5a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
9 changes: 4 additions & 5 deletions build_tools/python_deploy/build_linux_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function build_in_tree() {
-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="/main_checkout/torch-mlir/externals/llvm-external-projects/torch-mlir-dialects" \
-DLLVM_TARGETS_TO_BUILD=host \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DTORCH_MLIR_ENABLE_LTC=OFF \
-DTORCH_MLIR_ENABLE_LTC=ON \
-DTORCH_MLIR_USE_INSTALLED_PYTORCH="$torch_from_bin" \
-DTORCH_MLIR_SRC_PYTORCH_REPO=${TORCH_MLIR_SRC_PYTORCH_REPO} \
-DTORCH_MLIR_SRC_PYTORCH_BRANCH=${TORCH_MLIR_SRC_PYTORCH_BRANCH} \
Expand Down Expand Up @@ -256,9 +256,8 @@ function test_in_tree() {
echo ":::: Run TOSA e2e integration tests"
python -m e2e_testing.main --config=tosa -v

# XXX: Uncomment once LTC is enabled again.
# echo ":::: Run Lazy Tensor Core e2e integration tests"
# python -m e2e_testing.main --config=lazy_tensor_core -v
echo ":::: Run Lazy Tensor Core e2e integration tests"
python -m e2e_testing.main --config=lazy_tensor_core -v
}

function setup_venv() {
Expand Down Expand Up @@ -307,7 +306,7 @@ function build_out_of_tree() {
-DLLVM_DIR="/main_checkout/torch-mlir/llvm-build/lib/cmake/llvm/" \
-DMLIR_DIR="/main_checkout/torch-mlir/llvm-build/lib/cmake/mlir/" \
-DMLIR_ENABLE_BINDINGS_PYTHON=OFF \
-DTORCH_MLIR_ENABLE_LTC=OFF \
-DTORCH_MLIR_ENABLE_LTC=ON \
-DTORCH_MLIR_USE_INSTALLED_PYTORCH="$torch_from_bin" \
-DTORCH_MLIR_SRC_PYTORCH_REPO=${TORCH_MLIR_SRC_PYTORCH_REPO} \
-DTORCH_MLIR_SRC_PYTORCH_BRANCH=${TORCH_MLIR_SRC_PYTORCH_BRANCH} \
Expand Down
3 changes: 1 addition & 2 deletions e2e_testing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

# Available test configs.
from torch_mlir_e2e_test.configs import (
# XXX: Uncomment once LTC is enabled again.
# LazyTensorCoreTestConfig,
LazyTensorCoreTestConfig,
LinalgOnTensorsBackendTestConfig,
MhloBackendTestConfig,
NativeTorchTestConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ at::Tensor LazyNativeFunctions::empty_strided(
c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
TORCH_LAZY_FN_COUNTER("lazy::");
at::Tensor t = empty_symint(
c10::fromIntArrayRef(size),
c10::fromIntArrayRefSlow(size),
dtype, layout, device, pin_memory, c10::nullopt);
return t.as_strided(size, stride, /*storage_offset=*/0);
}
Expand All @@ -356,7 +356,7 @@ LazyNativeFunctions::fill_(at::Tensor& self, const at::Scalar& value) {
at::Tensor LazyNativeFunctions::_unsafe_view(
const at::Tensor& self, at::IntArrayRef size) {
TORCH_LAZY_FN_COUNTER("lazy::");
return LazyNativeFunctions::view_copy_symint(self, c10::fromIntArrayRef(size));
return LazyNativeFunctions::view_copy_symint(self, c10::fromIntArrayRefSlow(size));
}

// This is needed by the torch.tensor constructor.
Expand Down
4 changes: 1 addition & 3 deletions python/torch_mlir_e2e_test/configs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Also available under a BSD-style license. See LICENSE.

# XXX: Uncomment once LTC is enabled again.
# from .lazy_tensor_core import LazyTensorCoreTestConfig

from .lazy_tensor_core import LazyTensorCoreTestConfig
from .linalg_on_tensors_backend import LinalgOnTensorsBackendTestConfig
from .native_torch import NativeTorchTestConfig
from .torchscript import TorchScriptTestConfig
Expand Down
2 changes: 1 addition & 1 deletion pytorch-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
--pre
torch==1.14.0.dev20221010
torch==1.14.0.dev20221011
2 changes: 1 addition & 1 deletion pytorch-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
04f63b02a1336db038f4b09006401546f445e68f
027a1549b9838b5268d3bedc123b05314ec671ca
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
PACKAGE_VERSION = os.environ.get("TORCH_MLIR_PYTHON_PACKAGE_VERSION") or "0.0.1"

# If true, enable LTC build by default
TORCH_MLIR_ENABLE_LTC_DEFAULT = False
TORCH_MLIR_ENABLE_LTC_DEFAULT = True

# Build phase discovery is unreliable. Just tell it what phases to run.
class CustomBuild(_build):
Expand Down

0 comments on commit 3e08f5a

Please sign in to comment.