MCPcopy Index your code
hub / github.com/NVIDIA/TensorRT-LLM / save_timing_cache

Method save_timing_cache

tensorrt_llm/builder.py:428–444  ·  view source on GitHub ↗

Serialize timing cache of given builder config to file specified by out_path return True if the cache is successfully serialized, False otherwise

(builder_config: BuilderConfig, out_path: str)

Source from the content-addressed store, hash-verified

426
427 @staticmethod
428 def save_timing_cache(builder_config: BuilderConfig, out_path: str) -> bool:
429 '''Serialize timing cache of given builder config to file specified by out_path
430 return True if the cache is successfully serialized, False otherwise
431 '''
432 cache = builder_config.trt_builder_config.get_timing_cache()
433 if cache is None:
434 logger.warning(
435 'No timing cache found in the given builder config, skip saving.'
436 )
437 return False
438 with cache.serialize() as buffer:
439 with open(out_path, "wb") as f:
440 f.write(buffer)
441 f.flush()
442 os.fsync(f)
443 logger.info(f'Timing cache serialized to {out_path}')
444 return True
445
446 @staticmethod
447 def save_config(builder_config: BuilderConfig, config_path: str):

Callers 5

build_bertFunction · 0.95
buildFunction · 0.95
buildFunction · 0.95
buildFunction · 0.95

Calls 3

warningMethod · 0.45
serializeMethod · 0.45
infoMethod · 0.45

Tested by 1