Skip to content

CPU Offloading (Beta Version)

Remark To proceed inference with CPU offloading, it requires a runtime library that supports the MXQ file that is compiled for CPU offloading.

From qbcompiler v0.7, we provide a Beta version of CPU offloading for MXQ compilation. CPU offloading makes it easier for users to compile their models by automatically offloading the computation that Mobilint NPU does not support to the CPU. For example, if a pre-processing or post-processing included in the model involves operations that the NPU does not support, the user would have to implement them manually after compiling. However, CPU offloading covers most of these operations and eliminates the need for additional work.

When CPU offloading is employed, the procedures for preparing the calibration dataset and compiling the model vary slightly as follows:

  1. The pre-processed input shape should match the original model's input shape, whereas the pre-processed input shape should be in the format (H, W, C) to compile the model without CPU offloading.
  2. Set the argument cpu_offload of function mxq_compile True to enable CPU offloading.

SDK CPU Offloading

CPU Offload Operator Scope

The following MXQ layer types are executable by the CPU Offload path in qb Runtime 1.0.0. The installed runtime determines CPU execution support independently of the qb Compiler release. The model must also satisfy operator attributes, input shapes and dtypes, and graph partitioning requirements.

Inputs, constants, and dtypes

  • Bridge
  • Cast
  • ConstantOfShape
  • Input
  • InputConstant
  • Range

Arithmetic and math

  • Abs
  • Adding
  • AddingConstant
  • Div
  • DivConstant
  • Exp
  • Log
  • MatMul
  • Mod
  • Multiply
  • MultiplyConstant
  • Pow
  • Sqrt
  • Sub
  • SubConstant

Activations and normalization

  • Clip
  • GroupNormalization
  • InstanceNormalization
  • LayerNormalization
  • Relu
  • Sigmoid
  • Softmax
  • Softplus
  • Tanh

Comparisons and logic

  • And
  • Equal
  • Greater
  • Less
  • Not
  • Or
  • Where
  • Xor

Shapes and axes

  • Concatenate
  • Expand
  • Flatten
  • Flip
  • HeaderView
  • Reshape
  • Reverse
  • Shape
  • Split
  • Squeeze
  • Tile
  • Transpose
  • Unsqueeze

Indexing, selection, and reduction

  • ArgMax
  • Gather
  • GatherConstant
  • GatherElements
  • GatherND
  • NonZero
  • ReduceMax
  • ReduceMean
  • ReduceMin
  • ReduceProd
  • ReduceSum
  • ScatterND
  • Slice
  • TopKIndices
  • TopKValues

Spatial and specialized operations

  • GridSample
  • MeloTTSPiecewiseRationalQuadraticTransform
  • Pooling
  • Resize

An operator absent from this table is not covered by this runtime's CPU Offload path. The names are MXQ layer types, which can differ from source framework operator names.