Skip to content

Commit 394d302

Browse files
committed
Create temp dir if not exist
Signed-off-by: Jay Gu <jagu@nvidia.com>
1 parent adb892d commit 394d302

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/cuda/tile/_compile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def compile_tile(pyfunc,
210210
_log_mlir(bytecode_buf)
211211

212212
if CUDA_TILE_DUMP_BYTECODE is not None:
213-
if not os.path.exists(CUDA_TILE_DUMP_BYTECODE):
213+
if not os.path.isdir(CUDA_TILE_DUMP_BYTECODE):
214214
os.makedirs(CUDA_TILE_DUMP_BYTECODE)
215215
base_filename = os.path.basename(func_ir.loc.filename.split(".")[0])
216216
path = os.path.join(CUDA_TILE_DUMP_BYTECODE,
@@ -224,7 +224,7 @@ def compile_tile(pyfunc,
224224
try:
225225
from cuda.tile_internal._internal_cext import bytecode_to_mlir_text
226226
mlir_text = bytecode_to_mlir_text(bytecode_buf)
227-
if not os.path.exists(CUDA_TILE_DUMP_TILEIR):
227+
if not os.path.isdir(CUDA_TILE_DUMP_TILEIR):
228228
os.makedirs(CUDA_TILE_DUMP_TILEIR)
229229
base_filename = os.path.basename(func_ir.loc.filename.split(".")[0])
230230
path = os.path.join(

src/cuda/tile/_context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def get_temp_dir_from_env() -> str:
6262
if dir == "":
6363
dir = tempfile.mkdtemp()
6464
atexit.register(_clean_tmp_dir, dir)
65+
if not os.path.isdir(dir):
66+
os.makedirs(dir)
6567
return dir
6668

6769

0 commit comments

Comments
 (0)