NVIDIA TensorRT を用いた RTX ランタイムでの Unreal Engine NNE インフレンス高速化
本文の状態
日本語全文を表示中
詳細モードで約9分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
NVIDIA Developer Blog
NVIDIA は、Unreal Engine のニューラルネットワーク推論を RTX ランタイム上で NVIDIA TensorRT を活用して高速化する技術を発表した。これにより、リアルタイムアプリケーションの処理速度が向上する。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
ニューラルネットワーク技術は、画像品質の向上、パフォーマンスの改善、コンテンツ制作の効率化のために、コンピュータグラフィックスにおいてますます広く利用されるようになっています。スーパーリゾリューション(超解像)、デノイジング(ノイズ除去)、ニューラルレンダリングといったアプローチは、リアルタイムエンジンがより効率的に動作するのを助けつつ、パフォーマンスを考慮したまま新たな創造の可能性を提供します。
Unreal Engine 5 (UE5) は、複数のバックエンドにわたる推論ワークロードを統合する抽象化レイヤーとして機能する Neural Network Engine(NNE)の導入により、この方向へいくつかのステップを踏み出しました。開発者は、リアルタイムグラフィックスワークフローにニューラルネットワーク機能をシームレスに統合するために、利用可能なハードウェアに応じて GPU 上でさまざまなランタイムを使用したり、CPU にフォールバックしたりできます。
本ブログ記事では、NVIDIA RTX GPU 上での効率的な推論を可能にする NNE ランタイムオプションとして NVIDIA TensorRT for RTX を追加する新しいプラグイン(NNERuntimeTRT)について解説します。その利点を示すために、ポストプロセス AI モデルを実行して DirectML などの他の GPU ランタイムとの比較における向上分を強調する、簡略化された UE プロジェクトを使用します。
まず、プロジェクトに関与する異なるコンポーネントについて簡単に議論しましょう。
TensorRT for RTX の概要
TensorRT for RTX は、ユーザーが AI モデルを RTX GPU でより効率的にデプロイすることを可能にします。これは、ランタイム内で Just-In-Time (JIT) オプティマイザーを使用し、ユーザーの GPU に合わせた推論エンジンを作成します。このコンパイルはユーザーのマシン上で一度だけ実行され、特定のハードウェア向けにモデルが最適化されます。
その結果、TensorRT for RTX はデフォルトの実行プロバイダーと比較してより高いスループットを提供できます。例えば、スループット比較 では、NVIDIA GeForce RTX 5090 GPU で測定した際、TensorRT for RTX を使用すると DirectML を使用する場合と比較して各種モデルで改善が見られることが示されています。
TensorRT for RTX は、Turing 世代(計算能力 7.5)から NVIDIA Blackwell 世代(計算能力 10.0)までの NVIDIA RTX GPU のみと互換性があります。
Unreal Engine ニューラルネットワークエンジン概要
NNE は推論タスクを呼び出すための複数のランタイムをサポートしており、CPU と GPU の選択が可能です。TensorRT for RTX は GPU 向けのものであり、この概要では NNE の GPU ランタイムに焦点を当てます。
NNE は GPU で推論を実行できますが、その方法は以下の通りです:
- CPU から同期実行し、メモリの同期が必要となる場合。
- レンダー依存グラフ (RDG) を通じて非同期で実行し、フレームレンダリングと同期させる場合。
同期方式は、ホストとデバイス間のデータ転送を気にする必要がないエディタや LLM などのイベントベースの推論タスクではよく機能します。一方、RDG はモデル評価をレンダリングリソースに紐付けるため、AI によるポストプロセッシング、アップスケーリング、またはデノイジングに最適です。
NNE TensorRT for RTX プラグインは GPU および RDG 方式の両方をサポートしており、コンシューマー向けデバイスで高いパフォーマンスを維持しつつ、レンダリング、アニメーション、言語、音声など多様な AI アプリケーションに対して柔軟性を提供します。
スタイル転送ポストプロセッシングサンプルプロジェクト
NNE TensorRT for RTX プラグインをテストするために、ポストプロセッシング中にスタイル転送モデルを適用する基本的な UE5 プロジェクトを作成しました。テストでは、DirectML と TensorRT を切り替える際に視覚的な一貫性を保ちつつ、両者の結果とパフォーマンスを比較しやすくするため、いくつかの基本的なプリミティブと固定カメラを使用したシンプルなレベルを設定しました。
前提条件
プロジェクトはほぼ使用可能な状態ですが、UE5 の経験、ポストプロセスマテリアルの知識、およびエンジンソースコードのコンパイルに関する理解があると推奨されます。
スタイル転送推論を実行しレンダリングリソースを管理するには、NNE 実装が必要です。UE5 ではニューラルポストプロセッシングプラグインを通じてこの機能を提供しており、RDG を介して GPU で推論を行います。本プロジェクトでは、NNERuntimeTRT の RDG 方式を利用します。
必要なことは、適切なスタイルモデルを学習するかダウンロードすることだけです。ONNX ゾーから事前学習済みモデルを使用します。
プロジェクトにはすでにインポートされたモデル (candy-9-720.uasset) が含まれています。
プロジェクト設定
NNE TensorRT for RTX プラグインは、ランチャーから入手可能な 5.7 バイナリエンジンリリースと互換性がありますが、ニューラル後処理プラグインにはそのニューラルプロファイルアセット内にハードコードされたランタイムのリストが含まれています。ニューラルプロファイルアセットで利用可能なランタイムのリストに NNERuntimeTRT を含めるために、コードを更新する必要があります。
始めましょう:
- GitHub からエンジンソースを取得します。
これが初めてエンジンコードベースにアクセスする場合は、GitHub アカウントを Epic アカウントとリンクする必要があります。エンジンコードベースへのアクセスプロセスについて説明しているこのドキュメントを確認してください:
- 初期のエンジンセットアップ後、Visual Studio ソリューションが作成されているはずです。ソリューションを開き、以下のパスにある neuralprofile.h/cpp ファイルを探します: Engine\Source\Runtime\Engine\Classes\Engine
- neuralprofile.h で、ENeuralProfileRuntimeType に NNERuntimeTRT を追加します (59 行目)。以下のように記述します:
UNNERuntimeRDGTensorRT UMETA(DisplayName = "NNERuntimeTRT"),
- 完全な列挙型クラスは以下のようになります:
UNNERuntimeRDGTensorRT UMETA(DisplayName = "NNERuntimeTRT"), UENUM(BlueprintType)
enum class ENeuralProfileRuntimeType : uint8
{
NNERuntimeORTDml UMETA(DisplayName = "NNERuntimeORTDml"),
NNERuntimeRDGHlsl UMETA(DisplayName = "NNERuntimeRDGHlsl"),
UNNERuntimeRDGTensorRT UMETA(DisplayName = "NNERuntimeTRT"),
MAX UMETA(Hidden)
};
- neuralprofile.cpp 内で GetNeuralProfileRuntimeName を見つけ、kRuntimeNames 配列に追加します(28 行目):
,TEXT("NNERuntimeTRT")
- kRuntimeNames 配列の完全な内容は以下の通りです:
static const TCHAR* const kRuntimeNames[] = {
TEXT("NNERuntimeORTDml"),
TEXT("NNERuntimeRDGHlsl"),
TEXT("NNERuntimeTRT")
};
- プラグインは Fab または NVIDIA Developer ページから入手してください。
- このパスのエンジンプラグインフォルダ配下にプラグインを展開します:…\Engine\Plugins\Runtime\Nvidia。プロジェクト内にプラグインを配置することも可能ですが、今回のケースではエンジンプラグインの下に置く方が簡単です。
- エンジンをビルドします。コンパイルにはこれらの詳細な手順を使用してください。最初のコンパイルには時間がかかるため、休憩をとるかコーヒーを飲みながら待つことをお勧めします。
- サンプルプロジェクトで始めましょう。
サンプルプロジェクトのリポジトリをクローンします。
- コンパイル済みのエンジンでプロジェクトを読み込み、テストレベル(LVL_PPStyleTest)を実行します。

パフォーマンスプロファイリング
テストレベルを再生中は、エンジン統計情報を有効化し、TensorRT for RTX (TRT) と DirectML (DML) を切り替えてパフォーマンスの向上を確認してください。より包括的なプロファイリングを行うには、Unreal Insights を使用して、DML および TRT の両方におけるフレーム情報と内訳をキャプチャします。
NVIDIA GeForce RTX 5090 GPU を搭載したシステムで 1080p レゾリューションの場合、Unreal Insights によると DML は 5.7 ms を要しましたが、TRT では 3.8 ms で完了し、1.5 倍のパフォーマンス向上が確認されました。

image図 3. ニューラルポストプロセッシングステージ内における TensorRT for RTX エンキュータスクの持続時間 (3.8 ms) を示す Unreal Insights
他のスタイル転送モデルの使用
ONNX ゾーのスタイル転送モデルを使用するか、独自のモデルをトレーニングすることもできます。ただし、ONNX ゾーのモデルは入力および出力テンソルに対して 1x3x224x224 の固定次元を持っています。ニューラルプロセスプラグインは、小規模モデルをより大きなフレームバッファにタイル処理する機能を備えています。これにより視覚的に許容できる結果が得られますが、1 フレームあたり複数の推論タスクが生成され、NVIDIA CUDA とグラフィックスの間で頻繁なコンテキストスイッチが発生するため、推奨はされません。複数のコンテキストスイッチによる追加オーバーヘッドを回避するには、モデルの次元を 1x3x720x720 に変更し、タイル処理なしで推論を実行しながらも良好な視覚品質を維持してください。
サンプルプロジェクトのリポジトリには、スタイル転送 ONNX モデルの入力および出力テンソル次元をリサイズする Python スクリプトを含めています。
NNE を使用して独自の AI アプリケーションを構築する方法については、公式ドキュメントをご参照ください。
原文を表示
Neural network techniques are increasingly used in computer graphics to boost image quality, improve performance, and streamline content creation. Approaches like super resolution, denoising, and neural rendering help real-time engines work more efficiently, offering new creative possibilities while keeping performance in mind.
Unreal Engine 5 (UE5) has taken several steps in this direction with the introduction of the Neural Network Engine (NNE), which serves as an abstraction layer that unifies inference workloads across multiple backends. Developers can use various runtimes on a GPU or fall back to a CPU depending on available hardware for seamless integration of neural network features in real-time graphics workflows.
This blog post covers the new plugin that adds NVIDIA TensorRT for RTX as an NNE runtime option (NNERuntimeTRT) for efficient inferencing on NVIDIA RTX GPUs. To show its benefits, I’ll use a simplified UE project that runs a post-process AI model to highlight gains over other GPU runtimes, like DirectML.
First, let’s briefly discuss the different components involved in the project.
TensorRT for RTX Overview
TensorRT for RTX enables users to deploy AI models on RTX GPUs more efficiently. It uses a Just-In-Time (JIT) optimizer within the runtime to generate inference engines tailored to the user’s GPU. This compilation occurs once on the user’s machine and optimizes the model for their specific hardware.
As a result, TensorRT for RTX can offer higher throughput compared to default execution providers. For example, throughput comparisons across various models show improvements when using TensorRT for RTX versus DirectML, as measured on an NVIDIA GeForce RTX 5090 GPU.
TensorRT for RTX is only compatible with NVIDIA RTX GPUs, from the Turing generation (compute capability 7.5) up to the NVIDIA Blackwell generation (compute capability 10.0).
Unreal Engine neural network engine overview
NNE supports multiple runtimes for invoking inferencing tasks and choosing between CPUs and GPUs. TensorRT for RTX is for GPUs and this overview focuses on NNE GPU runtimes.
NNE can run inference on the GPU, either:
- Synchronously from the CPU, requiring memory synchronization.
- Asynchronously through the Render Dependency Graph (RDG), aligning with frame rendering.
The synchronous method works well for editors and event-based inference tasks like LLMs, where copying data between host and device is not a concern. In contrast, RDG ties model evaluation to rendering resources, making it ideal for AI post-processing, upscaling, or denoising.
The NNE TensorRT for RTX plugin supports both GPU and RDG methods, offering flexibility for various AI applications such as rendering, animation, language, and speech while maintaining strong performance on consumer-grade devices.
The style transfer post-processing sample project
I built a basic UE5 project to test the NNE TensorRT for RTX plugin, which applies style transfer models during post-processing. For testing, I set up a simple level using a few basic primitives and a fixed camera to keep the visuals consistent while switching between DirectML and TensorRT, making it easier to compare both results and performance.
Prerequisites
While the project is nearly ready for use, having experience with UE5, post-process materials, and engine source compilation is recommended.
To run style transfer inference and manage rendering resources, you need an NNE implementation. UE5 offers this through the Neural Post-Processing plugin, which performs inference on the GPU through RDG. For this project, we’ll utilize the NNERuntimeTRT RDG method.
All that’s required is to train or download an appropriate style model. We’ll use a pre-trained one from the ONNX zoo.
The project already includes an imported model (candy-9-720.uasset).
Project setup
Although the NNE TensorRT for RTX plugin is compatible with the 5.7 binary engine release available from the launcher, the neural post-processing plugin contains a hard-coded list of runtimes within its neural profile asset. It’s necessary to update its code to include the NNERuntimeTRT in the list of available runtimes for the neural profile asset.
Get started:
- Get the engine source from GitHub.
If it is your first time accessing the engine code base, you need to link your GitHub account with your Epic account. Review this document, which explains the process for accessing the engine code base:
- After initial engine setup, you should have a Visual Studio solution. Open the solution and locate the neuralprofile.h/cpp files under: Engine\Source\Runtime\Engine\Classes\Engine
- In neuralprofile.h, add NNERuntimeTRT to ENeuralProfileRuntimeType (line 59) like so:
UNNERuntimeRDGTensorRT UMETA(DisplayName = "NNERuntimeTRT"),
- The full enum class should look like this:
UNNERuntimeRDGTensorRT UMETA(DisplayName = "NNERuntimeTRT"), UENUM(BlueprintType)
enum class ENeuralProfileRuntimeType : uint8
{
NNERuntimeORTDml UMETA(DisplayName = "NNERuntimeORTDml"),
NNERuntimeRDGHlsl UMETA(DisplayName = "NNERuntimeRDGHlsl"),
UNNERuntimeRDGTensorRT UMETA(DisplayName = "NNERuntimeTRT"),
MAX UMETA(Hidden)
};
- In neuralprofile.cpp, find the GetNeuralProfileRuntimeName and add to the kRuntimeNames array (line 28):
,TEXT("NNERuntimeTRT")
- The full kRuntimeNames array should be:
static const TCHAR* const kRuntimeNames[] = {
TEXT("NNERuntimeORTDml"),
TEXT("NNERuntimeRDGHlsl"),
TEXT("NNERuntimeTRT")
};
- Get the plugin from Fab or the NVIDIA Developer page.
- Unpack the plugin under the engine plugins folder in this path: …\Engine\Plugins\Runtime\NvidiaIt’s also possible to place the plugin in the project, but for our case, it’s simpler to keep it under the engine plugins.
- Build the engine. Use these detailed instructions for compiling the engine. The first compilation takes time, so consider taking a break or grabbing a coffee.
- Get started with the sample project.
Clone the sample project repository.
- Load the project with the compiled engine and play the test level (LVL_PPStyleTest).

Performance profiling
While playing the test level, activate the engine stats and alternate between TensorRT for RTX (TRT) and DirectML (DML) to assess performance improvements. For more comprehensive profiling, use Unreal Insights to capture frame information and breakdowns for both DML and TRT.
On a system with NVIDIA GeForce RTX 5090 GPU at 1080p, in Unreal Insights, DML required 5.7 ms, whereas TRT completed in 3.8 ms—a 1.5x performance improvement.


Using other style transfer models
You can use any style transfer models from the ONNX zoo or train your own. Note that ONNX zoo models have fixed dimensions of 1x3x224x224 for both input and output tensors. The neural process plugin enables tiling for small models to larger frame buffers. While this gives visually acceptable results, it’s not recommended as it spawns multiple inference tasks per frame, causing frequent context switches between NVIDIA CUDA and graphics. To avoid the extra overhead of multiple context switches, change the model dimensions to 1x3x720x720 to run the inference without tiling while maintaining good visual quality.
In the sample project repo, I’ve included a Python script that resizes the input and output tensor dimensions for style transfer ONNX models.
For more information on building your own AI applications with NNE, consult the official documentation
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み