[None][fix] Fix tmp dir being deleted too early in unit test. (#10740)

Signed-off-by: Yukun He <23156053+hyukn@users.noreply.github.com>
This commit is contained in:
Yukun He 2026-01-17 13:49:10 +08:00 committed by GitHub
parent 56073f501a
commit 3d16daf696
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -738,6 +738,8 @@ def _distributed_worker_function(world_size, strategy):
runner = DistributedGemmRunner(prefer_tactics=prefer_tactics)
config = TuningConfig(distributed_tuning_strategy=strategy)
# Keep temp_dir in function scope to prevent premature garbage collection
temp_dir = None
if rank == 0:
temp_dir = tempfile.TemporaryDirectory()
# rank 0 should broadcast the cache path to all ranks
@ -782,6 +784,7 @@ def _distributed_worker_function(world_size, strategy):
else:
assert False, f"Unknown strategy: {strategy}"
dist.barrier()
return True