⌂ Modules nupp nupp.gpu nupp.gpu.spi nupp.gpu.spi
Shared interfaces for resident GPU implementations.
The nupp.gpu module selects a device implementation during initialization. open is a receiver-free function; it returns a closeable KernelContext.
Implementations define private records satisfying the shared context, buffer, kernel, and binding interfaces. Reuse the exported types here rather than creating nominal substitutes. Context-bound buffers and kernels preserve their borrows, and every close keeps its non-suspending guarantee.
Generated artifacts and layout facts constrain binding formats, counts, scalar uniforms, and target features. A provider may choose a compatible device, but it cannot change the representation compiled into a kernel. Device and artifact failures must be reported before incompatible operations are published or run. The facade exports the retained open function directly.
Module contents Types Type Kind Description ArtifactSetrecord Generated shader formats and entrypoint accepted by provider compilation. Bindinginterface Canonical kernel invocation with buffer slots and uniform dispatch. Bufferinterface Canonical typed resident buffer/view borrowing its context. Contextinterface Complete shared context protocol, including generated-kernel operations. Kernelinterface Canonical opaque kernel handle borrowing its context. Providerinterface
Types
ArtifactSetrecord
Generated shader formats and entrypoint accepted by provider compilation.
spirvfield
@readonly
Optional SPIR-V artifact bytes.
wgslfield
@readonly
Optional WGSL shader source.
entrypointfield
@readonly
Name of the entry point within the supplied artifacts.
sourceFilefield
@readonly
Authored kernel identity carried into optional execution cost records.
sourceLinefield
@readonly
artifactIdfield
@readonly
readonlyNamesfield
@readonly
writableNamesfield
@readonly
Bindinginterface
Canonical kernel invocation with buffer slots and uniform dispatch.
Members Name Kind Description closemethod Releases the binding's attachments without suspending. countfield Number of logical elements dispatched. setReadmethod Attaches a same-context buffer to a zero-based read slot. setWritemethod Attaches a same-context, injective buffer to a zero-based writable slot. dispatchWordsmethod Dispatches using the generated scalar uniform words. dispatchPackedmethod Dispatches from the exact packed uniform layout and byte count.
closemethod
@readonly
Releases the binding's attachments without suspending. The kernel and buffers it named remain their owners'.
Arguments Name Type Description borrows selfBinding
Returns
countfield
@readonly
Number of logical elements dispatched.
setReadmethod
setRead : function < T > (
borrows self : Binding ,
slot : integer ,
borrows buffer : gpu . Buffer < T > ,
matchCount : boolean
) : nil
@readonly
Attaches a same-context buffer to a zero-based read slot. matchCount requires a dense buffer element per dispatched element.
Arguments Name Type Description borrows selfBinding slotinteger borrows buffergpu . Buffer < T > matchCountboolean
Returns
setWritemethod
setWrite : function < T > (
borrows self : Binding ,
slot : integer ,
borrows buffer : gpu . Buffer < T > ,
matchCount : boolean
) : nil
@readonly
Attaches a same-context, injective buffer to a zero-based writable slot. matchCount also requires a dense element per dispatched element.
Arguments Name Type Description borrows selfBinding slotinteger borrows buffergpu . Buffer < T > matchCountboolean
Returns
dispatchWordsmethod
dispatchWords : function ( borrows self : Binding , scalars : { uint32 } ) : nil
@readonly
Dispatches using the generated scalar uniform words.
Arguments Name Type Description borrows selfBinding scalars{ uint32 }
Returns
dispatchPackedmethod
dispatchPacked : function ( borrows self : Binding , uniforms : any , uniformBytes : integer ) : nil
@readonly
Dispatches from the exact packed uniform layout and byte count. The provider must validate the byte count against the compiled kernel.
Arguments Name Type Description borrows selfBinding uniformsany uniformBytesinteger
Returns
Bufferinterface
Canonical typed resident buffer/view borrowing its context.
Type parameters
Members Name Kind Description closemethod Releases a root buffer's allocation, or ends a view, without suspending. countfield Number of logical elements in this buffer or view. dimensionsmethod Returns the logical shape in elements. stridesmethod Returns the element strides for the logical view. subviewmethod Creates a context-borrowed view at a zero-based origin with the requested shape. layoutmethod Returns the canonical tensor layout for this view. isDensemethod Reports whether this buffer or view occupies one dense element range. isInjectivemethod Reports whether every logical element maps to a distinct storage element. viewmethod Creates a view using the supplied checked layout without copying storage.
closemethod
Releases a root buffer's allocation, or ends a view, without suspending.
Arguments Name Type Description takes selfBuffer < T >
Returns
countfield
@readonly
Number of logical elements in this buffer or view.
dimensionsmethod
dimensions : function ( borrows self : Buffer < T > ) : { integer }
@readonly
Returns the logical shape in elements.
Arguments Name Type Description borrows selfBuffer < T >
Returns
stridesmethod
strides : function ( borrows self : Buffer < T > ) : { integer }
@readonly
Returns the element strides for the logical view.
Arguments Name Type Description borrows selfBuffer < T >
Returns
subviewmethod
@readonly
Creates a context-borrowed view at a zero-based origin with the requested shape.
Arguments Name Type Description borrows selfBuffer < T > origin{ integer } shape{ integer }
Returns
layoutmethod
layout : function ( borrows self : Buffer < T > ) : TensorLayout
@readonly
Returns the canonical tensor layout for this view.
Arguments Name Type Description borrows selfBuffer < T >
Returns Type Description TensorLayout
isDensemethod
isDense : function ( borrows self : Buffer < T > ) : boolean
@readonly
Reports whether this buffer or view occupies one dense element range.
Arguments Name Type Description borrows selfBuffer < T >
Returns
isInjectivemethod
isInjective : function ( borrows self : Buffer < T > ) : boolean
@readonly
Reports whether every logical element maps to a distinct storage element. A false result also covers a stride proof that was inconclusive.
Arguments Name Type Description borrows selfBuffer < T >
Returns
viewmethod
view : function ( borrows self : Buffer < T > , layout : TensorLayout ) : affine ( Buffer < T > ) borrows ( self )
@readonly
Creates a view using the supplied checked layout without copying storage. The layout must fit within the root allocation.
Arguments Name Type Description borrows selfBuffer < T > layoutTensorLayout
Returns
Contextinterface
Complete shared context protocol, including generated-kernel operations.
Members Name Kind Description compileGeneratedmethod Compiles compatible artifacts with exact read/write slot counts and uniform size. bindKernelmethod Creates a binding for count elements using this context's live kernel.
compileGeneratedmethod
compileGenerated : function (
borrows self : Context ,
artifacts : gpu . ArtifactSet ,
readonlyBuffers : integer ,
writableBuffers : integer ,
uniformBytes : integer ,
threads : integer ?
) : gpu . Kernel borrows ( self )
@readonly
Compiles compatible artifacts with exact read/write slot counts and uniform size. threads carries the generated workgroup requirement when specified. Reject unsupported layouts or device limits before returning a kernel.
Arguments Name Type Description borrows selfContext artifactsgpu . ArtifactSet readonlyBuffersinteger writableBuffersinteger uniformBytesinteger threadsinteger ?
Returns Type Description gpu . Kernel borrows ( self )
bindKernelmethod
bindKernel : function (
borrows self : Context ,
borrows kernel : gpu . Kernel ,
count : integer
) : gpu . Binding borrows ( self )
@readonly
Creates a binding for count elements using this context's live kernel.
Arguments Name Type Description borrows selfContext borrows kernelgpu . Kernel countinteger
Returns Type Description gpu . Binding borrows ( self )
Kernelinterface
Canonical opaque kernel handle borrowing its context.
Members Name Kind Description closemethod Releases the compiled kernel without suspending.
closemethod
@readonly
Releases the compiled kernel without suspending.
Arguments Name Type Description borrows selfKernel
Returns
Providerinterface
Members Name Kind Description priorityfield availablemethod Reports whether open can answer a device now, without raising. openmethod Opens an owned, closeable device context.
availablemethod
@readonly
Reports whether open can answer a device now, without raising.
Returns
openmethod
open : function ( ) : types . KernelContext
@readonly
Opens an owned, closeable device context. Raises if the host cannot provide a compatible device.
Returns Type Description types . KernelContext
← Previous nupp.gpu.layout Next → nupp.hotreload