From 26d1960dc1a7b69aefed9ecd9b78d04634bf7e38 Mon Sep 17 00:00:00 2001 From: wqtshg Date: Mon, 31 May 2021 15:19:55 +0800 Subject: [PATCH] Zero copy nodes are not allocated memory in the known subgraph --- tests/ut/ge/graph/load/davinci_model_unittest.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/ut/ge/graph/load/davinci_model_unittest.cc b/tests/ut/ge/graph/load/davinci_model_unittest.cc index 4771ca8d..3f9cc850 100644 --- a/tests/ut/ge/graph/load/davinci_model_unittest.cc +++ b/tests/ut/ge/graph/load/davinci_model_unittest.cc @@ -1048,4 +1048,15 @@ TEST_F(UtestDavinciModel, update_io_addr_success) { vector io_addr = {nullptr, nullptr}; model.UpdateOpIOAddrs(task_id, stream_id, io_addr); } +TEST_F(UtestDavinciModel, get_total_memsize_exclude_zero_copy) { + DavinciModel model(0, nullptr); + model.runtime_param_.mem_size = 1024; + model.runtime_param_.zero_copy_size = 2048; + int64_t total_useful_size = 0; + EXPECT_EQ(model.GetTotalMemSizeExcludeZeroCopy(total_useful_size), FAILED); + EXPECT_EQ(total_useful_size, 0); + model.runtime_param_.zero_copy_size = 512; + EXPECT_EQ(model.GetTotalMemSizeExcludeZeroCopy(total_useful_size), SUCCESS); + EXPECT_EQ(total_useful_size, 512); +} } // namespace ge