createDevice
On this page

createDevice()

Function in Runtime

Open the owner of a host's kernel calls: on the first tier of prefer that opens, on a GPUDevice the host already has, or on the device of a program runtime.

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

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

Syntax

async function createDevice(options: DeviceOptions = {}): Promise<Device>

Parameters

optionsoptional DeviceOptions

prefer, device or runtime, one of them; instance-local WebGPU limits and features; poolBytes, fp64Flavor and timeBudgetMs, the time one chunk of a long kernel may take (change 0074). Omitted fp64Flavor means 'auto', resolved from this device without requesting an unrelated adapter.

Return value

Promise<Device>

the device.

Exceptions

TypeError

TypeError for options that do not fit, a word that is not a flavor among them; RangeError for a timeBudgetMs that is not a finite number from 1 to 60000; Error naming each tier’s reason when no tier of prefer opens.

Description

The device’s array() makes the Buffers its calls take, fuse() runs a body’s calls as one plan on it, and dispose() frees what it made. Two devices in one context are independent, and the process-global configure(), array() and fuse() describe the default owner as before.

In the guide

Source

src/runtime/device.ts, line 753, at commit af54ddad5

Edit this page Report a problem