Serialize complete TensorRT handle initialization across GPU threads - #1230
Draft
zsqdx wants to merge 1 commit into
Draft
Serialize complete TensorRT handle initialization across GPU threads#1230zsqdx wants to merge 1 commit into
zsqdx wants to merge 1 commit into
Conversation
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
Serialize the complete TensorRT handle initialization across GPU server threads, rather than only cache access and
buildSerializedNetwork().Why
TensorRT 10.16.1 can fail nondeterministically while initializing heterogeneous GPUs, although each GPU initializes successfully alone. Reports include RTX 3090 + 4090 and RTX 4090 + 5090, with Cask/Myelin tactic failures and
Invalid device kernel image.#1225 serialized
buildSerializedNetwork(), but builder, config, network, and parser objects were still created concurrently, and one GPU could begin building while the previous GPU was deserializing its engine and destroying its temporary builder objects.The observed 5090 + 4090 log is particularly useful: the 5090 cold build completed before the 4090 warm build began, so the two
buildSerializedNetwork()calls did not overlap. However, both builder/parser lifetimes did overlap.This moves the process-wide lock to
createComputeHandle()so it covers device selection, the complete builder/parser lifetime, engine building, deserialization, and execution-context initialization.Impact
Only startup is serialized. Inference behavior, engine precision, tactic selection, cache format, and multi-GPU execution remain unchanged.
This is a conservative application-side workaround for what appears to be a TensorRT 10.16 mixed-architecture initialization issue.
Validation
USE_CACHE_TENSORRT_PLAN=0)katago versionkatago runtestsgit diff --checkHeterogeneous-GPU validation is still requested, particularly: