@@ -1568,7 +1568,7 @@ def _compile_consts(consts: bytes, platform: str) -> str:
15681568 pos += rc
15691569 return consts_o
15701570
1571- from filelock import FileLock
1571+ from torch . utils . _filelock import FileLock
15721572
15731573 lock_dir = get_lock_dir ()
15741574 lock = FileLock (os .path .join (lock_dir , key + ".lock" ), timeout = LOCK_TIMEOUT )
@@ -2003,7 +2003,7 @@ def load_async(
20032003 key , input_path = write (source_code , "cpp" , extra = vec_isa_cmd )
20042004
20052005 if key not in cls .cache :
2006- from filelock import FileLock
2006+ from torch . utils . _filelock import FileLock
20072007
20082008 lock_path = os .path .join (get_lock_dir (), key + ".lock" )
20092009 output_name , output_dir = get_name_and_dir_from_output_file_path (input_path )
@@ -2068,7 +2068,7 @@ def _worker_compile_cpp(
20682068 fb_input_path : str ,
20692069 fb_output_path : str ,
20702070) -> None :
2071- from filelock import FileLock
2071+ from torch . utils . _filelock import FileLock
20722072
20732073 with FileLock (lock_path , timeout = LOCK_TIMEOUT ):
20742074 binary_path = (
@@ -2646,10 +2646,11 @@ def build_standalone_runtime(cls) -> str:
26462646 afile = str (dirpath / "standalone_halide_runtime.a" )
26472647 sofile = str (dirpath / libname )
26482648 if not os .path .exists (donefile ):
2649- import filelock
26502649 import halide as hl # type: ignore[import-untyped,import-not-found]
26512650
2652- with filelock .FileLock (lockfile , LOCK_TIMEOUT ):
2651+ from torch .utils ._filelock import FileLock
2652+
2653+ with FileLock (lockfile , LOCK_TIMEOUT ):
26532654 if not os .path .exists (donefile ):
26542655 with open (hookfile , "w" ) as f :
26552656 if device_type == "cuda" :
@@ -2680,7 +2681,7 @@ def build_standalone_runtime(cls) -> str:
26802681
26812682
26822683def _worker_task_halide (lockfile : str , jobs : List [partial [Any ]]) -> None :
2683- from filelock import FileLock
2684+ from torch . utils . _filelock import FileLock
26842685
26852686 try :
26862687 with FileLock (lockfile , LOCK_TIMEOUT ):
@@ -3075,7 +3076,7 @@ def compile(
30753076 """
30763077 key , input_path = cls .write (source_code , dst_file_ext )
30773078 if key not in cls .cache :
3078- from filelock import FileLock
3079+ from torch . utils . _filelock import FileLock
30793080
30803081 lock_dir = get_lock_dir ()
30813082 lock = FileLock (os .path .join (lock_dir , key + ".lock" ), timeout = LOCK_TIMEOUT )
@@ -3166,7 +3167,7 @@ def compile(
31663167
31673168 key , input_path = cls .write (source_code , dst_file_ext )
31683169 if key not in cls .cache :
3169- from filelock import FileLock
3170+ from torch . utils . _filelock import FileLock
31703171
31713172 lock_dir = get_lock_dir ()
31723173 lock = FileLock (os .path .join (lock_dir , key + ".lock" ), timeout = LOCK_TIMEOUT )
0 commit comments