feat: TensorRT EP有効のx64 CUDAビルドターゲットを追加 - #118
Draft
HariBote1110 wants to merge 2 commits into
Draft
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.
内容
#89 の議論に関連して、TensorRT Execution Provider を有効化した x64 CUDA ビルドターゲットを2つ追加する提案です。
voicevox_onnxruntime-win-x64-cuda-trtvoicevox_onnxruntime-linux-x64-cuda-trtTensorRT EP は CUDA EP へのフォールバックを内包するため、#89 で議論されている「複数の非CPU EPを同梱したビルド」の最初の実例にもなるかと思います。
動機と実測
VOICEVOX を Discord 読み上げボットの音声合成として常時稼働させており、CUDA EP と比べて TensorRT EP に2つの利点があることを実測で確認しています。
計測は公開されている生ONNXモデル(本リポジトリと同じ VOICEVOX/voicevox_core の
model/sample.vvm同梱decode.onnx。ダミー重みのため速度のみの評価です)を、pip の onnxruntime-gpu 1.23.2 + tensorrt-cu12 10.9.0.34 で実行したものです。環境は Windows 11 / RTX 3070 Ti、decode 入力フレーム長ごとに20回計測の中央値です。1. 推論速度(特に長い入力で顕著)
2. 動的shape混在時の安定性
長さ 112/380/1500 をラウンドロビンで交互に流すと、CUDA EP は短い入力の所要時間が定常値の7〜13倍に劣化しましたが、TensorRT は概ね ±10〜50% に収まりました。読み上げ用途では短文と長文が混在するため、この安定性の差は体感に直結します。
なお #89 には Jetson (arm64) での同種の要望が出ていますが、こちらは x64(Windows / Linux)での需要の報告になります。
変更点
win-x64-cuda/linux-x64-cudaの派生、--use_tensorrt追加)voicevox_onnxruntime_providers_tensorrt.dllの同梱制約・正直な注記
--use_tensorrtのみ)が無難だと考えていますonnxruntime.tools.symbolic_shape_inferで解決)。またdecode.onnxは一部ノード(Squeeze 等)が TensorRT 非対応のため TensorRT/CUDA の分割実行になります。この場合も上記のとおり速度向上は得られましたtrt_engine_cache_enable)で2回目以降は回避できますが、利用側(voicevox_core)でのオプション公開は別の議論になる認識です補足(作成方法について)
この PR と検証は LLM(Claude)の支援を大きく受けて作成しています。私自身はプログラミングは嗜む程度で、専門的な部分は LLM に頼っているためです。計測はすべて手元の実機で実行したものですが、不備やお作法違いがあればご指摘ください。確認して修正します。