Skip to main content

Module backend

Module backend 

Expand description

Backend module.

Modules§

autodiff
Burn Autodiff
backend
Backend trait and required types.
distribution
Random value distributions. Random value distributions used to initialize and populate tensor data.
element
Traits for tensor element types and conversions. Traits and helpers for working with element types and conversions.
flex
burn-flex
fusion
Burn Fusion
indexing
Indexing utilities.
ir
Burn’s intermediate representation of tensors and tensor operations.
quantization
Quantization data representation.
shape
Shape definition.
slice
Slice utilities.
tensor
Backend type aliases.

Macros§

dequant_op_flow
Automatically applies dequantization -> float operation [-> quantization].
dequant_op_quant
Automatically applies dequantization -> float operation -> quantization.
doc_tensor
Convenience macro to link to the burn-tensor docs for this crate version.
s
Slice argument constructor for tensor indexing.
shape

Structs§

Autodiff
Enable auto-differentiation on a backend.
AutodiffDevice
A wrapper that enables automatic differentiation for a DispatchDevice.
BackTrace
Contains the backtrace information if available.
Bytes
A buffer similar to Box<[u8]> that supports custom memory alignment and allows trailing uninitialized bytes.
DeviceHandle
A handle to one service, reached as S.
DeviceId
The device id.
DeviceSettings
Settings controlling the default data types for a specific device.
Dispatch
The main execution backend in Burn.
DispatchTensor
A tensor that can dispatch operations to any enabled backend at runtime.
DistributionSampler
Distribution sampler for random value of a tensor.
Flex
The Flex backend, a fast, portable CPU backend for Burn.
FlexDevice
CPU device for the Flex backend.
HashMap
A hash map implemented with quadratic probing and SIMD lookup.
IndexWrap
Wraps an index with negative indexing support.
MemoryPoolUsage
One reading of a device allocator’s state, across the runtime’s streams and pools.
ProfileDuration
Result from profiling between two measurements. This can either be a duration or a future that resolves to a duration.
ProfileOptions
How a profiled window treats the work a backend still holds in a queue when the window closes.
ProfileTicks
Start and end point for a profile. Can be turned into a duration.
ProfileToken
An open profiling window on a backend, handed out by profile_start and passed back to profile_end to close it.
ServiceId
One service instance: the device it runs on and the type of service running there. This pair is what the device registry keys on, so two instances never share one, whatever DeviceId two runtimes happen to hand out.
Shape
Shape of a tensor.
Slice
A slice specification for a single tensor dimension.
SliceIter
Defines an Iterator over a Slice.
SlicedPoolReport
One dynamic pool’s measured state, in the order allocations are routed through the pools.
SmallVec
A Vec-like container that can store a small number of elements inline.
StreamId
Unique identifier representing the stream on which work is submitted.
TensorData
Data structure for tensors.
Tolerance
The tolerance used to compare to floating point numbers.
bf16
A 16-bit floating point type implementing the bfloat16 format.
f16
A 16-bit floating point type implementing the IEEE 754-2008 standard binary16 a.k.a “half” format.

Enums§

AllocationProperty
The kind of allocation behind the Bytes type.
BackendTensor
Tensor which points to a backend tensor primitive kind.
BoolStore
Data type used to store boolean values.
DType
DTypeUsage
Describes how a data type can be used on a given device.
DataError
Errors that can occur while accessing or converting TensorData.
DeviceError
Errors returned by device-related operations.
DeviceServiceStage
Pipeline stage a DeviceService runs on. Each stage gets its own runner thread per device, allowing upstream work to overlap with downstream kernel dispatch.
DispatchAutodiffContext
The autodiff backend associated with a dispatch tensor.
DispatchDevice
Represents a device for the Dispatch.
DispatchDeviceId
DispatchGraph
A captured graph from one of the dispatched backends (see BackendTypes::GraphPrimitive).
DispatchTensorKind
Internal representation of a DispatchTensor.
Distribution
Distribution for random value of a tensor.
DistributionSamplerKind
Distribution sampler kind for random value of a tensor.
ExecutionError
An error that can happen when syncing a device.
ExpressionError
Common Expression Error.
FloatDType
GradientCheckpointingStrategy
Gradient checkpointing strategy for autodiff.
GraphUnsupported
Placeholder graph primitive for backends without graph-capture support.
IntDType
MetadataError
Error that can occur when attempting to modify shapes.
RouterDeviceType
The type id a device behind burn-router puts in its DeviceId.
Scalar
A scalar element.
SplitPolicy
Controls how Bytes::split behaves when the allocation can’t be split in place.
TensorPrimitive
A primitive tensor representation.
TimingMethod
How a benchmark’s execution times are measured.

Traits§

AsIndex
Helper trait for implementing indexing with support for negative indices.
AsSize
Types which can be converted to a usize Size.
AutodiffBackend
Trait that allows a backend to support autodiff.
Backend
This trait defines all types and functions needed for a backend to be used with burn.
BackendTypes
The mapping of types used by Backend and traits.
Device
Device trait for all cubecl devices.
DeviceOps
Device trait for all burn backend devices.
DeviceService
Represent a service that runs on a device.
DispatchKindConversion
Trait to execute runtime routing conversions between the dynamic dispatch layer and specific backends.
Element
Core element trait for tensor values.
ElementAdd
Element addition trait.
ElementConversion
Element conversion trait for tensor.
ElementEq
Element trait for equality of a tensor.
ElementOrdered
Ordered element trait for tensor values.
ElementRandom
Element trait for random value of a tensor.
ExtensionType
A trait to map custom structs and enums of tensor primitives across the Dispatch boundary, in both directions.
SliceArg
Trait for slice arguments that can be converted into an array of slices. This allows the slice method to accept both single slices (from s![..]) and arrays of slices (from s![.., ..] or [0..5, 1..3]).
SliceOps
Slice-related ops on Shape
TensorMetadata
Tensor metadata trait for tensor primitive.

Functions§

calculate_matmul_output
Compute the output shape for matrix multiplication with broadcasting support.
get_device_settings
Returns the configured settings, or backend defaults without initializing them.
get_or_init_device_settings
Get the device’s settings, initializing them to defaults if unset.
profile_system_time
Measure func in wall-clock time between two syncs of device.
profile_with_tokens
A closure-bracketed window over a backend’s split profile_start / profile_end, falling back to profile_system_time when the backend opens none.
ravel_index
Compute the ravel index for the given coordinates.
read_sync
Read a future synchronously.
set_default_dtypes
Sets the default data types for the device.
try_read_sync
Read a future synchronously.
wrap_index
Wraps a dimension index to be within the bounds of the dimension size.

Type Aliases§

BackendGraph
Captured graph primitive type used by the backend (see BackendTypes::GraphPrimitive).
BoolDType
Boolean dtype.
DTypeUsageSet
A set of DTypeUsage representing the total capabilities of a data type on a device.
ServerUtilitiesHandle
An pointer to a service’s server utilities.

Attribute Macros§

backend_extension
Generates the Dispatch implementation for a backend extension trait.

Derive Macros§

ExtensionType
Maps structs and enums of backend tensor primitives across the Dispatch boundary.