qp.backline.triton_decoder¶
- triton_decoder(decoder_fns, **build_options)[source]¶
Compile Triton quantum error correction decoder functions into a coprocessor function for use with
backline.This function accepts a tuple of un-jitted Triton decoder functions, and compiles them into a shared library that can be used as a
CoprocessorFunction.Warning
Backlineis experimental and only usable through the Catalyst compiler.- Parameters:
decoder_fns (tuple[object, ...]) – Un-jitted Triton decoder functions. Each entry is jit compiled internally, and
decoder_idselects the tuple index at runtime.- Keyword Arguments:
platform (str) – Required Triton platform string of the form
"backend:arch:warp_size". For example,"hip:gfx942:64"or"cuda:80:32".grid (tuple[int, int, int]) – Triton kernel launch grid dimensions. Defaults to
(1, 1, 1).num_warps (int) – Triton kernel launch warp count. Defaults to
1.num_stages (int) – Triton pipeline stage count. Defaults to
1.compiler (str) – Optional compiler executable override. Defaults to
"".cflags (tuple[str, ...]) – Extra compiler flags. Defaults to
().
- Returns:
- The compiled decode function, ready to pass as
- Return type:
- Raises:
ImportError – If Triton decoder support is unavailable.
TypeError – If
decoder_fnscontains already jit compiled Triton functions.ValueError – If the decoder build options are invalid.
See also
Example
>>> import pennylane as qp >>> import triton.language as tl >>> def steane_lookup(syndrome): ... return tl.where(syndrome != 0, 1 << (syndrome - 1), 0) >>> decoder = qp.backline.triton_decoder( ... (steane_lookup, steane_lookup), ... platform="hip:gfx942:64", ... )