|
|
@@ -16,7 +16,7 @@ |
|
|
|
|
|
|
|
#include <gtest/gtest.h> |
|
|
|
#include <vector> |
|
|
|
|
|
|
|
#include <iostream> |
|
|
|
#include "graph/load/model_manager/model_utils.h" |
|
|
|
#include "graph/utils/graph_utils.h" |
|
|
|
#include "hybrid/node_executor/aicpu/aicpu_ext_info.h" |
|
|
@@ -25,6 +25,7 @@ |
|
|
|
#define protected public |
|
|
|
#define private public |
|
|
|
#include "single_op/single_op_model.h" |
|
|
|
#include "aicpu/common/aicpu_task_struct.h" |
|
|
|
#include "single_op/task/tbe_task_builder.h" |
|
|
|
#include "single_op/task/op_task.h" |
|
|
|
#include "single_op/task/tbe_task_builder.h" |
|
|
@@ -38,6 +39,13 @@ using namespace testing; |
|
|
|
using namespace ge; |
|
|
|
using namespace optiling; |
|
|
|
|
|
|
|
namespace { |
|
|
|
struct AicpuTaskStruct { |
|
|
|
aicpu::AicpuParamHead head; |
|
|
|
uint64_t io_addrp[3]; |
|
|
|
}__attribute__((packed)); |
|
|
|
} // namespace |
|
|
|
|
|
|
|
class UtestSingleOpTask : public testing::Test { |
|
|
|
protected: |
|
|
|
void SetUp() { |
|
|
@@ -195,6 +203,7 @@ TEST_F(UtestSingleOpTask, test_atomic_exec) { |
|
|
|
optiling::utils::OpRunInfo run_info(0, true, 0); |
|
|
|
task.CalcTilingInfo(run_info); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(UtestSingleOpTask, test_aicpu_task_launch_kernel) { |
|
|
|
AiCpuCCTask task; |
|
|
|
rtStream_t stream; |
|
|
@@ -207,8 +216,31 @@ TEST_F(UtestSingleOpTask, test_aicpu_task_launch_kernel) { |
|
|
|
task.io_addr_ = reinterpret_cast<uintptr_t*>(addrs); |
|
|
|
task.io_addr_num_ = total_addr; |
|
|
|
vector<DataBuffer> outputs(1, DataBuffer()); |
|
|
|
outputs[0].data = 0; |
|
|
|
task.unknown_type_ = ge::DEPEND_COMPUTE; |
|
|
|
ASSERT_EQ(task.InitForSummaryAndCopy(), SUCCESS); |
|
|
|
auto &summary = task.output_summary_host_[0]; |
|
|
|
summary.shape_data_ptr = 0; |
|
|
|
summary.shape_data_size = 1; |
|
|
|
summary.raw_data_ptr = 0; |
|
|
|
summary.raw_data_size = 1; |
|
|
|
void *shape_buffer = nullptr; |
|
|
|
rtMalloc(&shape_buffer, 1, RT_MEMORY_HBM); |
|
|
|
task.out_shape_hbm_.emplace_back(shape_buffer); |
|
|
|
task.memcpy_so_name_ = "libcpu_kernel.so"; |
|
|
|
task.memcpy_kernel_name_ = "RunCpuKernel"; |
|
|
|
AicpuTaskStruct args; |
|
|
|
args.head.length = sizeof(args); |
|
|
|
args.head.ioAddrNum = 3; |
|
|
|
domi::TaskDef task_def; |
|
|
|
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); |
|
|
|
auto &memcpy_args = kernel_def->args(); |
|
|
|
task.memcpy_args_size_ = kernel_def->args_size(); |
|
|
|
task.memcpy_args_.reset(new(std::nothrow) uint8_t[task.memcpy_args_size_]()); |
|
|
|
memcpy_s(task.memcpy_args_.get(), task.memcpy_args_size_, memcpy_args.c_str(), memcpy_args.size()); |
|
|
|
ASSERT_EQ(task.CopyDataToHbm(outputs, stream), SUCCESS); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(UtestSingleOpTask, test_aicpu_task_update_io_addr) { |
|
|
|