From 1bb68271b7ff1b582845384c6c7f7b1593ae1619 Mon Sep 17 00:00:00 2001 From: Nikita Shulga Date: Fri, 3 Oct 2025 07:41:32 -0700 Subject: [PATCH] Stop building nativert in OSS (#164463) Pull Request resolved: https://github.com/pytorch/pytorch/pull/164463 Approved by: https://github.com/albanD, https://github.com/Skylion007 --- caffe2/CMakeLists.txt | 16 +++++++++------- test/export/test_nativert.py | 15 ++++++++------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt index 10191edee9cd..9f929150de4a 100644 --- a/caffe2/CMakeLists.txt +++ b/caffe2/CMakeLists.txt @@ -556,12 +556,13 @@ if(USE_CUDA OR USE_ROCM) append_filelist("libtorch_cuda_core_sources" Caffe2_GPU_HIP_JIT_FUSERS_SRCS) endif() -if(USE_CUDA) - append_filelist("libtorch_nativert_cuda_sources" Caffe2_GPU_SRCS) -endif() -if(USE_ROCM) - append_filelist("libtorch_nativert_cuda_sources" Caffe2_HIP_SRCS) -endif() +# NativeRT is disabled +# if(USE_CUDA) +# append_filelist("libtorch_nativert_cuda_sources" Caffe2_GPU_SRCS) +# endif() +# if(USE_ROCM) +# append_filelist("libtorch_nativert_cuda_sources" Caffe2_HIP_SRCS) +# endif() if(USE_CUDA) list(APPEND Caffe2_GPU_CU_SRCS ${Caffe2_GPU_HIP_JIT_FUSERS_SRCS}) @@ -1360,7 +1361,8 @@ if(BUILD_TEST) ) else() add_subdirectory(${TORCH_ROOT}/test/cpp/jit ${CMAKE_BINARY_DIR}/test_jit) - add_subdirectory(${TORCH_ROOT}/test/cpp/nativert ${CMAKE_BINARY_DIR}/test_nativert) + # NativeRT is disabled + # add_subdirectory(${TORCH_ROOT}/test/cpp/nativert ${CMAKE_BINARY_DIR}/test_nativert) add_subdirectory(${TORCH_ROOT}/test/inductor ${CMAKE_BINARY_DIR}/test_inductor) if(USE_DISTRIBUTED) add_subdirectory(${TORCH_ROOT}/test/cpp/c10d ${CMAKE_BINARY_DIR}/test_cpp_c10d) diff --git a/test/export/test_nativert.py b/test/export/test_nativert.py index 9c6fe59907c0..20c5d1ca562c 100644 --- a/test/export/test_nativert.py +++ b/test/export/test_nativert.py @@ -12,6 +12,7 @@ import torch import torch._dynamo as torchdynamo from torch._C._nativert import PyModelRunner from torch._dynamo.test_case import TestCase +from torch._environment import is_fbcode from torch._subclasses.fake_tensor import FakeTensor from torch.nativert.backends._lower_utils import ( lower_exported_program, @@ -197,6 +198,7 @@ def make_dynamic_cls(cls, strict=False): @unittest.skipIf(IS_WINDOWS, "Windows isn't supported for this case") @unittest.skipIf(not torchdynamo.is_dynamo_supported(), "dynamo isn't support") +@unittest.skipIf(not is_fbcode(), "FBcode only for now") class TestNativeRT(TestCase): @staticmethod def get_module(): @@ -342,13 +344,12 @@ class TestNativeRT(TestCase): pathlib.Path(filename).unlink(missing_ok=True) -tests = [ - test_export.TestExport, -] -for test in tests: - make_dynamic_cls(test, strict=True) - make_dynamic_cls(test, strict=False) -del test +if is_fbcode(): + for test in [test_export.TestExport]: + make_dynamic_cls(test, strict=True) + make_dynamic_cls(test, strict=False) + del test + if __name__ == "__main__": from torch._dynamo.test_case import run_tests