Serialize TensorRT engine builds across GPUs - #1225
Open
zsqdx wants to merge 1 commit into
Open
Conversation
zsqdx
marked this pull request as ready for review
August 3, 2026 20:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buildSerializedNetwork()under the existing process-wide TensorRT tuning mutex, including timing-cache hits.Why
With TensorRT 10.16.1, concurrent warm-cache engine builds on different GPUs can fail nondeterministically. The existing cache-hit path released
tuneMuteximmediately beforebuildSerializedNetwork(), allowing all GPU threads to enter TensorRT's builder at once. On an 8x RTX 5060 Ti machine this reproduced as two SIGSEGVs and one hang, always after both threads loaded the timing cache and before either engine finished initialization.This only serializes engine construction during startup. Engine deserialization, execution contexts, and inference remain per-GPU and concurrent. It does not change the graph, precision, or inference hot path.
Validation
Tested with KataGo v1.17.1, TensorRT 10.16.1, CUDA 13.2, and
b11c768h12nbt3tflrs-fson-silu:USE_CACHE_TENSORRT_PLAN=1: builds and passes dual-GPU cold/warm smoke testskatago runtests: all tests pass