Enabling Tiling Offload

In static graph mode, scheduling performance can be optimized by graph offload. The complete computational graph is delivered to the device at a time, and subsequent execution is performed independently on the device without the need for host participation. This reduces the overhead of host-device interaction and improves execution efficiency. For certain operators, tiling computation depends on the specific values input during runtime (tiling value dependency), requiring dynamic computation of tiling parameters during execution. In such cases, the tiling offload optimization solution can be used: The tiling computation is offloaded to the AI CPU on the device, enabling efficient computation throughout the entire process on the device.

  • The tiling-offload operator built based on the CANN package of the new version (supporting tiling offload) is incompatible with the operating environment of the older CANN package (not supporting tiling offload).
  • Currently, only fused operators (vector and cube computation fusion) support tiling offload.
  • Tiling offload is supported only by the following product models:
    • Atlas A3 training product / Atlas A3 inference product
    • Atlas A2 training product / Atlas A2 inference product
    • Atlas 350 Accelerator Card: not supported

To enable tiling offload for a custom operator, perform the following steps. For details about the complete sample, see Tiling offload operator sample.

In the tiling offload scenario, the op_host directory structure of the operator project is as follows. The tiling implementation must be placed in a separate .cpp file, for example, add_custom_tiling_sink_tiling.cpp in the sample below.

├── op_host
│   ├── add_custom_tiling_sink.cpp // Operator prototype definition, as well as InferShape and InferDataType implementation
│   ├── add_custom_tiling_sink_tiling.cpp // Tiling function implementation
│   ├── add_custom_tiling_sink_tiling.h // TilingData structure definition and tiling function declaration
│   └── CMakeLists.txt

The following uses the AddCustom operator as an example to describe how to implement the key code files: