|
|
@@ -25,6 +25,7 @@ |
|
|
|
#include "single_op/single_op_model.h" |
|
|
|
#include "single_op/task/tbe_task_builder.h" |
|
|
|
#include "single_op/task/rts_kernel_task_builder.h" |
|
|
|
#include "aicpu/common/aicpu_task_struct.h" |
|
|
|
#include "single_op/task/op_task.h" |
|
|
|
#include "framework/common/helper/model_helper.h" |
|
|
|
#include "single_op/single_op.h" |
|
|
@@ -43,6 +44,11 @@ constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape"; |
|
|
|
const char *const kEngineNameAiCore = "AIcoreEngine"; |
|
|
|
const char *const kEngineNameAiCpu = "aicpu_ascend_kernel"; |
|
|
|
const char *const kEngineNameAiCpuTf = "aicpu_tf_kernel"; |
|
|
|
|
|
|
|
struct AicpuTaskStruct { |
|
|
|
aicpu::AicpuParamHead head; |
|
|
|
uint64_t io_addrp[6]; |
|
|
|
}__attribute__((packed)); |
|
|
|
} // namespace |
|
|
|
|
|
|
|
class UtestSingleOpModel : public testing::Test { |
|
|
@@ -377,6 +383,16 @@ TEST_F(UtestSingleOpModel, build_dynamic_task02) { |
|
|
|
domi::TaskDef *task_def = model_task_def->add_task(); |
|
|
|
task_def->set_type(RT_MODEL_TASK_KERNEL); |
|
|
|
domi::KernelDef *kernel_def = task_def->mutable_kernel(); |
|
|
|
kernel_def->set_args(reinterpret_cast<const char *>(&args), args.head.length); |
|
|
|
kernel_def->set_args_size(args.head.length); |
|
|
|
AicpuExtInfo aicpu_ext_info; |
|
|
|
aicpu_ext_info.infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_SHAPE_TYPE; |
|
|
|
aicpu_ext_info.infoLen = sizeof(int32_t); |
|
|
|
memcpy_s(aicpu_ext_info.infoMsg, sizeof(int32_t), &type, sizeof(int32_t)); |
|
|
|
char *ext_mem = (char*)malloc(sizeof(AicpuExtInfo) + sizeof(int32_t)); |
|
|
|
memcpy_s(ext_mem, sizeof(AicpuExtInfo) + sizeof(int32_t), &aicpu_ext_info, sizeof(AicpuExtInfo) + sizeof(int32_t)); |
|
|
|
kernel_def->set_kernel_ext_info(ext_mem, sizeof(AicpuExtInfo) + sizeof(int32_t)); |
|
|
|
kernel_def->set_kernel_ext_info_size(sizeof(AicpuExtInfo) + sizeof(int32_t)); |
|
|
|
domi::KernelContext *context = kernel_def->mutable_context(); |
|
|
|
context->set_kernel_type(6); // ccKernelType::AI_CPU |
|
|
|
|
|
|
|