Back to Coordinator
Workflow 02 / Metering

Metering: VRAM Guard

DXGI Telemetry Algorithms and Dynamic Fallback Strategies

Sequence / Hardware Audit Sequence
            sequenceDiagram
                participant SUB as Subsystem
                participant RHI as Unreal RHI (D3D12)
                participant DX as Windows DXGI
                
                SUB->>RHI: 1. GetNativeDevice()
                RHI-->>SUB: 2. ID3D12Device Handle
                SUB->>DX: 3. QueryVideoMemoryInfo()
                DX-->>SUB: 4. Return Physical Budget & Usage
                SUB->>SUB: 5. Calculate Physics Remainder (AvailableMB)
                Note right of SUB: Decision: Enable/Disable GPU
            
01 / Concept: Why DXGI Passthrough?

Unreal's built-in VRAM stats often lag by several frames. For GB-level AI pre-allocation, we need microsecond-precision physical feedback.

Physical Audit

The plugin bypasses UE5's abstraction layer to ask the GPU driver directly: "If I lock 2GB now, will D3D crash?"

Dynamic Fallback

If availability is below the 2GB safety watermark, the plugin automatically switches Backend from gpu to cpu.

02 / Source Code Demo (C++)

How logic leverages the subsystem audit:

// 1. Audit before initialization
int32 AvailableVRAM = ULiteRtLmSubsystem::QueryAvailableVramMB();

// 2. Inject defensive logic
FLiteRtLmConfig Config = FLiteRtLmUnrealApi::GetAutoConfig();
if (AvailableVRAM < 2048) {
    Config.Backend = TEXT("cpu"); // Physics-based fallback
}

// 3. Execute safe pre-allocation
Subsystem->LoadModel(Config);