mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fix lint errors in fbcode (#135614)
Summary: Fixed a bunch of fbcode imports that happened to work but confused autodeps. After this autodeps still suggests "improvements" to TARGETS (which breaks our builds) but at least it can find all the imports. Test Plan: ``` fbpython fbcode/tools/build/buck/linters/lint_autoformat.py --linter=autodeps --default-exec-timeout=1800 -- fbcode/caffe2/TARGETS fbcode/caffe2/test/TARGETS ``` Before: ``` ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "test_export" (from caffe2/test/export/testing.py:229) when processing rule "test_export". Please make sure it's listed in the srcs parameter of another rule. See https://fbur$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "testing" (from caffe2/test/export/test_export.py:87) when processing rule "test_export". Please make sure it's listed in the srcs parameter of another rule. See https://fburl$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "test_export" (from caffe2/test/export/test_serdes.py:9) when processing rule "test_export". Please make sure it's listed in the srcs parameter of another rule. See https://fb$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "testing" (from caffe2/test/export/test_serdes.py:10) when processing rule "test_export". Please make sure it's listed in the srcs parameter of another rule. See https://fburl$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "testing" (from caffe2/test/export/test_retraceability.py:7) when processing rule "test_export". Please make sure it's listed in the srcs parameter of another rule. See https:$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "test_export" (from caffe2/test/export/test_retraceability.py:6) when processing rule "test_export". Please make sure it's listed in the srcs parameter of another rule. See ht$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "testing" (from caffe2/test/export/test_export_nonstrict.py:7) when processing rule "test_export". Please make sure it's listed in the srcs parameter of another rule. See http$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "test_export" (from caffe2/test/export/test_export_nonstrict.py:6) when processing rule "test_export". Please make sure it's listed in the srcs parameter of another rule. See $ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "test_export" (from caffe2/test/export/test_export_training_ir_to_run_decomp.py:8) when processing rule "test_export". Please make sure it's listed in the srcs parameter of an$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "testing" (from caffe2/test/export/test_export_training_ir_to_run_decomp.py:10) when processing rule "test_export". Please make sure it's listed in the srcs parameter of anoth$ ERROR while processing caffe2/test/TARGETS: Found "//python/typeshed_internal:typeshed_internal_library" owner for "cv2" but it is protected by visibility rules: [] (from caffe2/test/test_bundled_images.py:7) when processing rule "test_bundled_$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "caffe2.test.profiler_test_cpp_thread_lib" (from caffe2/test/profiler/test_cpp_thread.py:29) when processing rule "profiler_test_cpp_thread". Please make sure it's listed in t$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "torch._utils_internal.get_file_path_2" (from caffe2/test/test_custom_ops.py:23) when processing rule "custom_ops". Please make sure it's listed in the srcs parameter of anoth$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "torch._utils_internal.get_file_path_2" (from caffe2/test/test_public_bindings.py:13) when processing rule "public_bindings". Please make sure it's listed in the srcs paramete$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "torch._C._profiler.symbolize_tracebacks" (from caffe2/test/test_cuda.py:3348) when processing rule "test_cuda". Please make sure it's listed in the srcs parameter of another $ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for "torch._C._profiler.gather_traceback" (from caffe2/test/test_cuda.py:3348) when processing rule "test_cuda". Please make sure it's listed in the srcs parameter of another rule$ ERROR while processing caffe2/test/TARGETS: Cannot find an owner for include <torch/csrc/autograd/profiler_kineto.h> (from caffe2/test/profiler/test_cpp_thread.cpp:2) when processing profiler_test_cpp_thread_lib. Some things to try: ``` Differential Revision: D62049222 Pull Request resolved: https://github.com/pytorch/pytorch/pull/135614 Approved by: https://github.com/oulgen, https://github.com/laithsakka
This commit is contained in:
parent
bf68e16e94
commit
8c356ce3da
|
|
@ -84,7 +84,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from . import testing
|
from . import testing
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import testing
|
import testing # @manual=fbcode//caffe2/test:test_export-library
|
||||||
# The following import pattern matters as `test_export.export` is patched
|
# The following import pattern matters as `test_export.export` is patched
|
||||||
# in other files (like test_export_nonstrict.py). `torch.export.export`
|
# in other files (like test_export_nonstrict.py). `torch.export.export`
|
||||||
# will invalidate the patch.
|
# will invalidate the patch.
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
try:
|
try:
|
||||||
from . import test_export, testing
|
from . import test_export, testing
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_export
|
import test_export # @manual=fbcode//caffe2/test:test_export-library
|
||||||
import testing
|
import testing # @manual=fbcode//caffe2/test:test_export-library
|
||||||
|
|
||||||
from torch.export import export
|
from torch.export import export
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ import torch
|
||||||
try:
|
try:
|
||||||
from . import test_export, testing
|
from . import test_export, testing
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_export
|
import test_export # @manual=fbcode//caffe2/test:test_export-library
|
||||||
|
|
||||||
import testing
|
import testing # @manual=fbcode//caffe2/test:test_export-library
|
||||||
|
|
||||||
|
|
||||||
test_classes = {}
|
test_classes = {}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
try:
|
try:
|
||||||
from . import test_export, testing
|
from . import test_export, testing
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_export
|
import test_export # @manual=fbcode//caffe2/test:test_export-library
|
||||||
import testing
|
import testing # @manual=fbcode//caffe2/test:test_export-library
|
||||||
|
|
||||||
from torch.export import export
|
from torch.export import export
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import io
|
||||||
try:
|
try:
|
||||||
from . import test_export, testing
|
from . import test_export, testing
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_export
|
import test_export # @manual=fbcode//caffe2/test:test_export-library
|
||||||
import testing
|
import testing # @manual=fbcode//caffe2/test:test_export-library
|
||||||
|
|
||||||
from torch.export import export, load, save
|
from torch.export import export, load, save
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ def _make_fn_with_mocked_export(fn, mocked_export_fn):
|
||||||
try:
|
try:
|
||||||
from . import test_export
|
from . import test_export
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_export
|
import test_export # @manual=fbcode//caffe2/test:test_export-library
|
||||||
|
|
||||||
with patch(f"{test_export.__name__}.export", mocked_export_fn):
|
with patch(f"{test_export.__name__}.export", mocked_export_fn):
|
||||||
return fn(*args, **kwargs)
|
return fn(*args, **kwargs)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include <torch/csrc/api/include/torch/types.h>
|
#include <torch/csrc/api/include/torch/types.h> // @manual=fbcode//caffe2:libtorch
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ from torch.utils import _pytree as pytree
|
||||||
|
|
||||||
|
|
||||||
if HAS_CUDA:
|
if HAS_CUDA:
|
||||||
import triton
|
import triton # @manual
|
||||||
|
|
||||||
from torch.testing._internal.triton_utils import (
|
from torch.testing._internal.triton_utils import (
|
||||||
add_kernel,
|
add_kernel,
|
||||||
|
|
@ -76,14 +76,20 @@ try:
|
||||||
)
|
)
|
||||||
from .test_torchinductor import copy_tests, requires_multigpu, TestFailure
|
from .test_torchinductor import copy_tests, requires_multigpu, TestFailure
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test_aot_inductor_utils import AOTIRunnerUtil
|
from test_aot_inductor_utils import (
|
||||||
from test_control_flow import (
|
AOTIRunnerUtil, # @manual=fbcode//caffe2/test/inductor:aot_inductor_utils-library
|
||||||
|
)
|
||||||
|
from test_control_flow import ( # @manual=fbcode//caffe2/test/inductor:control_flow-library
|
||||||
CondModels,
|
CondModels,
|
||||||
prepend_counters,
|
prepend_counters,
|
||||||
prepend_predicates,
|
prepend_predicates,
|
||||||
WhileLoopModels,
|
WhileLoopModels,
|
||||||
)
|
)
|
||||||
from test_torchinductor import copy_tests, requires_multigpu, TestFailure
|
from test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
copy_tests,
|
||||||
|
requires_multigpu,
|
||||||
|
TestFailure,
|
||||||
|
)
|
||||||
except (unittest.SkipTest, ImportError) as e:
|
except (unittest.SkipTest, ImportError) as e:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class AOTIRunnerUtil:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load_runner(device, so_path):
|
def load_runner(device, so_path):
|
||||||
if IS_FBCODE:
|
if IS_FBCODE:
|
||||||
from .fb import test_aot_inductor_model_runner_pybind
|
from .fb import test_aot_inductor_model_runner_pybind # @manual
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
# copy *.so file to a unique path just before loading
|
# copy *.so file to a unique path just before loading
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,11 @@ sys.path.append(pytorch_test_dir)
|
||||||
import contextlib
|
import contextlib
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from inductor.test_torchinductor import check_model, check_model_cuda, copy_tests
|
from inductor.test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
check_model,
|
||||||
|
check_model_cuda,
|
||||||
|
copy_tests,
|
||||||
|
)
|
||||||
from torch._inductor import config
|
from torch._inductor import config
|
||||||
from torch._inductor.scheduler import Scheduler
|
from torch._inductor.scheduler import Scheduler
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,14 @@ from torch.testing._internal.common_cuda import TEST_CUDNN
|
||||||
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
sys.path.append(pytorch_test_dir)
|
sys.path.append(pytorch_test_dir)
|
||||||
|
|
||||||
from inductor.test_inductor_freezing import TestCase
|
from inductor.test_inductor_freezing import (
|
||||||
from inductor.test_torchinductor import check_model, check_model_gpu, copy_tests
|
TestCase, # @manual=fbcode//caffe2/test/inductor:inductor_freezing-library
|
||||||
|
)
|
||||||
|
from inductor.test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
check_model,
|
||||||
|
check_model_gpu,
|
||||||
|
copy_tests,
|
||||||
|
)
|
||||||
from torch.testing._internal.common_utils import TEST_WITH_ASAN
|
from torch.testing._internal.common_utils import TEST_WITH_ASAN
|
||||||
from torch.testing._internal.inductor_utils import skipCUDAIf
|
from torch.testing._internal.inductor_utils import skipCUDAIf
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class TestCKBackend(TestCase):
|
||||||
|
|
||||||
torch.random.manual_seed(1234)
|
torch.random.manual_seed(1234)
|
||||||
try:
|
try:
|
||||||
import ck4inductor
|
import ck4inductor # @manual
|
||||||
|
|
||||||
self.ck_dir = os.path.dirname(ck4inductor.__file__)
|
self.ck_dir = os.path.dirname(ck4inductor.__file__)
|
||||||
os.environ["TORCHINDUCTOR_CK_DIR"] = self.ck_dir
|
os.environ["TORCHINDUCTOR_CK_DIR"] = self.ck_dir
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,10 @@ try:
|
||||||
try:
|
try:
|
||||||
from .test_torchinductor import check_model, check_model_cuda
|
from .test_torchinductor import check_model, check_model_cuda
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test_torchinductor import check_model, check_model_cuda
|
from test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
check_model,
|
||||||
|
check_model_cuda,
|
||||||
|
)
|
||||||
except (unittest.SkipTest, ImportError) as e:
|
except (unittest.SkipTest, ImportError) as e:
|
||||||
sys.stderr.write(f"{type(e)}: {e}\n")
|
sys.stderr.write(f"{type(e)}: {e}\n")
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,10 @@ try:
|
||||||
try:
|
try:
|
||||||
from .test_torchinductor import check_model, check_model_gpu
|
from .test_torchinductor import check_model, check_model_gpu
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test_torchinductor import check_model, check_model_gpu
|
from test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
check_model,
|
||||||
|
check_model_gpu,
|
||||||
|
)
|
||||||
except (unittest.SkipTest, ImportError) as e:
|
except (unittest.SkipTest, ImportError) as e:
|
||||||
sys.stderr.write(f"{type(e)}: {e}\n")
|
sys.stderr.write(f"{type(e)}: {e}\n")
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
@ -835,7 +838,7 @@ class CompiledOptimizerTests(TestCase):
|
||||||
try:
|
try:
|
||||||
from . import s429861_repro
|
from . import s429861_repro
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import s429861_repro
|
import s429861_repro # @manual
|
||||||
|
|
||||||
forward = s429861_repro.forward
|
forward = s429861_repro.forward
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ from torch.testing._internal.inductor_utils import GPU_TYPE, HAS_GPU
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import triton
|
import triton # @manual
|
||||||
except ImportError:
|
except ImportError:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ try:
|
||||||
test_torchinductor_dynamic_shapes,
|
test_torchinductor_dynamic_shapes,
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_cpu_repro
|
import test_cpu_repro # @manual=fbcode//caffe2/test/inductor:test_cpu_repro-library
|
||||||
import test_cpu_select_algorithm
|
import test_cpu_select_algorithm # @manual=fbcode//caffe2/test/inductor:cpu_select_algorithm_cpu-library
|
||||||
import test_mkldnn_pattern_matcher
|
import test_mkldnn_pattern_matcher # @manual
|
||||||
import test_torchinductor
|
import test_torchinductor # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
import test_torchinductor_dynamic_shapes
|
import test_torchinductor_dynamic_shapes # @manual=fbcode//caffe2/test/inductor:test_inductor-library_dynamic_shapes
|
||||||
except unittest.SkipTest:
|
except unittest.SkipTest:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ try:
|
||||||
try:
|
try:
|
||||||
from . import test_torchinductor
|
from . import test_torchinductor
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_torchinductor
|
import test_torchinductor # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
except unittest.SkipTest:
|
except unittest.SkipTest:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ try:
|
||||||
try:
|
try:
|
||||||
from . import test_cpu_repro, test_torchinductor
|
from . import test_cpu_repro, test_torchinductor
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_cpu_repro
|
import test_cpu_repro # @manual=fbcode//caffe2/test/inductor:test_cpu_repro-library
|
||||||
import test_torchinductor
|
import test_torchinductor # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
except unittest.SkipTest:
|
except unittest.SkipTest:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,11 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_combo_kernels
|
import test_combo_kernels
|
||||||
|
|
||||||
import test_foreach
|
import test_foreach # @manual=fbcode//caffe2/test/inductor:foreach-library
|
||||||
import test_pattern_matcher
|
import test_pattern_matcher # @manual=fbcode//caffe2/test/inductor:pattern_matcher-library
|
||||||
import test_select_algorithm
|
import test_select_algorithm # @manual=fbcode//caffe2/test/inductor:select_algorithm-library
|
||||||
import test_torchinductor
|
import test_torchinductor # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
import test_torchinductor_dynamic_shapes
|
import test_torchinductor_dynamic_shapes # @manual=fbcode//caffe2/test/inductor:test_inductor-library_dynamic_shapes
|
||||||
except unittest.SkipTest:
|
except unittest.SkipTest:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -38,15 +38,15 @@ from torch.testing._internal.inductor_utils import skipCUDAIf
|
||||||
|
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
import triton
|
import triton # @manual
|
||||||
from triton import language as tl
|
from triton import language as tl # @manual
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise unittest.SkipTest("requires triton") # noqa: B904
|
raise unittest.SkipTest("requires triton") # noqa: B904
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from . import test_torchinductor
|
from . import test_torchinductor
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_torchinductor
|
import test_torchinductor # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
except unittest.SkipTest:
|
except unittest.SkipTest:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,14 @@ if HAS_CUDA and not TEST_WITH_ASAN:
|
||||||
try:
|
try:
|
||||||
from .test_cudagraph_trees import CudaGraphTreeTests
|
from .test_cudagraph_trees import CudaGraphTreeTests
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test_cudagraph_trees import CudaGraphTreeTests # noqa: F401
|
from test_cudagraph_trees import ( # noqa: F401 # @manual=fbcode//caffe2/test/inductor:cudagraph_trees-library
|
||||||
|
CudaGraphTreeTests,
|
||||||
|
)
|
||||||
|
|
||||||
REPO_ROOT = pathlib.Path(__file__).resolve().parent.parent.parent
|
REPO_ROOT = pathlib.Path(__file__).resolve().parent.parent.parent
|
||||||
|
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
from tools.stats.import_test_stats import get_disabled_tests
|
from tools.stats.import_test_stats import get_disabled_tests # @manual
|
||||||
|
|
||||||
|
|
||||||
# Make sure to remove REPO_ROOT after import is done
|
# Make sure to remove REPO_ROOT after import is done
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ try:
|
||||||
try:
|
try:
|
||||||
from . import test_torchinductor
|
from . import test_torchinductor
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_torchinductor
|
import test_torchinductor # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
except unittest.SkipTest:
|
except unittest.SkipTest:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ from torch.testing._internal.inductor_utils import HAS_CPU, HAS_CUDA
|
||||||
importlib.import_module("functorch")
|
importlib.import_module("functorch")
|
||||||
importlib.import_module("filelock")
|
importlib.import_module("filelock")
|
||||||
|
|
||||||
from inductor.test_torchinductor import copy_tests
|
from inductor.test_torchinductor import (
|
||||||
|
copy_tests, # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ConvOp(nn.Module):
|
class ConvOp(nn.Module):
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ from torch._C import FileCheck
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from extension_backends.cpp.extension_codegen_backend import (
|
from extension_backends.cpp.extension_codegen_backend import ( # @manual=fbcode//caffe2/test/inductor/extension_backends:extension_codegen_backend # noqa: B950
|
||||||
ExtensionCppWrapperCodegen,
|
ExtensionCppWrapperCodegen,
|
||||||
ExtensionScheduling,
|
ExtensionScheduling,
|
||||||
ExtensionWrapperCodegen,
|
ExtensionWrapperCodegen,
|
||||||
|
|
@ -38,7 +38,7 @@ try:
|
||||||
try:
|
try:
|
||||||
from . import test_torchinductor
|
from . import test_torchinductor
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_torchinductor
|
import test_torchinductor # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
except unittest.SkipTest:
|
except unittest.SkipTest:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@ try:
|
||||||
try:
|
try:
|
||||||
from .test_torchinductor import check_model, check_model_cuda
|
from .test_torchinductor import check_model, check_model_cuda
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test_torchinductor import check_model, check_model_cuda
|
from test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
check_model,
|
||||||
|
check_model_cuda,
|
||||||
|
)
|
||||||
except (unittest.SkipTest, ImportError) as e:
|
except (unittest.SkipTest, ImportError) as e:
|
||||||
sys.stderr.write(f"{type(e)}: {e}\n")
|
sys.stderr.write(f"{type(e)}: {e}\n")
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ if IS_WINDOWS and IS_CI:
|
||||||
raise unittest.SkipTest("requires sympy/functorch/filelock")
|
raise unittest.SkipTest("requires sympy/functorch/filelock")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import halide
|
import halide # @manual
|
||||||
|
|
||||||
HAS_HALIDE = halide is not None
|
HAS_HALIDE = halide is not None
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
@ -37,7 +37,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from . import test_torchinductor
|
from . import test_torchinductor
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_torchinductor
|
import test_torchinductor # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
|
||||||
|
|
||||||
make_halide = config.patch(
|
make_halide = config.patch(
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,11 @@ from torch.testing._internal.common_utils import skipIfRocm
|
||||||
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
sys.path.append(pytorch_test_dir)
|
sys.path.append(pytorch_test_dir)
|
||||||
|
|
||||||
from inductor.test_torchinductor import check_model, check_model_cuda, copy_tests
|
from inductor.test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
check_model,
|
||||||
|
check_model_cuda,
|
||||||
|
copy_tests,
|
||||||
|
)
|
||||||
from torch.testing._internal.common_utils import TEST_WITH_ASAN, TEST_WITH_ROCM
|
from torch.testing._internal.common_utils import TEST_WITH_ASAN, TEST_WITH_ROCM
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ def sin_cos(x: torch.Tensor, out_sin: torch.Tensor, out_cos: torch.Tensor) -> No
|
||||||
|
|
||||||
|
|
||||||
if HAS_GPU:
|
if HAS_GPU:
|
||||||
import triton
|
import triton # @manual
|
||||||
import triton.language as tl
|
import triton.language as tl # @manual
|
||||||
|
|
||||||
@triton.jit
|
@triton.jit
|
||||||
def sin_kernel(
|
def sin_kernel(
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,9 @@ class TestMemoryPlanning(TestCase):
|
||||||
try:
|
try:
|
||||||
from .test_aot_inductor import AOTIRunnerUtil
|
from .test_aot_inductor import AOTIRunnerUtil
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test_aot_inductor import AOTIRunnerUtil
|
from test_aot_inductor import (
|
||||||
|
AOTIRunnerUtil, # @manual=fbcode//caffe2/test/inductor:test_aot_inductor-library
|
||||||
|
)
|
||||||
|
|
||||||
f, args = self._generate(device="cuda")
|
f, args = self._generate(device="cuda")
|
||||||
dim0_x = Dim("dim0_x", min=1, max=2048)
|
dim0_x = Dim("dim0_x", min=1, max=2048)
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ from torch.testing._internal.triton_utils import HAS_CUDA, requires_cuda
|
||||||
|
|
||||||
|
|
||||||
if HAS_CUDA:
|
if HAS_CUDA:
|
||||||
import triton
|
import triton # @manual
|
||||||
import triton.language as tl
|
import triton.language as tl # @manual
|
||||||
|
|
||||||
from torch.testing._internal.triton_utils import add_kernel
|
from torch.testing._internal.triton_utils import add_kernel
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ class DynamoProfilerTests(torch._inductor.test_case.TestCase):
|
||||||
|
|
||||||
@unittest.skipIf(not HAS_TRITON, "requires cuda & triton")
|
@unittest.skipIf(not HAS_TRITON, "requires cuda & triton")
|
||||||
def test_inductor_profiling_triton_hooks(self):
|
def test_inductor_profiling_triton_hooks(self):
|
||||||
from triton.compiler import CompiledKernel
|
from triton.compiler import CompiledKernel # @manual
|
||||||
|
|
||||||
hooks_called = {"enter": False, "exit": False}
|
hooks_called = {"enter": False, "exit": False}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,14 @@ importlib.import_module("filelock")
|
||||||
# Make the helper files in test/ importable
|
# Make the helper files in test/ importable
|
||||||
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
sys.path.append(pytorch_test_dir)
|
sys.path.append(pytorch_test_dir)
|
||||||
from inductor.test_torchinductor import (
|
from inductor.test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
CommonTemplate,
|
CommonTemplate,
|
||||||
copy_tests,
|
copy_tests,
|
||||||
run_and_get_cpp_code,
|
run_and_get_cpp_code,
|
||||||
run_and_get_triton_code,
|
run_and_get_triton_code,
|
||||||
TestFailure,
|
TestFailure,
|
||||||
)
|
)
|
||||||
from inductor.test_torchinductor_dynamic_shapes import (
|
from inductor.test_torchinductor_dynamic_shapes import ( # @manual
|
||||||
make_dynamic_cls,
|
make_dynamic_cls,
|
||||||
test_failures as dynamic_shapes_test_failures,
|
test_failures as dynamic_shapes_test_failures,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ from torch.testing._internal.inductor_utils import GPU_TYPE, HAS_CPU, HAS_GPU
|
||||||
# Make the helper files in test/ importable
|
# Make the helper files in test/ importable
|
||||||
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
sys.path.append(pytorch_test_dir)
|
sys.path.append(pytorch_test_dir)
|
||||||
from inductor.test_torchinductor import (
|
from inductor.test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
check_model,
|
check_model,
|
||||||
check_model_gpu,
|
check_model_gpu,
|
||||||
CommonTemplate,
|
CommonTemplate,
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,10 @@ try:
|
||||||
try:
|
try:
|
||||||
from .test_torchinductor import check_model, check_model_gpu
|
from .test_torchinductor import check_model, check_model_gpu
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test_torchinductor import check_model, check_model_gpu
|
from test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
check_model,
|
||||||
|
check_model_gpu,
|
||||||
|
)
|
||||||
except (unittest.SkipTest, ImportError) as e:
|
except (unittest.SkipTest, ImportError) as e:
|
||||||
sys.stderr.write(f"{type(e)}: {e}\n")
|
sys.stderr.write(f"{type(e)}: {e}\n")
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,10 @@ import torch.utils.cpp_extension
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from extension_backends.triton.device_interface import DeviceInterface
|
from extension_backends.triton.device_interface import (
|
||||||
from extension_backends.triton.extension_codegen_backend import (
|
DeviceInterface, # @manual=fbcode//caffe2/test/inductor/extension_backends:extension_codegen_backend
|
||||||
|
)
|
||||||
|
from extension_backends.triton.extension_codegen_backend import ( # @manual=fbcode//caffe2/test/inductor/extension_backends:extension_codegen_backend # noqa: B950
|
||||||
CPUDeviceOpOverrides,
|
CPUDeviceOpOverrides,
|
||||||
ExtensionScheduling,
|
ExtensionScheduling,
|
||||||
ExtensionWrapperCodegen,
|
ExtensionWrapperCodegen,
|
||||||
|
|
@ -41,7 +43,7 @@ try:
|
||||||
try:
|
try:
|
||||||
from . import test_torchinductor
|
from . import test_torchinductor
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import test_torchinductor
|
import test_torchinductor # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
except unittest.SkipTest:
|
except unittest.SkipTest:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ from torch.testing._internal.inductor_utils import GPU_TYPE, HAS_GPU
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import triton # noqa: F401
|
import triton # noqa: F401 # @manual
|
||||||
import triton.language as tl
|
import triton.language as tl # @manual
|
||||||
except ImportError:
|
except ImportError:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
@ -88,7 +88,7 @@ class TestTritonHeuristics(TestCase):
|
||||||
self._test_artificial_zgrid()
|
self._test_artificial_zgrid()
|
||||||
|
|
||||||
def _get_cos_kernel_caching_autotuner_args(self):
|
def _get_cos_kernel_caching_autotuner_args(self):
|
||||||
from triton.compiler.compiler import AttrsDescriptor
|
from triton.compiler.compiler import AttrsDescriptor # @manual
|
||||||
|
|
||||||
@triton.jit
|
@triton.jit
|
||||||
def triton_(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
|
def triton_(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,12 @@ if HAS_GPU:
|
||||||
|
|
||||||
if not TEST_WITH_ROCM:
|
if not TEST_WITH_ROCM:
|
||||||
if HAS_CUDA:
|
if HAS_CUDA:
|
||||||
from triton.language.extra.cuda.libdevice import (
|
from triton.language.extra.cuda.libdevice import ( # @manual
|
||||||
fast_dividef,
|
fast_dividef,
|
||||||
fast_dividef as my_fast_dividef,
|
fast_dividef as my_fast_dividef,
|
||||||
)
|
)
|
||||||
elif HAS_XPU:
|
elif HAS_XPU:
|
||||||
from triton.language.extra.intel.libdevice import (
|
from triton.language.extra.intel.libdevice import ( # @manual
|
||||||
fast_dividef,
|
fast_dividef,
|
||||||
fast_dividef as my_fast_dividef,
|
fast_dividef as my_fast_dividef,
|
||||||
)
|
)
|
||||||
|
|
@ -2543,8 +2543,8 @@ class CustomOpTests(torch._inductor.test_case.TestCase):
|
||||||
|
|
||||||
@requires_gpu
|
@requires_gpu
|
||||||
def test_capture_triton_disabled_in_triton_op(self):
|
def test_capture_triton_disabled_in_triton_op(self):
|
||||||
import triton
|
import triton # @manual
|
||||||
import triton.language as tl
|
import triton.language as tl # @manual
|
||||||
|
|
||||||
@triton.jit
|
@triton.jit
|
||||||
def add_kernel(
|
def add_kernel(
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,10 @@ importlib.import_module("filelock")
|
||||||
|
|
||||||
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
sys.path.append(pytorch_test_dir)
|
sys.path.append(pytorch_test_dir)
|
||||||
from inductor.test_torchinductor import check_model_gpu, TestCase
|
from inductor.test_torchinductor import ( # @manual=fbcode//caffe2/test/inductor:test_inductor-library
|
||||||
|
check_model_gpu,
|
||||||
|
TestCase,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# TODO: Remove this file.
|
# TODO: Remove this file.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include <torch/csrc/autograd/profiler_kineto.h>
|
#include <torch/csrc/autograd/profiler_kineto.h> // @manual
|
||||||
#include <torch/torch.h>
|
#include <torch/torch.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ def is_fbcode():
|
||||||
|
|
||||||
|
|
||||||
if is_fbcode():
|
if is_fbcode():
|
||||||
import caffe2.test.profiler_test_cpp_thread_lib as cpp
|
import caffe2.test.profiler_test_cpp_thread_lib as cpp # @manual=//caffe2/test:profiler_test_cpp_thread_lib
|
||||||
else:
|
else:
|
||||||
# cpp extensions use relative paths. Those paths are relative to
|
# cpp extensions use relative paths. Those paths are relative to
|
||||||
# this file, so we'll change the working directory temporarily
|
# this file, so we'll change the working directory temporarily
|
||||||
|
|
|
||||||
0
test/profiler/test_cpp_thread_lib.pyi
Normal file
0
test/profiler/test_cpp_thread_lib.pyi
Normal file
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import io
|
import io
|
||||||
|
|
||||||
import cv2
|
import cv2 # @manual
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.utils.bundled_inputs
|
import torch.utils.bundled_inputs
|
||||||
|
|
|
||||||
|
|
@ -3345,7 +3345,7 @@ class TestCudaMallocAsync(TestCase):
|
||||||
|
|
||||||
@unittest.skipIf(IS_ARM64 or not IS_LINUX, "x86 linux only cpp unwinding")
|
@unittest.skipIf(IS_ARM64 or not IS_LINUX, "x86 linux only cpp unwinding")
|
||||||
def test_direct_traceback(self):
|
def test_direct_traceback(self):
|
||||||
from torch._C._profiler import gather_traceback, symbolize_tracebacks
|
from torch._C._profiler import gather_traceback, symbolize_tracebacks # @manual
|
||||||
|
|
||||||
c = gather_traceback(True, True, True)
|
c = gather_traceback(True, True, True)
|
||||||
(r,) = symbolize_tracebacks([c])
|
(r,) = symbolize_tracebacks([c])
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ from functorch import make_fx
|
||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
from torch._custom_op.impl import CustomOp, infer_schema
|
from torch._custom_op.impl import CustomOp, infer_schema
|
||||||
from torch._library.infer_schema import tuple_to_list
|
from torch._library.infer_schema import tuple_to_list
|
||||||
from torch._utils_internal import get_file_path_2
|
from torch._utils_internal import get_file_path_2 # @manual
|
||||||
from torch.testing._internal import custom_op_db
|
from torch.testing._internal import custom_op_db
|
||||||
from torch.testing._internal.common_cuda import TEST_CUDA
|
from torch.testing._internal.common_cuda import TEST_CUDA
|
||||||
from torch.testing._internal.common_device_type import (
|
from torch.testing._internal.common_device_type import (
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import unittest
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch._utils_internal import get_file_path_2
|
from torch._utils_internal import get_file_path_2 # @manual
|
||||||
from torch.testing._internal.common_utils import (
|
from torch.testing._internal.common_utils import (
|
||||||
IS_JETSON,
|
IS_JETSON,
|
||||||
IS_MACOS,
|
IS_MACOS,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user