[core][torch.compile] discard the compile for profiling (#7796)

This commit is contained in:
youkaichao
2024-08-26 21:33:58 -07:00
committed by GitHub
parent 39178c7fbc
commit 64cc644425
4 changed files with 43 additions and 2 deletions
+4
View File
@@ -1097,6 +1097,10 @@ class GPUModelRunnerBase(ModelRunnerBase[TModelInputForGPU]):
device=self.device)
self.execute_model(model_input, kv_caches, intermediate_tensors)
torch.cuda.synchronize()
# reset and discard the guard and compiled bytecode for profiling runs
torch._dynamo.reset()
return
def remove_all_loras(self):
+4
View File
@@ -143,6 +143,10 @@ class TPUWorker(LoraNotSupportedWorkerBase, LocalOrDistributedWorkerBase):
num_cpu_blocks = int(self.cache_config.swap_space_bytes //
block_size_bytes)
num_cpu_blocks = (num_cpu_blocks // 8) * 8 # Round down to 8.
# reset and discard the guard and compiled bytecode for profiling runs
torch._dynamo.reset()
return num_tpu_blocks, num_cpu_blocks
def initialize_cache(