How to Use the Header File on Which Tiling Depends

The Scalar Unit of the AI processor has limited execution capability. Therefore, to reduce scalar computations on the operator kernel, some computations are executed on the host. In this case, you need to compile the tiling code on the host. Note that the dependent header file needs to be imported when the tiling API of the high-level APIs is called or the tiling structure parameter of the high-level APIs is used in the program. In different tiling implementation modes, the details are as follows:

  • Using the standard C++ syntax to define the tiling structure
    In this mode, the following dependent header file need to be imported. The tiling structures of all high-level APIs are defined in the AscendC::tiling namespace. Therefore, you need to use AscendC::tiling to access the tiling structure of a specific API.
    1
    2
    3
    4
    #include "kernel_tiling/kernel_tiling.h"
    
    // ...
    AscendC::tiling::TCubeTiling cubeTilingData;
    
  • Using the TILING_DATA_DEF macro to define the tiling structure
    In this mode, the following dependent header file need to be imported. The tiling structures and tiling functions of all high-level APIs are defined in the optiling namespace.
    1
    2
    3
    4
    5
    #include "tiling/tiling_api.h"
    
    namespace optiling {
    // ...
    }