numba_vulkan.vktypes#
Numba types specific to the Vulkan target.
Classes#
An array backed by a storage buffer at a descriptor binding. |
|
Type of a |
|
Iterator over the first axis of a VulkanArray. |
|
Type of a Vulkan-compiled function used inside another one. |
|
An array expression that is evaluated element by element. |
|
An element of a structured (record) array in a buffer. |
Module Contents#
- class numba_vulkan.vktypes.VulkanArray(dtype, ndim, layout, binding, readonly=False, aligned=True, half=False)#
An array backed by a storage buffer at a descriptor binding.
Vulkan shaders have no general pointers, so every access names the buffer by its binding, which must be a constant in the shader. Arrays allocated in a kernel (shared, local, constant arrays) have it in their type. Kernel arguments carry it as a value (
binding=None), so that a function taking arrays is compiled once for all of them; after inlining into the kernel, the value is a constant (see numba_vulkan.buffers.expand_buffer_access).- Parameters:
dtype (numba.types.Type) – Element type.
ndim (int) – Number of dimensions.
layout ({'C', 'A'}) – Memory layout:
'C'for contiguous arrays,'A'for views with arbitrary strides.binding (int or None) – Descriptor binding of the buffer holding the data, or
Nonefor arrays that carry it as a value.readonly (bool, optional) – Whether the array is immutable.
aligned (bool, optional) – Whether the data is aligned.
half (bool, optional) – Whether the buffer holds
float16values; the elements are thenfloat32to the kernel.
- Variables:
- binding#
- half = False#
- copy(dtype=None, ndim=None, layout=None, readonly=None)#
Return a copy of this type with some properties replaced.
Unlike numba.types.Array.copy, the result keeps the binding, so types that Numba derives from an array still refer to its buffer.
- Parameters:
- Return type:
- property iterator_type#
Type of
iter(array).- Return type:
- class numba_vulkan.vktypes.HalfArray(ndim, layout, readonly=False)#
Type of a
float16array argument before it is given a binding.Its elements are
float32; see VulkanArray.- copy(dtype=None, ndim=None, layout=None, readonly=None)#
Return a copy with some properties replaced (but not the dtype).
- property key#
Identity of the type.
- class numba_vulkan.vktypes.VulkanArrayIterator#
Iterator over the first axis of a VulkanArray.
A type of its own, so that iteration can be lowered without the data pointer that Numba’s array iterator relies on.
- class numba_vulkan.vktypes.VulkanDispatcherType#
Type of a Vulkan-compiled function used inside another one.
It exists so that constants of this type can be lowered to a dummy value: calls are resolved at compile time, and the default lowering of numba.types.Dispatcher would embed a host address.
- class numba_vulkan.vktypes.VulkanExpr(op, operands, dtype, ndim)#
An array expression that is evaluated element by element.
Kernels cannot allocate memory, so
a * 2ornp.sqrt(a) + bon arrays does not compute a new array. Its value is the operation and its operands; an element is computed when it is read, by indexing, a reduction, iteration or an assignment to a slice.- Parameters:
- Variables:
- op#
- operands#
- dtype#
- ndim#
- class numba_vulkan.vktypes.VulkanRecord(record)#
An element of a structured (record) array in a buffer.
Numba represents a record as a pointer to its bytes, which shaders do not have. A Vulkan record is the binding of its buffer and the position of its first byte there; its fields are read from and written to the buffer’s 32-bit words (see numba_vulkan.vkimpl). It is the element type of record arrays, so indexing one gives a record.
- Parameters:
record (numba.types.Record) – The layout: names, types and offsets of the fields, as the buffer holds them.
- Variables:
record (numba.types.Record) – As given.
- record#
- property key#
the record layout.
- Return type:
numba.types.Record
- Type:
Identity of the type