Renderer · interface

InferenceDevice

A device for running networks, opened from whichever GPU the caller has.

Explained in Hello world.

interface InferenceDevice
import type { InferenceDevice } from '@driftengine/core';

In depth

The GPU is a parameter, so a browser's navigator.gpu and the native host's Dawn are the caller's choice, and nothing here reaches for a global. Half precision is decided here, once: asked for on an adapter without shader-f16, it is refused with the way out named, rather than failing to compile at the first graph far from the choice that caused it.

The storage limits are raised to the adapter's own, because a network's values are large where a frame's are not — a transformer's feed-forward layer at a depth model's resolution is eight megabytes a value. What it gives up is nothing a network wants: those limits are ceilings on single buffers, and the default is a floor every adapter meets rather than what any one offers.

Properties

NameTypeDescription
devicereadonlyGPUDevice
halfreadonlybooleanWhether weights are stored at half precision; see schedule.ts.