An operator is used to add PRINTF printing to the kernel implementation code, but the tiling information obtained by the kernel is incorrect.
The added printing code is as follows:
1 | PRINTF("tiling_data.totalLength: %d tiling_data.tileNum: %d.\n", tiling_data.totalLength, tiling_data.tileNum); |
The printed tiling data is all 0s:
1 | tiling_data.totalLength: 0 tiling_data.tileNum: 0. |
The possible causes are as follows:
1 | std::cout<<*reinterpret_cast<uint32_t *>(context->GetRawTilingData()->GetData())<<std::endl; // Print the first parameter value of TilingData based on the actual data type. To verify other values, offset the value pointer backward. |
When you use the msOpGen tool to create an operator project and develop operators in the kernel based on the project, the definition template of the kernel function has been automatically generated by the msOpGen tool. The parameters are arranged in the sequence of "input, output, workspace, tiling". Check whether the parameter sequence is changed.
1 2 3 4 5 | #include "kernel_operator.h" extern "C" __global__ __aicore__ void add_custom(GM_ADDR x, GM_ADDR y, GM_ADDR z, GM_ADDR workspace, GM_ADDR tiling) { GET_TILING_DATA(tiling_data, tiling);// Obtain tiling parameters. // TODO: user kernel impl } |