已合并
feat: add h2d overlapped with compute option #3969
feat: add h2d overlapped with compute option #3969
已合并
GengChao创建于 7月11日
共 11 个文件变更+275-12
@@ -119,6 +119,10 @@ DEFINE_string(static_model_ops_lower_limit, "",
119 "Optional; set the lower limit of static subgraph op count in dynamic shape partition. "119 "Optional; set the lower limit of static subgraph op count in dynamic shape partition. "
120 "The value must be an integer greater than or equal to -1.");120 "The value must be an integer greater than or equal to -1.");
121 121 
122+DEFINE_string(h2d_overlapped_with_compute, "",
123+ "Optional; enable input H2D overlap for static shape models. "
124+ "0(default): disable; 1: enable default DP; boundaries like 44,64,68.");
125+ 
122DEFINE_string(raw_ge_options, "", "Optional; raw GE options json file path. Only \"compile options\" will be parsed.");126DEFINE_string(raw_ge_options, "", "Optional; raw GE options json file path. Only \"compile options\" will be parsed.");
123 127 
124DEFINE_bool(128DEFINE_bool(
@@ -49,6 +49,7 @@ DECLARE_string(auto_tune_mode);
49DECLARE_string(jit_compile);49DECLARE_string(jit_compile);
50DECLARE_string(optimization_switch);50DECLARE_string(optimization_switch);
51DECLARE_string(static_model_ops_lower_limit);51DECLARE_string(static_model_ops_lower_limit);
52+DECLARE_string(h2d_overlapped_with_compute);
52DECLARE_string(raw_ge_options);53DECLARE_string(raw_ge_options);
53DECLARE_bool(raw_ge_options_ignore_unsupported);54DECLARE_bool(raw_ge_options_ignore_unsupported);
54DECLARE_string(soc_version);55DECLARE_string(soc_version);
@@ -147,6 +147,7 @@ const std::unordered_set<std::string> kOm2UnsuppotedFlag = {
147 "compress_weight_conf",147 "compress_weight_conf",
148 "enable_compress_weight",148 "enable_compress_weight",
149 "enable_attr_compression",149 "enable_attr_compression",
150+ "h2d_overlapped_with_compute",
150};151};
151 152 
152namespace ge {153namespace ge {
@@ -635,6 +636,8 @@ class GFlagUtils {
635 "E.g.: \"pass_name1:on;pass_name2:off\"\n"636 "E.g.: \"pass_name1:on;pass_name2:off\"\n"
636 " --static_model_ops_lower_limit Set the lower limit of static subgraph op count in dynamic shape "637 " --static_model_ops_lower_limit Set the lower limit of static subgraph op count in dynamic shape "
637 "partition. The value must be an integer greater than or equal to -1.\n"638 "partition. The value must be an integer greater than or equal to -1.\n"
639+ " --h2d_overlapped_with_compute Enable input H2D overlap for static shape models. "
640+ "0(default): disable; 1: enable default DP; boundaries like 44,64,68.\n"
638 " --op_select_implmode Set op select implmode. Support high_precision, high_performance, "641 " --op_select_implmode Set op select implmode. Support high_precision, high_performance, "
639 "high_precision_for_all, high_performance_for_all. default: high_performance\n"642 "high_precision_for_all, high_performance_for_all. default: high_performance\n"
640 " --optypelist_for_implmode Appoint which op to select implmode, cooperated with op_select_implmode.\n"643 " --optypelist_for_implmode Appoint which op to select implmode, cooperated with op_select_implmode.\n"
@@ -981,6 +984,9 @@ class GFlagUtils {
981 std::numeric_limits<int64_t>::max()),984 std::numeric_limits<int64_t>::max()),
982 "[Check][StaticModelOpsLowerLimit]failed!");985 "[Check][StaticModelOpsLowerLimit]failed!");
983 }986 }
987+ if (!FLAGS_h2d_overlapped_with_compute.empty()) {
988+ GELOGI("[InputH2DOverlap] h2d_overlapped_with_compute is set to %s.", FLAGS_h2d_overlapped_with_compute.c_str());
989+ }
984 return SUCCESS;990 return SUCCESS;
985 }991 }
986 992 
@@ -1969,6 +1975,10 @@ void SetAtcJitOptions(std::map<std::string, std::string> &options) {
1969 options.insert(std::pair<std::string, std::string>(ge::OPTION_STATIC_MODEL_OPS_LOWER_LIMIT,1975 options.insert(std::pair<std::string, std::string>(ge::OPTION_STATIC_MODEL_OPS_LOWER_LIMIT,
1970 FLAGS_static_model_ops_lower_limit));1976 FLAGS_static_model_ops_lower_limit));
1971 }1977 }
1978+ if (!FLAGS_h2d_overlapped_with_compute.empty()) {
1979+ options.insert(
1980+ std::pair<std::string, std::string>(ge::OPTION_H2D_OVERLAPPED_WITH_COMPUTE, FLAGS_h2d_overlapped_with_compute));
1981+ }
1972}1982}
1973 1983 
1974Status PrepareAtcOptions(const std::map<std::string, std::string> &raw_options,1984Status PrepareAtcOptions(const std::map<std::string, std::string> &raw_options,
@@ -139,6 +139,105 @@
139 139 
140**生效级别**:全局/session140**生效级别**:全局/session
141 141 
142+## ge.compile.h2dOverlappedWithCompute
143+ 
144+用于配置模型输入的H2D拷贝是否与模型计算重叠执行。该参数作为图编译选项传递给GE。
145+ 
146+**参数取值:**
147+ 
148+- "0":关闭重叠。所有输入完成H2D拷贝后,模型才开始计算。默认值。
149+- "1":开启自动规划。GE自动对输入分组,并在模型计算过程中拷贝部分输入。
150+- 逗号分隔的分组边界,例如"44,64,68":手动指定输入如何分组。
151+ 
152+**工作方式:**
153+ 
154+GE首先筛选可以参与该功能的输入,并按照输入首次被使用的位置排序:
155+ 
156+- 首次消费节点的拓扑序越小,排序越靠前。
157+- 首次消费节点相同时,按input index升序排列。
158+ 
159+排序后,每个输入最初对应一个独立的H2D拷贝。接下来,GE将相邻输入合并为若干拷贝组。同一组内的输入会通过一条H2D拷贝指令批量拷贝到Device。
160+ 
161+第一组在模型开始计算前完成拷贝;其余组在模型计算过程中拷贝,与模型计算重叠执行。
162+ 
163+**手动分组:**
164+ 
165+手动配置的数字表示排序后输入序列的分组边界。例如:
166+ 
167+```text
168+44,64,68
169+```
170+ 
171+表示将输入分为四个拷贝组:
172+ 
173+```text
174+[0,44)、[44,64)、[64,68)、[68,N)
175+```
176+ 
177+其中,[0,44)在模型开始计算前完成拷贝,其余三组在模型计算过程中执行拷贝。
178+ 
179+如果只需要一个边界,可以配置为:
180+ 
181+```text
182+44,
183+```
184+ 
185+或:
186+ 
187+```text
188+,44
189+```
190+ 
191+两种写法均表示`[0,44)`在模型开始计算前完成拷贝,`[44,N)`在模型计算过程中执行拷贝。
192+ 
193+需要注意的是,**边界编号基于GE对候选输入的排序结果,不是模型的input index**。GE会通过INFO日志打印最终采用的分组边界和拷贝区间:
194+ 
195+```text
196+[InputH2DOverlap] H2D overlap groups: mode=auto, boundaries=[44,64,68]
197+```
198+ 
199+手动配置时,mode显示为manual:
200+ 
201+```text
202+[InputH2DOverlap] H2D overlap groups: mode=manual, boundaries=[44,64,68]
203+```
204+ 
205+**推荐配置:**
206+ 
207+适用于静态shape、单流图,并且模型包含较多Host输入、H2D拷贝开销较大、模型前段计算能够覆盖部分输入拷贝场景。
208+ 
209+建议先配置为"1",由GE自动规划,并根据上文INFO日志查看实际分组结果。
210+ 
211+如果profiling trace中显示模型计算存在明显的H2D等待,说明被等待的拷贝组过长,此时可手动调整分组边界,减少本组的拷贝数量。
212+ 
213+> 注:GE INFO日志通过环境变量`ASCEND_GLOBAL_LOG_LEVEL`设置,取值为`1`表示INFO级别(0=DEBUG,1=INFO,2=WARN,3=ERROR),详细说明请参见[《环境变量参考》](https://hiascend.com/document/redirect/CannCommunityEnvRef)。
214+ 
215+**配置示例:**
216+ 
217+- 自动规划:
218+ 
219+```c++
220+{"ge.compile.h2dOverlappedWithCompute", "1"};
221+```
222+ 
223+- 手动分组:
224+ 
225+```c++
226+{"ge.compile.h2dOverlappedWithCompute", "44,64,68"};
227+```
228+ 
229+**使用约束:**
230+ 
231+- 当前仅对静态shape模型生效。
232+- 当前仅支持单流图。
233+- 手动配置的边界必须是非负整数,并按升序排列。
234+- 手动配置的边界必须以当前模型日志打印的输入排序和分组结果为准。
235+- 模型结构或拓扑排序发生变化后,需要重新确认分组边界。
236+ 
237+**必选/可选**:可选
238+ 
239+**生效级别**:全局/session/graph
240+ 
142## ge.graph\_compiler\_cache\_dir241## ge.graph\_compiler\_cache\_dir
143 242 
144图编译磁盘缓存目录,和ge.graph\_key配合使用,ge.graph\_compiler\_cache\_dir和ge.graph\_key同时配置非空时图编译磁盘缓存功能生效。243图编译磁盘缓存目录,和ge.graph\_key配合使用,ge.graph\_compiler\_cache\_dir和ge.graph\_key同时配置非空时图编译磁盘缓存功能生效。
@@ -0,0 +1,108 @@
1+# --h2d\_overlapped\_with\_compute
2+ 
3+## 产品支持情况
4+ 
5+全量芯片支持。
6+ 
7+## 功能说明
8+ 
9+用于配置模型输入的H2D拷贝是否与模型计算重叠执行。该参数作为图编译选项传递给GE。
10+ 
11+## 关联参数
12+ 
13+无。
14+ 
15+## 参数取值
16+ 
17+**参数值:**
18+ 
19+- "0":关闭重叠。所有输入完成H2D拷贝后,模型才开始计算。默认值。
20+- "1":开启自动规划。GE自动对输入分组,并在模型计算过程中拷贝部分输入。
21+- 逗号分隔的分组边界,例如"44,64,68":手动指定输入如何分组。
22+ 
23+**工作方式:**
24+ 
25+GE首先筛选可以参与该功能的输入,并按照输入首次被使用的位置排序:
26+ 
27+- 首次消费节点的拓扑序越小,排序越靠前。
28+- 首次消费节点相同时,按input index升序排列。
29+ 
30+排序后,每个输入最初对应一个独立的H2D拷贝。接下来,GE将相邻输入合并为若干拷贝组。同一组内的输入会通过一条H2D拷贝指令批量拷贝到Device。
31+ 
32+第一组在模型开始计算前完成拷贝;其余组在模型计算过程中拷贝,与模型计算重叠执行。
33+ 
34+**手动分组:**
35+ 
36+手动配置的数字表示排序后输入序列的分组边界。例如:
37+ 
38+```text
39+44,64,68
40+```
41+ 
42+表示将输入分为四个拷贝组:
43+ 
44+```text
45+[0,44)、[44,64)、[64,68)、[68,N)
46+```
47+ 
48+其中,[0,44)在模型开始计算前完成拷贝,其余三组在模型计算过程中执行拷贝。
49+ 
50+如果只需要一个边界,可以配置为:
51+ 
52+```text
53+44,
54+```
55+ 
56+或:
57+ 
58+```text
59+,44
60+```
61+ 
62+两种写法均表示`[0,44)`在模型开始计算前完成拷贝,`[44,N)`在模型计算过程中执行拷贝。
63+ 
64+需要注意的是,**边界编号基于GE对候选输入的排序结果,不是模型的input index**。GE会通过INFO日志打印最终采用的分组边界和拷贝区间:
65+ 
66+```text
67+[InputH2DOverlap] H2D overlap groups: mode=auto, boundaries=[44,64,68]
68+```
69+ 
70+手动配置时,mode显示为manual:
71+ 
72+```text
73+[InputH2DOverlap] H2D overlap groups: mode=manual, boundaries=[44,64,68]
74+```
75+ 
76+**参数默认值**:"0"
77+ 
78+## 推荐配置及收益
79+ 
80+适用于静态shape、单流图,并且模型包含较多Host输入、H2D拷贝开销较大、模型前段计算能够覆盖部分输入拷贝的场景。
81+ 
82+建议先配置为"1",由GE自动规划,并根据上文INFO日志查看实际分组结果。
83+ 
84+如果profiling trace中显示模型计算存在明显的H2D等待,说明被等待的拷贝组过长,此时可手动调整分组边界,减少本组的拷贝数量。
85+ 
86+> 注:GE INFO日志通过环境变量`ASCEND_GLOBAL_LOG_LEVEL`设置,取值为`1`表示INFO级别(0=DEBUG,1=INFO,2=WARN,3=ERROR),详细说明请参见[《环境变量参考》](https://hiascend.com/document/redirect/CannCommunityEnvRef)。
87+ 
88+## 示例
Sophia1213
Sophia1213Sophia12137月13日

如下调用示例合到一起,

 atc --h2d_overlapped_with_compute=1 --model=model.onnx ...
 或
atc --h2d_overlapped_with_compute=44,64,68 --model=model.onnx ...
likedislike
89+ 
90+- 自动规划:
91+ 
92+```bash
93+atc --h2d_overlapped_with_compute=1 --model=model.onnx ...
94+```
95+ 
96+- 手动分组:
97+ 
98+```bash
99+atc --h2d_overlapped_with_compute=44,64,68 --model=model.onnx ...
100+```
101+ 
102+## 依赖约束
103+ 
104+- 当前仅对静态shape模型生效。
105+- 当前仅支持单流图。
106+- 手动配置的边界必须是非负整数,并按升序排列。
107+- 手动配置的边界必须以当前模型日志打印的输入排序和分组结果为准。
108+- 模型结构或拓扑排序发生变化后,需要重新确认分组边界。
@@ -55,6 +55,7 @@
55 - [--enable\_small\_channel](--enable_small_channel.md)55 - [--enable\_small\_channel](--enable_small_channel.md)
56 - [--fusion\_switch\_file](--fusion_switch_file.md)56 - [--fusion\_switch\_file](--fusion_switch_file.md)
57 - [--hccl\_sub\_comm\_config](--hccl_sub_comm_config.md)57 - [--hccl\_sub\_comm\_config](--hccl_sub_comm_config.md)
58+ - [--h2d\_overlapped\_with\_compute](--h2d_overlapped_with_compute.md)
58 - [--mdl\_bank\_path](--mdl_bank_path.md)59 - [--mdl\_bank\_path](--mdl_bank_path.md)
59 - [--oo\_constant\_folding](--oo_constant_folding.md)60 - [--oo\_constant\_folding](--oo_constant_folding.md)
60 - [--oo\_dead\_code\_elimination](--oo_dead_code_elimination.md)61 - [--oo\_dead\_code\_elimination](--oo_dead_code_elimination.md)
@@ -178,6 +178,7 @@ const char_t *const OPTION_EXECUTE_TIMES = "execute_times";
178const char_t *const OPTION_ES_MAX_REMOTEOP_NUM_PER_STREAM = "es_max_remoteop_num_per_stream";178const char_t *const OPTION_ES_MAX_REMOTEOP_NUM_PER_STREAM = "es_max_remoteop_num_per_stream";
179const char_t *const OPTION_HOST_SCHEDULING_MAX_THRESHOLD = "ge.exec.hostSchedulingMaxThreshold";179const char_t *const OPTION_HOST_SCHEDULING_MAX_THRESHOLD = "ge.exec.hostSchedulingMaxThreshold";
180const char_t *const OPTION_EXTERNAL_WEIGHT_DIR = "ge.externalWeightDir";180const char_t *const OPTION_EXTERNAL_WEIGHT_DIR = "ge.externalWeightDir";
181+const char_t *const OPTION_H2D_OVERLAPPED_WITH_COMPUTE = "ge.compile.h2dOverlappedWithCompute";
181 182 
182// option for experimental183// option for experimental
183const char_t *const OPTION_STATIC_MODEL_OPS_LOWER_LIMIT = "ge.exec.static_model_ops_lower_limit";184const char_t *const OPTION_STATIC_MODEL_OPS_LOWER_LIMIT = "ge.exec.static_model_ops_lower_limit";
@@ -686,6 +687,7 @@ static const char_t *const OPTION_EXPORT_COMPILE_STAT = ge::OPTION_EXPORT_COMPIL
686static const char_t *const OPTIMIZATION_SWITCH = ge::OPTIMIZATION_SWITCH;687static const char_t *const OPTIMIZATION_SWITCH = ge::OPTIMIZATION_SWITCH;
687static const char_t *const INPUT_HINT_SHAPE = ge::INPUT_HINT_SHAPE;688static const char_t *const INPUT_HINT_SHAPE = ge::INPUT_HINT_SHAPE;
688static const char_t *const OPTION_OUTPUT_REUSE_INPUT_MEM_INDEXES = ge::OPTION_OUTPUT_REUSE_INPUT_MEM_INDEXES;689static const char_t *const OPTION_OUTPUT_REUSE_INPUT_MEM_INDEXES = ge::OPTION_OUTPUT_REUSE_INPUT_MEM_INDEXES;
690+static const char_t *const OPTION_H2D_OVERLAPPED_WITH_COMPUTE = ge::OPTION_H2D_OVERLAPPED_WITH_COMPUTE;
689static const char_t *const OFFLINE_MODE = "ge.offlineMode";691static const char_t *const OFFLINE_MODE = "ge.offlineMode";
690static const char_t *const EXEC_DEVICE_CONFIG_PATH = "ge.exec.exec_device_config_path";692static const char_t *const EXEC_DEVICE_CONFIG_PATH = "ge.exec.exec_device_config_path";
691// for interface: aclgrphBuildModel693// for interface: aclgrphBuildModel
@@ -741,6 +743,7 @@ const std::set<std::string> ir_builder_suppported_options = {INPUT_FORMAT,
741 OPTIMIZATION_SWITCH,743 OPTIMIZATION_SWITCH,
742 INPUT_HINT_SHAPE,744 INPUT_HINT_SHAPE,
743 OPTION_OUTPUT_REUSE_INPUT_MEM_INDEXES,745 OPTION_OUTPUT_REUSE_INPUT_MEM_INDEXES,
746+ OPTION_H2D_OVERLAPPED_WITH_COMPUTE,
S
Sshengnan7月13日

编译时开了这个选项,执行时是不是必须使用该方式执行了,比如aclmdl系列接口

likedislike
GengChao
GengChao
7月13日 评论:
744 OFFLINE_MODE,747 OFFLINE_MODE,
745 EXEC_DEVICE_CONFIG_PATH};748 EXEC_DEVICE_CONFIG_PATH};
746 749 
@@ -790,6 +793,7 @@ const std::set<std::string> global_options = {CORE_TYPE,
790 OO_CONSTANT_FOLDING,793 OO_CONSTANT_FOLDING,
791 OO_DEAD_CODE_ELIMINATION,794 OO_DEAD_CODE_ELIMINATION,
792 OPTION_EXPORT_COMPILE_STAT,795 OPTION_EXPORT_COMPILE_STAT,
796+ OPTION_H2D_OVERLAPPED_WITH_COMPUTE,
793 OPTIMIZATION_SWITCH};797 OPTIMIZATION_SWITCH};
794#endif798#endif
795} // namespace ir_option799} // namespace ir_option
@@ -40,6 +40,7 @@ DECLARE_string(display_model_info);
40DECLARE_string(jit_compile);40DECLARE_string(jit_compile);
41DECLARE_string(optimization_switch);41DECLARE_string(optimization_switch);
42DECLARE_string(static_model_ops_lower_limit);42DECLARE_string(static_model_ops_lower_limit);
43+DECLARE_string(h2d_overlapped_with_compute);
43DECLARE_string(raw_ge_options);44DECLARE_string(raw_ge_options);
44DECLARE_bool(raw_ge_options_ignore_unsupported);45DECLARE_bool(raw_ge_options_ignore_unsupported);
45DECLARE_string(save_original_model);46DECLARE_string(save_original_model);
@@ -106,6 +107,7 @@ class AtcTest : public testing::Test {
106 FLAGS_jit_compile = "1";107 FLAGS_jit_compile = "1";
107 FLAGS_optimization_switch = "";108 FLAGS_optimization_switch = "";
108 FLAGS_static_model_ops_lower_limit = "";109 FLAGS_static_model_ops_lower_limit = "";
110+ FLAGS_h2d_overlapped_with_compute = "";
109 FLAGS_raw_ge_options = "";111 FLAGS_raw_ge_options = "";
110 FLAGS_raw_ge_options_ignore_unsupported = false;112 FLAGS_raw_ge_options_ignore_unsupported = false;
111 FLAGS_save_original_model = "";113 FLAGS_save_original_model = "";
@@ -484,6 +484,33 @@ TEST_F(AtcCommonSTest, CheckPrecisionModeAndPrecisionModeV2) {
484 remove(Generatefile("", "tmp.om").c_str());484 remove(Generatefile("", "tmp.om").c_str());
485 MainImplTearDown();485 MainImplTearDown();
486}486}
487+ 
488+// H2D overlap option shares the same flow as deterministic: CLI flag is collected by SetAtcJitOptions
489+// into the options map, then GELib::Initialize writes it into global options and thread local context.
490+TEST_F(AtcCommonSTest, H2DOverlappedWithComputeOptionPassedToContext) {
491+ MainImplSetUp();
492+ std::string om_arg = "--model=st_run_data/origin_model/add.pb";
493+ std::string output_arg = Generatefile("--output=", "h2d_overlap_tmp");
494+ ge::GetThreadLocalContext().SetGlobalOption({});
495+ char *argv[] = {"atc",
496+ "--mode=0",
497+ "--framework=3",
498+ const_cast<char *>(om_arg.c_str()),
499+ const_cast<char *>(output_arg.c_str()),
500+ "--soc_version=\"Ascend310\"",
501+ "--h2d_overlapped_with_compute=1",
502+ "--input_format=NCHW",
503+ "--host_env_os=linux",
504+ "--host_env_cpu=x86_64"};
505+ (void)main_impl(sizeof(argv) / sizeof(argv[0]), argv);
506+ std::string ge_option;
507+ EXPECT_EQ(ge::GetThreadLocalContext().GetOption(ge::OPTION_H2D_OVERLAPPED_WITH_COMPUTE, ge_option),
508+ ge::GRAPH_SUCCESS);
509+ EXPECT_STREQ(ge_option.c_str(), "1");
510+ remove(Generatefile("", "h2d_overlap_tmp.om").c_str());
511+ MainImplTearDown();
512+ ReInitGe();
513+}
487TEST_F(AtcCommonSTest, pb_keep_dtype_invalid) {514TEST_F(AtcCommonSTest, pb_keep_dtype_invalid) {
488 unsetenv("ASCEND_OPP_PATH");515 unsetenv("ASCEND_OPP_PATH");
489 ReInitGe();516 ReInitGe();
@@ -212,6 +212,7 @@ TEST_F(AtcRawOptionsUTest, RawOptionNameHelpersMapCliAndUserOptions) {
212 EXPECT_FALSE(IsRawNonReplaceableCliOption("log"));212 EXPECT_FALSE(IsRawNonReplaceableCliOption("log"));
213 EXPECT_EQ(GetRawCliName("not.supported", option_to_cli_name), "");213 EXPECT_EQ(GetRawCliName("not.supported", option_to_cli_name), "");
214 EXPECT_EQ(GetRawCliName("log", option_to_cli_name), "--log");214 EXPECT_EQ(GetRawCliName("log", option_to_cli_name), "--log");
215+ EXPECT_EQ(GetRawCliName(OPTION_H2D_OVERLAPPED_WITH_COMPUTE, option_to_cli_name), "");
215 216 
216 std::unordered_map<std::string, std::string> user_options;217 std::unordered_map<std::string, std::string> user_options;
217 EXPECT_FALSE(IsCliOptionExplicitlySet("not.supported", option_to_cli_name, user_options));218 EXPECT_FALSE(IsCliOptionExplicitlySet("not.supported", option_to_cli_name, user_options));
@@ -234,6 +235,10 @@ TEST_F(AtcRawOptionsUTest, RawOptionValueValidationUsesCliAndRegisteredCheckers)
234 EXPECT_EQ(CheckRawRegisteredOptimizationOptionValue("ge.oo.raw_options_ut.not_registered", "bad"), ge::SUCCESS);235 EXPECT_EQ(CheckRawRegisteredOptimizationOptionValue("ge.oo.raw_options_ut.not_registered", "bad"), ge::SUCCESS);
235}236}
236 237 
238+TEST_F(AtcRawOptionsUTest, H2DOverlappedWithComputeOptionDoesNotUseRawOption) {
239+ EXPECT_EQ(GetRawCliName(OPTION_H2D_OVERLAPPED_WITH_COMPUTE, BuildRawGeOptionToCliNameMap()), "");
240+}
241+ 
237TEST_F(AtcRawOptionsUTest, FilterRawGeOptionsRejectsOrIgnoresUnsupportedAndValidatesSupported) {242TEST_F(AtcRawOptionsUTest, FilterRawGeOptionsRejectsOrIgnoresUnsupportedAndValidatesSupported) {
238 std::map<std::string, std::string> raw_options = {243 std::map<std::string, std::string> raw_options = {
239 {OPTION_STATIC_MODEL_OPS_LOWER_LIMIT, "3"},244 {OPTION_STATIC_MODEL_OPS_LOWER_LIMIT, "3"},
@@ -342,7 +342,8 @@ TEST_F(UtestMain, MainImplTest_global_options) {
342 "--input_format=NCHW",342 "--input_format=NCHW",
343 "--host_env_os=linux",343 "--host_env_os=linux",
344 "--host_env_cpu=x86_64",344 "--host_env_cpu=x86_64",
345- const_cast<char *>(build_config_arg.c_str())};345+ const_cast<char *>(build_config_arg.c_str()),
346+ "--h2d_overlapped_with_compute=1"};
346 int32_t ret = main_impl(sizeof(argv) / sizeof(argv[0]), argv);347 int32_t ret = main_impl(sizeof(argv) / sizeof(argv[0]), argv);
347 auto &options = GetMutableGlobalOptions();348 auto &options = GetMutableGlobalOptions();
348 auto it = options.find(ge::DETERMINISTIC);349 auto it = options.find(ge::DETERMINISTIC);
@@ -360,6 +361,12 @@ TEST_F(UtestMain, MainImplTest_global_options) {
360 if (it != options.end()) {361 if (it != options.end()) {
361 EXPECT_EQ(it->second, "make -s CXX=c++");362 EXPECT_EQ(it->second, "make -s CXX=c++");
362 }363 }
364+ // H2D overlap option flows from CLI -> SetAtcJitOptions -> GELib::Initialize -> global options
365+ it = options.find(ge::OPTION_H2D_OVERLAPPED_WITH_COMPUTE);
366+ EXPECT_NE(it, options.end());
367+ if (it != options.end()) {
368+ EXPECT_EQ(it->second, "1");
369+ }
363 EXPECT_NE(ret, 0);370 EXPECT_NE(ret, 0);
364 AtcFileFactory::RemoveFile(AtcFileFactory::Generatefile1("", "tmp.om").c_str());371 AtcFileFactory::RemoveFile(AtcFileFactory::Generatefile1("", "tmp.om").c_str());
365}372}
@@ -1624,10 +1631,8 @@ bool IsLegacySoFile(const std::string &file_path);
1624class UtestLegacySoPartition : public testing::Test {};1631class UtestLegacySoPartition : public testing::Test {};
1625 1632 
1626TEST_F(UtestLegacySoPartition, MixedFiles_LegacyMovedToEnd) {1633TEST_F(UtestLegacySoPartition, MixedFiles_LegacyMovedToEnd) {
1627- std::vector<std::string> fileList = {1634+ std::vector<std::string> fileList = {"/path/to/libop1.so", "/path/to/libop2_legacy.so", "/path/to/libop3.so",
1628- "/path/to/libop1.so", "/path/to/libop2_legacy.so",1635+ "/path/to/libop4_legacy.so", "/path/to/libop5.so"};
1629- "/path/to/libop3.so", "/path/to/libop4_legacy.so",
1630- "/path/to/libop5.so"};
1631 std::stable_partition(fileList.begin(), fileList.end(), ge::IsLegacySoFile);1636 std::stable_partition(fileList.begin(), fileList.end(), ge::IsLegacySoFile);
1632 ASSERT_EQ(fileList.size(), 5u);1637 ASSERT_EQ(fileList.size(), 5u);
1633 EXPECT_EQ(fileList[0], "/path/to/libop1.so");1638 EXPECT_EQ(fileList[0], "/path/to/libop1.so");
@@ -1667,10 +1672,8 @@ TEST_F(UtestLegacySoPartition, ShortFileName_TreatedAsNonLegacy) {
1667}1672}
1668 1673 
1669TEST_F(UtestLegacySoPartition, StabilityPreserved_RelativeOrderMaintained) {1674TEST_F(UtestLegacySoPartition, StabilityPreserved_RelativeOrderMaintained) {
1670- std::vector<std::string> fileList = {1675+ std::vector<std::string> fileList = {"/path/first.so", "/path/alpha_legacy.so", "/path/second.so",
1671- "/path/first.so", "/path/alpha_legacy.so",1676+ "/path/beta_legacy.so", "/path/third.so"};
1672- "/path/second.so", "/path/beta_legacy.so",
1673- "/path/third.so"};
1674 std::stable_partition(fileList.begin(), fileList.end(), ge::IsLegacySoFile);1677 std::stable_partition(fileList.begin(), fileList.end(), ge::IsLegacySoFile);
1675 EXPECT_EQ(fileList[0], "/path/first.so");1678 EXPECT_EQ(fileList[0], "/path/first.so");
1676 EXPECT_EQ(fileList[1], "/path/second.so");1679 EXPECT_EQ(fileList[1], "/path/second.so");
@@ -1687,9 +1690,8 @@ TEST_F(UtestLegacySoPartition, ExactLegacySoName_MovedToEnd) {
1687}1690}
1688 1691 
1689TEST_F(UtestLegacySoPartition, SimilarButNotLegacySuffix_NotMoved) {1692TEST_F(UtestLegacySoPartition, SimilarButNotLegacySuffix_NotMoved) {
1690- std::vector<std::string> fileList = {1693+ std::vector<std::string> fileList = {"/path/legacy.so", "/path/not_legacy.so.bak", "/path/real_legacy.so",
1691- "/path/legacy.so", "/path/not_legacy.so.bak",1694+ "/path/_legacy.sox"};
1692- "/path/real_legacy.so", "/path/_legacy.sox"};
1693 std::stable_partition(fileList.begin(), fileList.end(), ge::IsLegacySoFile);1695 std::stable_partition(fileList.begin(), fileList.end(), ge::IsLegacySoFile);
1694 EXPECT_EQ(fileList[0], "/path/legacy.so");1696 EXPECT_EQ(fileList[0], "/path/legacy.so");
1695 EXPECT_EQ(fileList[1], "/path/not_legacy.so.bak");1697 EXPECT_EQ(fileList[1], "/path/not_legacy.so.bak");