mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Revert "Defer loading hipify until it is needed (#160824)"
This reverts commit 403a3a393cda7e60f503f3b04b8805a845dcf45d.
Reverted https://github.com/pytorch/pytorch/pull/160824 on behalf of https://github.com/atalman due to Broke slow tests test_utils.py::TestHipifyTrie::test_special_char_export_trie_to_regex [GH job link](https://github.com/pytorch/pytorch/actions/runs/17387051351/job/49355619371) [HUD commit link](403a3a393c
) ([comment](https://github.com/pytorch/pytorch/pull/160824#issuecomment-3243281628))
This commit is contained in:
@ -172,20 +172,6 @@ class TestCompiledAutograd(TestCase):
|
||||
except subprocess.CalledProcessError as e:
|
||||
self.fail(f"Subprocess exited with return code: {e.returncode}")
|
||||
|
||||
def test_hipify_not_loaded_with_import_torch(self):
|
||||
script = """
|
||||
import torch
|
||||
assert globals().get("hipify", False) is False
|
||||
"""
|
||||
self.run_as_subprocess(script)
|
||||
|
||||
def test_hipify_not_loaded_with_import_cpp_extension(self):
|
||||
script = """
|
||||
import torch.utils.cpp_extension
|
||||
assert globals().get("hipify", False) is False
|
||||
"""
|
||||
self.run_as_subprocess(script)
|
||||
|
||||
def test_dynamo_flaky_segfault(self):
|
||||
script = """
|
||||
import torch
|
||||
|
@ -1507,8 +1507,7 @@ def _enable(
|
||||
else:
|
||||
# we need to import this, because user might not have imported it if they directly use this context manager
|
||||
# we need to lazily import it, because of circular dependencies
|
||||
if torch.cuda.is_available():
|
||||
from torch._inductor import cudagraph_trees # noqa: F401
|
||||
import torch._inductor.cudagraph_trees
|
||||
|
||||
(
|
||||
prior_compiler,
|
||||
|
@ -22,6 +22,8 @@ import torch
|
||||
import torch._appdirs
|
||||
from .file_baton import FileBaton
|
||||
from ._cpp_extension_versioner import ExtensionVersioner
|
||||
from .hipify import hipify_python
|
||||
from .hipify.hipify_python import GeneratedFileCleaner
|
||||
from typing import Optional, Union
|
||||
from typing_extensions import deprecated
|
||||
from torch.torch_version import TorchVersion, Version
|
||||
@ -1367,7 +1369,6 @@ def CUDAExtension(name, sources, *args, **kwargs):
|
||||
include_dirs = kwargs.get('include_dirs', [])
|
||||
|
||||
if IS_HIP_EXTENSION:
|
||||
from .hipify import hipify_python
|
||||
build_dir = os.getcwd()
|
||||
hipify_result = hipify_python.hipify(
|
||||
project_directory=build_dir,
|
||||
@ -2108,8 +2109,6 @@ def _jit_compile(name,
|
||||
if baton.try_acquire():
|
||||
try:
|
||||
if version != old_version:
|
||||
from .hipify import hipify_python
|
||||
from .hipify.hipify_python import GeneratedFileCleaner
|
||||
with GeneratedFileCleaner(keep_intermediates=keep_intermediates) as clean_ctx:
|
||||
if IS_HIP_EXTENSION and (with_cuda or with_cudnn):
|
||||
hipify_result = hipify_python.hipify(
|
||||
|
Reference in New Issue
Block a user