npu package#

Subpackages#

Submodules#

npu.magic module#

class npu.magic.kernel_magic(shell)#

Bases: Magics

kernel(_, cell)#

Specify a compute tile C++ kernel and return an npu.build.Kernel object.

This cell magic command allows users to input C++ kernel code within a Jupyter notebook cell. It then returns a corresponding Kernel object that can be compiled into an object file for use in a Riallto application. The Cpp source must return a void type, input and output buffers are specified as pointer types, as parameters are specified with non-pointer types.

Header files included in the directory where the notebook is are permitted.

Parameters:

cell (str) – The string content of the cell, expected to be C++ code defining the kernel.

Returns:

Kernel – Returns a Kernel object that has the same name as the last function defined in the cell magic. See npu.build.Kernel.

Return type:

object

Examples

In a Jupyter notebook %%kernel cell

void passthrough(uint8_t in_buffer, uint8_t out_buffer, uint32_t nbytes) {
for(int i=0; i<nbytes; i++) {

out_buffer[i] = in_buffer[i];

}

}

This will construct a passthrough npu.build.Kernel object that can be used within a callgraph to construct a complete application.

magics = {'cell': {'kernel': 'kernel'}, 'line': {}}#
registered = True#

npu.repr_dict module#

class npu.repr_dict.ReprDict(*args, rootname='root', expanded=False, **kwargs)#

Bases: dict

Subclass of the built-in dict that will display using the JupyterLab JSON repr.

The class is recursive in that any entries that are also dictionaries will be converted to ReprDict objects when returned.

Module contents#

NPU#

Documentation is available in the docstrings and online at https://riallto.ai.

Provides
  1. An easy-to-use runtime library to run custom applications on the NPU.

  2. APIs for building custom applications.

  3. Useful utilities to test and introspect your designs.

Available subpackages#

build

Tools for building applications.

lib

Libraries of prebuilt kernels and graphs.

runtime

Runtime libraries based on XRT.

utils

Utilities for building, testing and visualization.