@@ -1568,7 +1568,7 @@ def _compile_consts(consts: bytes, platform: str) -> str:
1568
1568
pos += rc
1569
1569
return consts_o
1570
1570
1571
- from filelock import FileLock
1571
+ from torch . utils . _filelock import FileLock
1572
1572
1573
1573
lock_dir = get_lock_dir ()
1574
1574
lock = FileLock (os .path .join (lock_dir , key + ".lock" ), timeout = LOCK_TIMEOUT )
@@ -2003,7 +2003,7 @@ def load_async(
2003
2003
key , input_path = write (source_code , "cpp" , extra = vec_isa_cmd )
2004
2004
2005
2005
if key not in cls .cache :
2006
- from filelock import FileLock
2006
+ from torch . utils . _filelock import FileLock
2007
2007
2008
2008
lock_path = os .path .join (get_lock_dir (), key + ".lock" )
2009
2009
output_name , output_dir = get_name_and_dir_from_output_file_path (input_path )
@@ -2068,7 +2068,7 @@ def _worker_compile_cpp(
2068
2068
fb_input_path : str ,
2069
2069
fb_output_path : str ,
2070
2070
) -> None :
2071
- from filelock import FileLock
2071
+ from torch . utils . _filelock import FileLock
2072
2072
2073
2073
with FileLock (lock_path , timeout = LOCK_TIMEOUT ):
2074
2074
binary_path = (
@@ -2646,10 +2646,11 @@ def build_standalone_runtime(cls) -> str:
2646
2646
afile = str (dirpath / "standalone_halide_runtime.a" )
2647
2647
sofile = str (dirpath / libname )
2648
2648
if not os .path .exists (donefile ):
2649
- import filelock
2650
2649
import halide as hl # type: ignore[import-untyped,import-not-found]
2651
2650
2652
- with filelock .FileLock (lockfile , LOCK_TIMEOUT ):
2651
+ from torch .utils ._filelock import FileLock
2652
+
2653
+ with FileLock (lockfile , LOCK_TIMEOUT ):
2653
2654
if not os .path .exists (donefile ):
2654
2655
with open (hookfile , "w" ) as f :
2655
2656
if device_type == "cuda" :
@@ -2680,7 +2681,7 @@ def build_standalone_runtime(cls) -> str:
2680
2681
2681
2682
2682
2683
def _worker_task_halide (lockfile : str , jobs : List [partial [Any ]]) -> None :
2683
- from filelock import FileLock
2684
+ from torch . utils . _filelock import FileLock
2684
2685
2685
2686
try :
2686
2687
with FileLock (lockfile , LOCK_TIMEOUT ):
@@ -3075,7 +3076,7 @@ def compile(
3075
3076
"""
3076
3077
key , input_path = cls .write (source_code , dst_file_ext )
3077
3078
if key not in cls .cache :
3078
- from filelock import FileLock
3079
+ from torch . utils . _filelock import FileLock
3079
3080
3080
3081
lock_dir = get_lock_dir ()
3081
3082
lock = FileLock (os .path .join (lock_dir , key + ".lock" ), timeout = LOCK_TIMEOUT )
@@ -3166,7 +3167,7 @@ def compile(
3166
3167
3167
3168
key , input_path = cls .write (source_code , dst_file_ext )
3168
3169
if key not in cls .cache :
3169
- from filelock import FileLock
3170
+ from torch . utils . _filelock import FileLock
3170
3171
3171
3172
lock_dir = get_lock_dir ()
3172
3173
lock = FileLock (os .path .join (lock_dir , key + ".lock" ), timeout = LOCK_TIMEOUT )
0 commit comments