configure
On this page

configure()deprecated

Function in Runtime

Set how a default-owner kernel call or @compute entry's call runs (Rule 11.8).

import { configure } from 'typeshade'
import { configure } from 'typeshade/runtime'

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

Syntax

function configure(options: {
readonly prefer?: readonly Tier[];
readonly runtime?: { readonly device: object } | null;
readonly limits?: Readonly<Record<string, number>>;
readonly features?: readonly string[];
readonly fp64Flavor?: 'auto' | Fp64Flavor;
}): void

Parameters

options { readonly prefer?: readonly Tier[]; readonly runtime?: { readonly device: object } | null; readonly limits?: Readonly<Record<string, number>>; readonly features?: readonly string[]; readonly fp64Flavor?: 'auto' | Fp64Flavor; }

prefer, a non-empty list of 'webgpu', 'webgl2' and 'cpu'; runtime, a runtime or null; limits, WebGPU limits by name; features, WebGPU feature names; fp64Flavor, 'auto', 'float' or 'integer'. configure({}) restores the default order and automatic flavor selection. Missing GPU signals retain the selector’s float fallback; they do not establish hardware precision.

Return value

void

Exceptions

TypeError

TypeError for an empty list, a repeated entry or an unknown tier, for a runtime with no device or on WebGL2, for a wrong limit value, for a word that is not a flavor, and for a change after the device exists or with a runtime configured.

Description

prefer is the order of the tiers it tries: WebGPU, WebGL2 and the CPU tier, the default being all three in that order. A one-entry list makes that tier required, and a call that cannot run on it throws, naming why: configure({ prefer: ['webgpu'] }).

runtime is a program runtime (createRuntime(), change 0025) whose device every call uses, so a texture or a Resident the host made on it reaches a call; null returns to the default device. Left out, each option keeps its value.

fp64Flavor is the flavor of the emulated double the calls made after it run (change 0073): 'auto', the default, resolves from the actual GPU: 'integer' on Apple or Metal signals, otherwise 'float'. The CPU selects 'float'. Explicit 'float' and 'integer' override it. A kernel call, an entry call and a draw of a module that emulates f64 dispatch the WGSL of that flavor, the _fp64 guard bound under 'float' and absent under 'integer', and a fuse() plan builds its fused entries under it. A module that emulates no f64 is unchanged. A device of createDevice({ fp64Flavor }) has a flavor of its own.

limits names the WebGPU limits the call layer’s device must have, by their names in GPUSupportedLimits, and features the WebGPU features it must have (change 0051). The device is requested by the first call that needs it, so a limit is set before that call. A limit or a feature the adapter cannot give fails that call. After the device exists, a different value throws. With runtime, the host’s device is used, and limits and features throw.

Source

src/core/resident.ts, line 1151, at commit af54ddad5

Edit this page Report a problem