NVIDIA / NVIDIA/TensorRT

Effect of Caching .timing File on Engine Rebuild

Open
#4,798 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Module:Engine Build
Dominant language
C++
Stars
13.4k
Forks
2.4k
Avg merge
5d 3h
Merged PRs (30d)
2

Description

Environment

Component Version
TensorRT 10.13.3 (CUDA 12.9)
ONNX Runtime 1.22.0
CUDA driver 575.57.08
GPU Tesla T4 (sm75, Turing)
OS Linux (Ubuntu)

Description

When deleting a cached .engine file (1.7GB) and rebuilding it using the same .timing file (with trt_timing_cache_enable=True, trt_force_timing_cache=True), the rebuilt engine produces non-bitwise-identical inference results compared to the original engine.

I would expect that if the timing cache records which tactic was selected for every layer, rebuilding from the same cache should replay those choices and produce the same compiled engine, and therefore bitwise-identical outputs (I am using FP16 outputs).

For a segmentation model measured across 100 cases, comparing original-engine run vs rebuild-from-same-timing file:
0/100 files are bitwise identical
mask probability scores differ for ~93% of masks
Score delta: median ~7×10⁻⁵, mean ~3×10⁻³, max ~0.57
~30% of segmentation masks differ by boundary voxels (Dice still ≥ 0.96)

For comparison, a smaller detection model (137 MB engine) does produce bitwise-identical inference results after the same delete-rebuild procedure on the same 100 cases.
Does this suggests that the issue may be related to timing cache coverage completeness or something different?

Thank you in advance for your response.

Provider options used

providers = [
    ('TensorrtExecutionProvider', {
        "trt_fp16_enable": True,
        "trt_engine_cache_enable": True,
        "trt_engine_cache_path": "<engine_dir>",
        "trt_timing_cache_enable": True,
        "trt_force_timing_cache": True,
        "trt_timing_cache_path": "<timing_dir>",
        "trt_builder_optimization_level": 3,
        "trt_max_workspace_size": 17179869184,  # 16 GB
    }),
    ("CUDAExecutionProvider", {...}),
]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report does not name a repository file, test, or code entry point. Start by reproducing the delete-and-rebuild procedure with the listed TensorRT and ONNX Runtime provider options, then compare the original and rebuilt engine outputs and timing-cache behavior. Done means determining whether incomplete cache coverage explains the differences or documenting another reproducible cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.