已合并
[fix]修复 dump core-id 参数在没有timelineDetail时不拦截的问题 #250
wanghaopeng创建于 23 天前
[fix]修复 dump core-id 参数在没有timelineDetail时不拦截的问题 #250
已合并
共 4 个文件变更+175-54
| @@ -379,6 +379,13 @@ bool ArgChecker::CheckReplayMode(const Common::ProfArgs &config, std::string &ms | |||
| 379 | msg = "--replay-mode=range only support when --mstx=on"; | 379 | msg = "--replay-mode=range only support when --mstx=on"; |
| 380 | return false; | 380 | return false; |
| 381 | } | 381 | } |
| 382 | + if (chipType == ChipType::ASCEND950 && | ||
| 383 | + (config.argAicMetrics.pcSamplingEnable || config.argAicMetrics.roofline || config.argAicMetrics.isSource || | ||
| 384 | + config.argAicMetrics.pipeTimelineEnable || config.argAicMetrics.instrTimelineEnable)) { | ||
| 385 | + msg = "--aic-metrics=Source/PcSampling/Roofline/PipeTimeline/InstrTimeline is invalid when " | ||
| 386 | + "--replay-mode=range on Ascend 950"; | ||
| 387 | + return false; | ||
| 388 | + } | ||
| 382 | if (config.argAicMetrics.isDeviceToSimulator || config.argAicMetrics.isSource || | 389 | if (config.argAicMetrics.isDeviceToSimulator || config.argAicMetrics.isSource || |
| 383 | config.argAicMetrics.isMemoryDetail) { | 390 | config.argAicMetrics.isMemoryDetail) { |
| 384 | msg = "--aic-metrics=TimelineDetail/Source/MemoryDetail is invalid when --replay-mode=range"; | 391 | msg = "--aic-metrics=TimelineDetail/Source/MemoryDetail is invalid when --replay-mode=range"; |
| @@ -404,8 +411,14 @@ bool ArgChecker::CheckDump(const Common::ProfArgs &config, std::string &msg) con | |||
| 404 | return false; | 411 | return false; |
| 405 | } | 412 | } |
| 406 | if (config.runMode == "device" && config.argDump == "on") { | 413 | if (config.runMode == "device" && config.argDump == "on") { |
| 407 | - return CheckDeviceChipSupport( | 414 | + if (!CheckDeviceChipSupport( |
| 408 | - "--dump", {ChipProductType::ASCEND910B_SERIES, ChipProductType::ASCEND910_93_SERIES}, msg); | 415 | + "--dump", {ChipProductType::ASCEND910B_SERIES, ChipProductType::ASCEND910_93_SERIES}, msg)) { |
| 416 | + return false; | ||
| 417 | + } | ||
| 418 | + if (!config.argAicMetrics.isDeviceToSimulator) { | ||
| 419 | + msg = "--dump requires --aic-metrics=TimelineDetail."; | ||
| 420 | + return false; | ||
| 421 | + } | ||
| 409 | } | 422 | } |
| 410 | if (config.runMode == "simulator" && config.argDump == "on") { | 423 | if (config.runMode == "simulator" && config.argDump == "on") { |
| 411 | std::string socVersion = config.argSocVersion; | 424 | std::string socVersion = config.argSocVersion; |
| @@ -530,10 +543,16 @@ bool ArgChecker::CheckCoreId(const Common::ProfArgs &config, std::string &msg) c | |||
| 530 | } | 543 | } |
| 531 | } | 544 | } |
| 532 | if (config.runMode == "device") { | 545 | if (config.runMode == "device") { |
| 533 | - return CheckDeviceChipSupport("--core-id", | 546 | + if (!CheckDeviceChipSupport("--core-id", |
| 534 | - {ChipProductType::ASCEND910B_SERIES, ChipProductType::ASCEND910_93_SERIES, | 547 | + {ChipProductType::ASCEND910B_SERIES, ChipProductType::ASCEND910_93_SERIES, |
| 535 | - ChipProductType::ASCEND950_SERIES}, | 548 | + ChipProductType::ASCEND950_SERIES}, |
| 536 | - msg); | 549 | + msg)) { |
| 550 | + return false; | ||
| 551 | + } | ||
| 552 | + if (!config.argAicMetrics.isDeviceToSimulator) { | ||
| 553 | + msg = "--core-id requires --aic-metrics=TimelineDetail."; | ||
| 554 | + return false; | ||
| 555 | + } | ||
| 537 | } | 556 | } |
| 538 | return true; | 557 | return true; |
| 539 | } | 558 | } |
| @@ -83,8 +83,8 @@ msprof op --output=$HOME/projects/output $HOME/projects/MyApp/out/main blockdim | |||
| 83 | |--replay-mode|Replay mode for operator data collection. Options include `kernel`, `application`, and `range`. The default value is `kernel`. If set to `application`, the entire application is replayed multiple times.<br>In `application` mode, separately enabling some `aic-metrics` may lead to missing data in the `visualize_data.bin` file. To view complete `visualize_data.bin` data, you are advised to add `Default` to `--aic-metrics`. <li>If the value set to <code>kernel</code>, the kernel function of a single operator within the specified collection range is replayed multiple times. </li><li>If the value is set to <code>range</code>, multiple operators within the specified range are replayed multiple times as a whole. Multiple ranges can be specified, and ranges are independent of each other. </li>Note: <li>`application` mode is not supported in multi-device multi-operator scenarios. </li><li>Range-level replay must be used together with `--mstx=on` and is applicable only to the Atlas A3 training products, Atlas A3 inference products, Atlas A2 training products, and Atlas A2 inference products. </li><li>Range-level replay does not support collection of MC2 and LCCL operators and cannot be enabled together with <code>--kill=on</code>, <code>--aic-metrics=MemoryDetail</code>, <code>--aic-metrics=TimelineDetail</code>, and <code>--aic-metrics=Source</code>.</li>|No| | 83 | |--replay-mode|Replay mode for operator data collection. Options include `kernel`, `application`, and `range`. The default value is `kernel`. If set to `application`, the entire application is replayed multiple times.<br>In `application` mode, separately enabling some `aic-metrics` may lead to missing data in the `visualize_data.bin` file. To view complete `visualize_data.bin` data, you are advised to add `Default` to `--aic-metrics`. <li>If the value set to <code>kernel</code>, the kernel function of a single operator within the specified collection range is replayed multiple times. </li><li>If the value is set to <code>range</code>, multiple operators within the specified range are replayed multiple times as a whole. Multiple ranges can be specified, and ranges are independent of each other. </li>Note: <li>`application` mode is not supported in multi-device multi-operator scenarios. </li><li>Range-level replay must be used together with `--mstx=on` and is applicable only to the Atlas A3 training products, Atlas A3 inference products, Atlas A2 training products, and Atlas A2 inference products. </li><li>Range-level replay does not support collection of MC2 and LCCL operators and cannot be enabled together with <code>--kill=on</code>, <code>--aic-metrics=MemoryDetail</code>, <code>--aic-metrics=TimelineDetail</code>, and <code>--aic-metrics=Source</code>.</li>|No| |
| 84 | |--warm-up|When some operators are collected using msOpProf, they may fail to reach the minimum task time consumption for processor frequency increasing, resulting in frequency reduction, which affects the results. In this case, you can use **`--warm-up`** to specify the number of warm-up times to increase the running frequency of the AI Processor in advance, so that the data on the board is more accurate.<br>Note: <ul><li>The default value is 5, and the value range is [0, 500]. </li><li>This parameter does not take effect for the MC2 operator. </li><li>When range-level replay is enabled, the number of warm-up times must be at least 1 and cannot be set to `--warm-up=0`.</li></ul>|No| | 84 | |--warm-up|When some operators are collected using msOpProf, they may fail to reach the minimum task time consumption for processor frequency increasing, resulting in frequency reduction, which affects the results. In this case, you can use **`--warm-up`** to specify the number of warm-up times to increase the running frequency of the AI Processor in advance, so that the data on the board is more accurate.<br>Note: <ul><li>The default value is 5, and the value range is [0, 500]. </li><li>This parameter does not take effect for the MC2 operator. </li><li>When range-level replay is enabled, the number of warm-up times must be at least 1 and cannot be set to `--warm-up=0`.</li></ul>|No| |
| 85 | |--output|Path for storing the collected profile data. By default, the profile data is stored in the current directory.<br>Ensure that users in the group and other groups do not have the write permission on the parent directory of the path specified by `--output`. In addition, ensure that the owner of the parent directory of the directory specified by **--output** is the current user.|No| | 85 | |--output|Path for storing the collected profile data. By default, the profile data is stored in the current directory.<br>Ensure that users in the group and other groups do not have the write permission on the parent directory of the path specified by `--output`. In addition, ensure that the owner of the parent directory of the directory specified by **--output** is the current user.|No| |
| 86 | -|--dump|Specifies whether to generate the dump file of the simulator.<br>The value can be `on` or `off`. The default value is `off`, indicating that the simulator dump file is not generated.<br>Note: <ul><li>This parameter is valid only when `--aic-metrics=TimelineDetail` is used. It takes effect only for Atlas A2 training/inference products and Atlas A3 training/inference products. It does not take effect for Atlas inference products. </li><li>This parameter applies only to the single-process scenario and does not support the scenario where two operators run at the same time.</li></ul>|No| | 86 | +|--dump|Specifies whether to generate the dump file of the simulator.<br>The value can be `on` or `off`. The default value is `off`, indicating that the simulator dump file is not generated.<br>Note: <ul><li>This parameter is valid only when `--aic-metrics=TimelineDetail` is used. It takes effect only for Atlas A2 training/inference products and Atlas A3 training/inference products. It does not take effect for Atlas inference products or Ascend 950 products. </li><li>This parameter applies only to the single-process scenario and does not support the scenario where two operators run at the same time.</li></ul>|No| |
| 87 | -|--core-id|This parameter is used when the operators are evenly distributed. You can use `--core-id` to specify the IDs of some logical cores to parse their simulation data.<br>The core ID range is [0, 49].<br>Note: <ul><li>If you want to parse the simulation data of multiple cores, use the symbol "\|" to combine the core IDs. For example, --core-id="0\|31" indicates that the simulation data of cores 0 and 31 is parsed. </li><li>This parameter is valid only when the `--aic-metrics=TimelineDetail` option is used. It is valid only for the [instruction pipeline chart](./msopprof_simulator_user_guide.md#instruction-pipeline-chart) and operator code hotspot diagram (#operator code hotspot diagram). This parameter is applicable only to the Atlas A2 training series products/Atlas A2 inference series products and Atlas A3 training series products/Atlas A3 inference series products.</li></ul>|No| | 87 | +|--core-id|This parameter is used when the operators are evenly distributed. You can use `--core-id` to specify the IDs of some logical cores to parse their simulation data.<br>The core ID range is [0, 49].<br>Note: <ul><li>If you want to parse the simulation data of multiple cores, use the symbol "\|" to combine the core IDs. For example, --core-id="0\|31" indicates that the simulation data of cores 0 and 31 is parsed. </li><li>This parameter is valid only when the `--aic-metrics=TimelineDetail` option is used. It is valid only for the [instruction pipeline chart](./msopprof_simulator_user_guide.md#instruction-pipeline-chart) and operator code hotspot diagram (#operator code hotspot diagram). This parameter is applicable only to Atlas A2 training/inference products, Atlas A3 training/inference products, and Ascend 950 products.</li></ul>|No| |
| 88 | |-h, --help|Outputs help information.|No| | 88 | |-h, --help|Outputs help information.|No| |
| 89 | 89 | ||
| 90 | ## Tool Usage | 90 | ## Tool Usage |
| @@ -128,7 +128,7 @@ To implement the [cache heatmap jump](#cache-heatmap) function, perform the foll | |||
| 128 | 128 | ||
| 129 | **Starting the tool** | 129 | **Starting the tool** |
| 130 | 130 | ||
| 131 | -> [!NOTE]NOTE | 131 | +> [!NOTE]NOTE |
| 132 | > Currently, msOpProf does not support the `-O0` compilation option. | 132 | > Currently, msOpProf does not support the `-O0` compilation option. |
| 133 | 133 | ||
| 134 | 1. Log in to the operating environment and run the `msprof op optional parameter app [arguments]` command to enable operator tuning on the board. For details about the optional parameters, see [Command Reference](#command-reference). An example command is as follows: | 134 | 1. Log in to the operating environment and run the `msprof op optional parameter app [arguments]` command to enable operator tuning on the board. For details about the optional parameters, see [Command Reference](#command-reference). An example command is as follows: |
| @@ -140,7 +140,7 @@ To implement the [cache heatmap jump](#cache-heatmap) function, perform the foll | |||
| 140 | 2. Perform operator tuning in either of the following ways: | 140 | 2. Perform operator tuning in either of the following ways: |
| 141 | - Based on an executable file | 141 | - Based on an executable file |
| 142 | - Single-operator scenario (using `test` as an example) | 142 | - Single-operator scenario (using `test` as an example) |
| 143 | - > [!NOTE]NOTE | 143 | + > [!NOTE]NOTE |
| 144 | > The executable file name `test` in the example is for reference only. The actual name is subject to the executable file generated during compilation in the current project. | 144 | > The executable file name `test` in the example is for reference only. The actual name is subject to the executable file generated during compilation in the current project. |
| 145 | 145 | ||
| 146 | Example 1: | 146 | Example 1: |
| @@ -152,7 +152,7 @@ To implement the [cache heatmap jump](#cache-heatmap) function, perform the foll | |||
| 152 | Example 2: | 152 | Example 2: |
| 153 | 153 | ||
| 154 | ```shell | 154 | ```shell |
| 155 | - msprof op --aic-metrics=<select_metrics> --output=./output_data ./test | 155 | + msprof op --aic-metrics=<select_metrics> --output=./output_data ./test |
| 156 | ``` | 156 | ``` |
| 157 | 157 | ||
| 158 | - Multi-operator scenario | 158 | - Multi-operator scenario |
| @@ -173,29 +173,29 @@ To implement the [cache heatmap jump](#cache-heatmap) function, perform the foll | |||
| 173 | 173 | ||
| 174 | - Collecting data in the multi-device multi-operator scenario | 174 | - Collecting data in the multi-device multi-operator scenario |
| 175 | 175 | ||
| 176 | - > [!NOTE]NOTE | 176 | + > [!NOTE]NOTE |
| 177 | > When tuning MC2 or LCCL operators in multi-device parallel mode, several subdirectories named after device IDs will exist in the result directory, depending on the specified number of NPUs. The tuning results of each NPU are stored in the corresponding device ID directory. | 177 | > When tuning MC2 or LCCL operators in multi-device parallel mode, several subdirectories named after device IDs will exist in the result directory, depending on the specified number of NPUs. The tuning results of each NPU are stored in the corresponding device ID directory. |
| 178 | 178 | ||
| 179 | ```tex | 179 | ```tex |
| 180 | └──OPPROF_{timestamp}_XXX | 180 | └──OPPROF_{timestamp}_XXX |
| 181 | ├── device0 // ID of the AI processor used during running. | 181 | ├── device0 // ID of the AI processor used during running. |
| 182 | - └── device1 | 182 | + └── device1 |
| 183 | ├── OpName0 // Name of the operator collected. | 183 | ├── OpName0 // Name of the operator collected. |
| 184 | │ ├── 0 // Sequence in which operators are scheduled. | 184 | │ ├── 0 // Sequence in which operators are scheduled. |
| 185 | │ │ ├──dump // Folder for storing the process files. The meaning of this parameter is the same as that in single-operator collection. | 185 | │ │ ├──dump // Folder for storing the process files. The meaning of this parameter is the same as that in single-operator collection. |
| 186 | │ │ └──xxx_yyy.csv // xxx is the metric type name, for example, L2Cache. For metric types, see Table 2. yyy is the time sequence suffix, for example, L2Cache_20240603022812284.csv | 186 | │ │ └──xxx_yyy.csv // xxx is the metric type name, for example, L2Cache. For metric types, see Table 2. yyy is the time sequence suffix, for example, L2Cache_20240603022812284.csv |
| 187 | - │ │ └──visualize_data.bin | 187 | + │ │ └──visualize_data.bin |
| 188 | - ├── OpName1 | 188 | + ├── OpName1 |
| 189 | │ ├── 0 | 189 | │ ├── 0 |
| 190 | - │ │ ├──dump | 190 | + │ │ ├──dump |
| 191 | │ │ └──xxx_yyy.csv | 191 | │ │ └──xxx_yyy.csv |
| 192 | - │ │ └──visualize_data.bin | 192 | + │ │ └──visualize_data.bin |
| 193 | - ├── OpName2 | 193 | + ├── OpName2 |
| 194 | │ ├── 0 | 194 | │ ├── 0 |
| 195 | - │ │ ├── dump | 195 | + │ │ ├── dump |
| 196 | │ │ └── xxx_yyy.csv | 196 | │ │ └── xxx_yyy.csv |
| 197 | - │ │ └──visualize_data.bin | 197 | + │ │ └──visualize_data.bin |
| 198 | - │ │ └── trace.json // Applicable only to MC2 and LCCL operators. | 198 | + │ │ └── trace.json // Applicable only to MC2 and LCCL operators. |
| 199 | ``` | 199 | ``` |
| 200 | 200 | ||
| 201 | - Collecting data in the single-device multi-operator scenario | 201 | - Collecting data in the single-device multi-operator scenario |
| @@ -206,16 +206,16 @@ To implement the [cache heatmap jump](#cache-heatmap) function, perform the foll | |||
| 206 | │ ├── 0 // Sequence in which operators are scheduled. | 206 | │ ├── 0 // Sequence in which operators are scheduled. |
| 207 | │ │ ├── dump // Folder for storing the process files. The meaning of this parameter is the same as that in single-operator collection. | 207 | │ │ ├── dump // Folder for storing the process files. The meaning of this parameter is the same as that in single-operator collection. |
| 208 | │ │ └── xxx_yyy.csv // xxx is the metric type name, for example, L2Cache. For metric types, see Table 2. yyy is the time sequence suffix, for example, L2Cache_20240603022812284.csv | 208 | │ │ └── xxx_yyy.csv // xxx is the metric type name, for example, L2Cache. For metric types, see Table 2. yyy is the time sequence suffix, for example, L2Cache_20240603022812284.csv |
| 209 | - │ │ └──visualize_data.bin | 209 | + │ │ └──visualize_data.bin |
| 210 | │ ├── 1 | 210 | │ ├── 1 |
| 211 | - │ │ ├──dump | 211 | + │ │ ├──dump |
| 212 | │ │ └──xxx_yyy.csv | 212 | │ │ └──xxx_yyy.csv |
| 213 | - │ │ └──visualize_data.bin | 213 | + │ │ └──visualize_data.bin |
| 214 | - ├── OpName1 | 214 | + ├── OpName1 |
| 215 | │ ├── 0 | 215 | │ ├── 0 |
| 216 | - │ │ ├── dump | 216 | + │ │ ├── dump |
| 217 | │ │ └── xxx_yyy.csv | 217 | │ │ └── xxx_yyy.csv |
| 218 | - │ │ └── visualize_data.bin | 218 | + │ │ └── visualize_data.bin |
| 219 | ``` | 219 | ``` |
| 220 | 220 | ||
| 221 | - Collecting data in the single-device single-operator scenario | 221 | - Collecting data in the single-device single-operator scenario |
| @@ -231,7 +231,7 @@ To implement the [cache heatmap jump](#cache-heatmap) function, perform the foll | |||
| 231 | ├── OpBasicInfo.csv | 231 | ├── OpBasicInfo.csv |
| 232 | ├── PipeUtilization.csv | 232 | ├── PipeUtilization.csv |
| 233 | ├── ResourceConflictRatio.csv | 233 | ├── ResourceConflictRatio.csv |
| 234 | - ├── visualize_data.bin | 234 | + ├── visualize_data.bin |
| 235 | ``` | 235 | ``` |
| 236 | 236 | ||
| 237 | **Table 2** msOpProf mode files | 237 | **Table 2** msOpProf mode files |
| @@ -251,7 +251,7 @@ To implement the [cache heatmap jump](#cache-heatmap) function, perform the foll | |||
| 251 | |trace.json|Visualized MC2 pipeline file.| | 251 | |trace.json|Visualized MC2 pipeline file.| |
| 252 | 252 | ||
| 253 | > [!NOTE]NOTE | 253 | > [!NOTE]NOTE |
| 254 | - > | 254 | + > |
| 255 | > - visualize_data.bin can be visualized using MindStudio Insight. For details, see [MindStudio Insight Operator Tuning](https://gitcode.com/Ascend/msinsight/blob/master/docs/en/user_guide/operator_tuning.md). | 255 | > - visualize_data.bin can be visualized using MindStudio Insight. For details, see [MindStudio Insight Operator Tuning](https://gitcode.com/Ascend/msinsight/blob/master/docs/en/user_guide/operator_tuning.md). |
| 256 | > - The hot spot function function of msOpProf is supported only by <term>Atlas A2 training products and Atlas A2 inference products</term>. | 256 | > - The hot spot function function of msOpProf is supported only by <term>Atlas A2 training products and Atlas A2 inference products</term>. |
| 257 | > - Currently, [communication and computing pipeline chart](#communication-and-computing-pipeline-chart) can be generated only for MC2 and LCCL operators. | 257 | > - Currently, [communication and computing pipeline chart](#communication-and-computing-pipeline-chart) can be generated only for MC2 and LCCL operators. |
| @@ -273,13 +273,13 @@ For details about MindStudio Insight operations, see the [Details](https://gitco | |||
| 273 | 273 | ||
| 274 | The following shows the MindStudio Insight page of the `visualize_data.bin` file. | 274 | The following shows the MindStudio Insight page of the `visualize_data.bin` file. |
| 275 | 275 | ||
| 276 | -**Figure 1** Details page 1 | 276 | +**Figure 1** Details page 1 |
| 277 |  | 277 |  |
| 278 | 278 | ||
| 279 | - Core Occupancy displays the time consumption, total data throughput, and cache hit ratio of each physical core in a data pane, allowing developers to improve the usage efficiency of physical cores. | 279 | - Core Occupancy displays the time consumption, total data throughput, and cache hit ratio of each physical core in a data pane, allowing developers to improve the usage efficiency of physical cores. |
| 280 | 280 | ||
| 281 | > [!NOTE]NOTE | 281 | > [!NOTE]NOTE |
| 282 | - > | 282 | + > |
| 283 | > - Only <term>Atlas A3 training products, Atlas A3 inference products</term>, <term>Atlas A2 training products, Atlas A2 inference products</term>, and <term>Ascend 950 products</term> support this function. | 283 | > - Only <term>Atlas A3 training products, Atlas A3 inference products</term>, <term>Atlas A2 training products, Atlas A2 inference products</term>, and <term>Ascend 950 products</term> support this function. |
| 284 | > - The number of cores displayed depends on the hardware. | 284 | > - The number of cores displayed depends on the hardware. |
| 285 | 285 | ||
| @@ -288,7 +288,7 @@ The following shows the MindStudio Insight page of the `visualize_data.bin` file | |||
| 288 | - Memory workload analysis displays the active bandwidth of each MTE channel. (If MemoryDetail is not enabled, the active bandwidth of MTE1 and MTE2 channels on the Cube is not displayed.) The memory heatmap and data pane display the number of requests, transfer bandwidth, and usage of each channel. This helps developers analyze channels that may have bottlenecks. | 288 | - Memory workload analysis displays the active bandwidth of each MTE channel. (If MemoryDetail is not enabled, the active bandwidth of MTE1 and MTE2 channels on the Cube is not displayed.) The memory heatmap and data pane display the number of requests, transfer bandwidth, and usage of each channel. This helps developers analyze channels that may have bottlenecks. |
| 289 | 289 | ||
| 290 | > [!NOTE]NOTE | 290 | > [!NOTE]NOTE |
| 291 | - > | 291 | + > |
| 292 | > - The content displayed in data panes varies depending on the operator type. | 292 | > - The content displayed in data panes varies depending on the operator type. |
| 293 | > - The active bandwidth value function does not apply to <term>Atlas inference products</term>. | 293 | > - The active bandwidth value function does not apply to <term>Atlas inference products</term>. |
| 294 | > - <term>Atlas A3 training products or Atlas A3 inference products</term> does not support peak value (maximum bandwidth ratio) display. | 294 | > - <term>Atlas A3 training products or Atlas A3 inference products</term> does not support peak value (maximum bandwidth ratio) display. |
| @@ -310,13 +310,13 @@ The generated `visualize_data.bin` file can be visualized using MindStudio Insig | |||
| 310 | 310 | ||
| 311 | - The Roofline bottleneck analysis chart of <term>Atlas inference products</term> contains only the memory unit view. | 311 | - The Roofline bottleneck analysis chart of <term>Atlas inference products</term> contains only the memory unit view. |
| 312 | 312 | ||
| 313 | - **Figure 1** Roofline bottleneck analysis chart of <term>Atlas inference products</term> | 313 | + **Figure 1** Roofline bottleneck analysis chart of <term>Atlas inference products</term> |
| 314 |  | 314 |  |
| 315 | 315 | ||
| 316 | - For <term>Atlas A3 training products, Atlas A3 inference products</term>, <term>Atlas A2 training products, and Atlas A2 inference products</term>, different views are generated based on the operator type. For details, see [**Table 1** Roofline chart support for Atlas A3 training products, Atlas A3 inference products, Atlas A2 training products, and Atlas A2 inference products](#a2-a3-roofline-chart-support). | 316 | - For <term>Atlas A3 training products, Atlas A3 inference products</term>, <term>Atlas A2 training products, and Atlas A2 inference products</term>, different views are generated based on the operator type. For details, see [**Table 1** Roofline chart support for Atlas A3 training products, Atlas A3 inference products, Atlas A2 training products, and Atlas A2 inference products](#a2-a3-roofline-chart-support). |
| 317 | 317 | ||
| 318 | - **Figure 2** Roofline bottleneck analysis chart for <term>Atlas A3 training products, Atlas A3 inference products</term>, <term>Atlas A2 training products, and Atlas A2 inference products</term> | 318 | + **Figure 2** Roofline bottleneck analysis chart for <term>Atlas A3 training products, Atlas A3 inference products</term>, <term>Atlas A2 training products, and Atlas A2 inference products</term> |
| 319 | - | 319 | + |
| 320 |  | 320 |  |
| 321 | 321 | ||
| 322 | **Table 1** Roofline chart support for Atlas A3 training products, Atlas A3 inference products, Atlas A2 training products, and Atlas A2 inference products<a id="a2-a3-roofline-chart-support"></a> | 322 | **Table 1** Roofline chart support for Atlas A3 training products, Atlas A3 inference products, Atlas A2 training products, and Atlas A2 inference products<a id="a2-a3-roofline-chart-support"></a> |
| @@ -399,8 +399,8 @@ The generated `visualize_data.bin` file can be visualized using MindStudio Insig | |||
| 399 | 399 | ||
| 400 | - For <term>Ascend 950 products</term>, different views are generated based on the operator type. For details, see [**Table 2** Roofline chart support for <term>Ascend 950 products</term>](#a5-roofline-chart-support). | 400 | - For <term>Ascend 950 products</term>, different views are generated based on the operator type. For details, see [**Table 2** Roofline chart support for <term>Ascend 950 products</term>](#a5-roofline-chart-support). |
| 401 | 401 | ||
| 402 | - **Figure 3** Roofline bottleneck analysis chart for <term>Ascend 950 products</term> | 402 | + **Figure 3** Roofline bottleneck analysis chart for <term>Ascend 950 products</term> |
| 403 | - | 403 | + |
| 404 |  | 404 |  |
| 405 | 405 | ||
| 406 | **Table 2** Roofline chart support for <term>Ascend 520 products</term><a id="a5-roofline-chart-support"></a> | 406 | **Table 2** Roofline chart support for <term>Ascend 520 products</term><a id="a5-roofline-chart-support"></a> |
| @@ -463,7 +463,7 @@ The generated `visualize_data.bin` file can be visualized using MindStudio Insig | |||
| 463 | </tbody> | 463 | </tbody> |
| 464 | </table> | 464 | </table> |
| 465 | 465 | ||
| 466 | - > [!NOTE]NOTE | 466 | + > [!NOTE]NOTE |
| 467 | > The vector memory unit view of Ascend 950 products supports only the SIMT view. | 467 | > The vector memory unit view of Ascend 950 products supports only the SIMT view. |
| 468 | 468 | ||
| 469 | **Usage Instruction** | 469 | **Usage Instruction** |
| @@ -478,7 +478,7 @@ The Roofline performance analysis result of each unit or channel consists of a h | |||
| 478 | - Roofline: The horizontal line at the top of the chart, representing the theoretical maximum computing performance of the NPU. Regardless of how the arithmetic intensity is improved, the actual performance cannot exceed the hardware limit. | 478 | - Roofline: The horizontal line at the top of the chart, representing the theoretical maximum computing performance of the NPU. Regardless of how the arithmetic intensity is improved, the actual performance cannot exceed the hardware limit. |
| 479 | - Bandwidth slope: slope line that intersects with the roofline. Its intersection with the vertical axis depends on the theoretical maximum bandwidth. When the theoretical maximum bandwidth multiplied by the arithmetic intensity is less than the theoretical maximum computing performance of the NPU, the maximal computing power increases linearly with the arithmetic intensity. | 479 | - Bandwidth slope: slope line that intersects with the roofline. Its intersection with the vertical axis depends on the theoretical maximum bandwidth. When the theoretical maximum bandwidth multiplied by the arithmetic intensity is less than the theoretical maximum computing performance of the NPU, the maximal computing power increases linearly with the arithmetic intensity. |
| 480 | 480 | ||
| 481 | - > [!NOTE]NOTE | 481 | + > [!NOTE]NOTE |
| 482 | > The roofline and bandwidth slope together form the theoretical maximum computing power of an operator, which can be summarized as `min(NPU theoretical maximum computing performance, Theoretical maximum bandwidth * Actual arithmetic intensity)`. | 482 | > The roofline and bandwidth slope together form the theoretical maximum computing power of an operator, which can be summarized as `min(NPU theoretical maximum computing performance, Theoretical maximum bandwidth * Actual arithmetic intensity)`. |
| 483 | 483 | ||
| 484 | - For parameters of actual running coordinates, see [**Table 3** Actual running coordinate parameters](#actual-running-coordinate-parameters). | 484 | - For parameters of actual running coordinates, see [**Table 3** Actual running coordinate parameters](#actual-running-coordinate-parameters). |
| @@ -503,7 +503,7 @@ The Roofline analysis chart analyzes the performance percentage of operators and | |||
| 503 | - If the maximum pipeline ratio is greater than 80%, identify the type of the maximum pipeline ratio. | 503 | - If the maximum pipeline ratio is greater than 80%, identify the type of the maximum pipeline ratio. |
| 504 | - If the type of the maximum pipeline ratio is compute pipeline (cube ratio, vector ratio, or scalar ratio), the message "latency bound:compute caused" is displayed. | 504 | - If the type of the maximum pipeline ratio is compute pipeline (cube ratio, vector ratio, or scalar ratio), the message "latency bound:compute caused" is displayed. |
| 505 | 505 | ||
| 506 | - > [!NOTE]NOTE | 506 | + > [!NOTE]NOTE |
| 507 | > <term>Ascend 950 products</term> support only the cube ratio and scalar ratio types. | 507 | > <term>Ascend 950 products</term> support only the cube ratio and scalar ratio types. |
| 508 | 508 | ||
| 509 | - If the type of the maximum pipeline ratio is memory pipeline (MTE1 ratio, MTE2 ratio, or MTE3 ratio), the message "latency bound:memory caused" is displayed. | 509 | - If the type of the maximum pipeline ratio is memory pipeline (MTE1 ratio, MTE2 ratio, or MTE3 ratio), the message "latency bound:memory caused" is displayed. |
| @@ -526,16 +526,16 @@ Displays the L2 cache heatmap using the L2 cache access data of kernel functions | |||
| 526 | 526 | ||
| 527 | The following figure shows the cache heat map. | 527 | The following figure shows the cache heat map. |
| 528 | 528 | ||
| 529 | -**Figure 1** Cache heatmap | 529 | +**Figure 1** Cache heatmap |
| 530 |  | 530 |  |
| 531 | 531 | ||
| 532 | - **Hit** indicates the cacheline hits, and **Miss** indicates the cacheline misses, allowing you to analyze the L2 cache usage. | 532 | - **Hit** indicates the cacheline hits, and **Miss** indicates the cacheline misses, allowing you to analyze the L2 cache usage. |
| 533 | - On the **Cache** tab page, select a hit or miss event graph and click to enlarge the event graph. In the enlarged event graph, right-click the selected memory cell and choose **Show Instructions in Source** from the shortcut menu. The **Source** page is displayed, and the related instruction line is highlighted. | 533 | - On the **Cache** tab page, select a hit or miss event graph and click to enlarge the event graph. In the enlarged event graph, right-click the selected memory cell and choose **Show Instructions in Source** from the shortcut menu. The **Source** page is displayed, and the related instruction line is highlighted. |
| 534 | 534 | ||
| 535 | - **Figure 2** Operator code hot spot map corresponding to a cacheline | 535 | + **Figure 2** Operator code hot spot map corresponding to a cacheline |
| 536 |  | 536 |  |
| 537 | 537 | ||
| 538 | - > [!NOTE]NOTE | 538 | + > [!NOTE]NOTE |
| 539 | > To jump from the cache heatmap to the operator code hot spot map, configure msopprof in advance as described in [msOpProf Configuration](#tool-usage). | 539 | > To jump from the cache heatmap to the operator code hot spot map, configure msopprof in advance as described in [msOpProf Configuration](#tool-usage). |
| 540 | 540 | ||
| 541 | ## Communication and Computing Pipeline Chart | 541 | ## Communication and Computing Pipeline Chart |
| @@ -575,8 +575,8 @@ The `trace.json` file can be visualized using either the Chrome browser or MindS | |||
| 575 | 575 | ||
| 576 | Visualizes the generated `trace.json` or `visualize_data.bin` files. | 576 | Visualizes the generated `trace.json` or `visualize_data.bin` files. |
| 577 | 577 | ||
| 578 | - **Figure 1** Communication and computing pipeline chart | 578 | + **Figure 1** Communication and computing pipeline chart |
| 579 | - | 579 | + |
| 580 |  | 580 |  |
| 581 | 581 | ||
| 582 | - Displays the time consumption masking of the operator on the AICPU and AI Core to assess the MC2 operator performance. | 582 | - Displays the time consumption masking of the operator on the AICPU and AI Core to assess the MC2 operator performance. |
| @@ -585,7 +585,7 @@ The `trace.json` file can be visualized using either the Chrome browser or MindS | |||
| 585 | - Displays collective communication pipeline and task pipeline during multi-device running of operators communicating via HCCL. | 585 | - Displays collective communication pipeline and task pipeline during multi-device running of operators communicating via HCCL. |
| 586 | 586 | ||
| 587 | > [!NOTE]NOTE | 587 | > [!NOTE]NOTE |
| 588 | - > | 588 | + > |
| 589 | > - The MC2 operator can call the AllReduce, AllGather, ReduceScatter, and AlltoAll interfaces of the <term>Atlas A2 training products and Atlas A2 inference products</term> and the AllGather, ReduceScatter, and AlltoAllV interfaces of the <term>Atlas A3 training products and Atlas A3 inference products</term>. For details, see Advanced API \> Hccl \> [APIs on the HCCL Kernel Side](https://www.hiascend.com/document/detail/en/canncommercial/850/API/ascendcopapi/atlasascendc_api_07_0869.html) in the _Ascend C Operator Development API_. After the `-g` compilation option is added, click a specific API to associate the code call stack. | 589 | > - The MC2 operator can call the AllReduce, AllGather, ReduceScatter, and AlltoAll interfaces of the <term>Atlas A2 training products and Atlas A2 inference products</term> and the AllGather, ReduceScatter, and AlltoAllV interfaces of the <term>Atlas A3 training products and Atlas A3 inference products</term>. For details, see Advanced API \> Hccl \> [APIs on the HCCL Kernel Side](https://www.hiascend.com/document/detail/en/canncommercial/850/API/ascendcopapi/atlasascendc_api_07_0869.html) in the _Ascend C Operator Development API_. After the `-g` compilation option is added, click a specific API to associate the code call stack. |
| 590 | > - For support of MC2, LCCL, and common operators, see [**Table 1** Key Fields](#key-fields). | 590 | > - For support of MC2, LCCL, and common operators, see [**Table 1** Key Fields](#key-fields). |
| 591 | 591 | ||
| @@ -609,17 +609,17 @@ For detailed MindStudio Insight operations and field explanations, see [Timeline | |||
| 609 | - The pipeline chart feature is implemented based on sampling and is not directly related to the number of cores enabled by the user. Even if all cores are enabled, only the data of six cores is displayed. | 609 | - The pipeline chart feature is implemented based on sampling and is not directly related to the number of cores enabled by the user. Even if all cores are enabled, only the data of six cores is displayed. |
| 610 | - If data loss occurs when MarkStamp is used for for marking, you are advised to reduce the number and density of mark points. | 610 | - If data loss occurs when MarkStamp is used for for marking, you are advised to reduce the number and density of mark points. |
| 611 | 611 | ||
| 612 | -**Figure 1** Pipeline chart | 612 | +**Figure 1** Pipeline chart |
| 613 | 613 | ||
| 614 |  | 614 |  |
| 615 | 615 | ||
| 616 | You can use the [AscendC::MarkStamp API](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/900beta2/API/ascendcopapi/atlasascendc_api_07_00264.html) to perform pipeline marking at any point in the operator kernel code to identify the pipeline range. If a point with ID 13 is marked on the Vector core using this API, **MarkStamp13** will be displayed on the Scalar and Vector units in the chart. For details, see [**Figure 2** Custom Marking Chart](#custom-marking-chart). | 616 | You can use the [AscendC::MarkStamp API](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/900beta2/API/ascendcopapi/atlasascendc_api_07_00264.html) to perform pipeline marking at any point in the operator kernel code to identify the pipeline range. If a point with ID 13 is marked on the Vector core using this API, **MarkStamp13** will be displayed on the Scalar and Vector units in the chart. For details, see [**Figure 2** Custom Marking Chart](#custom-marking-chart). |
| 617 | 617 | ||
| 618 | -**Figure 2** Custom marking chart<a id="custom-marking-chart"></a> | 618 | +**Figure 2** Custom marking chart<a id="custom-marking-chart"></a> |
| 619 |  | 619 |  |
| 620 | 620 | ||
| 621 | -> [!NOTE]NOTE | 621 | +> [!NOTE]NOTE |
| 622 | -> | 622 | +> |
| 623 | >- Marking on the Scalar unit generates only one record, representing both issuing and execution. Marking on other units generates two records: one on the Scalar unit for issuing and one on the corresponding unit for execution. | 623 | >- Marking on the Scalar unit generates only one record, representing both issuing and execution. Marking on other units generates two records: one on the Scalar unit for issuing and one on the corresponding unit for execution. |
| 624 | >- SIMT functions do not support marking. | 624 | >- SIMT functions do not support marking. |
| 625 | 625 | ||
| @@ -641,7 +641,7 @@ Visualizes the `visualize_data.bin` files generated by msOpProf. On the page, yo | |||
| 641 | 641 | ||
| 642 | The following figure shows the operator code hotspot map. | 642 | The following figure shows the operator code hotspot map. |
| 643 | 643 | ||
| 644 | -**Figure 1** msOpProf source code page | 644 | +**Figure 1** msOpProf source code page |
| 645 |  | 645 |  |
| 646 | 646 | ||
| 647 | - On the top of the page, you can switch between compute units and kernel function files. | 647 | - On the top of the page, you can switch between compute units and kernel function files. |
| @@ -656,7 +656,7 @@ The following figure shows the operator code hotspot map. | |||
| 656 | |Timeline|Tool simulation|Code lines and instructions| | 656 | |Timeline|Tool simulation|Code lines and instructions| |
| 657 | |Details|Real data|Kernel| | 657 | |Details|Real data|Kernel| |
| 658 | 658 | ||
| 659 | - > [!NOTE]NOTE | 659 | + > [!NOTE]NOTE |
| 660 | > "NA" is displayed if no GM-related unit is involved when Process Bytes is checked. | 660 | > "NA" is displayed if no GM-related unit is involved when Process Bytes is checked. |
| 661 | 661 | ||
| 662 | - For details about the features supported by msOpProf, see [**Table 2** msOpProf hot spot map features](#msopprof-hot-spot-map-features) and [**Table 3** Stall description](#stall-description). | 662 | - For details about the features supported by msOpProf, see [**Table 2** msOpProf hot spot map features](#msopprof-hot-spot-map-features) and [**Table 3** Stall description](#stall-description). |
| @@ -317,6 +317,60 @@ TEST(ArgChecker, replay_mode_return_should_be_false) | |||
| 317 | GlobalMockObject::verify(); | 317 | GlobalMockObject::verify(); |
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | +TEST(ArgChecker, ascend950_range_replay_with_unsupported_metrics_expect_return_false) { | ||
| 321 | + GlobalMockObject::verify(); | ||
| 322 | + ProfArgs args; | ||
| 323 | + args.argReplayMode = "range"; | ||
| 324 | + args.argMstx = "on"; | ||
| 325 | + std::string msg; | ||
| 326 | + const std::string expectedMsg = | ||
| 327 | + "--aic-metrics=Source/PcSampling/Roofline/PipeTimeline/InstrTimeline is invalid when " | ||
| 328 | + "--replay-mode=range on Ascend 950"; | ||
| 329 | + ArgChecker checker(""); | ||
| 330 | + MOCKER(&Common::HalHelper::GetPlatformType).stubs().will(returnValue(Common::ChipType::ASCEND950)); | ||
| 331 | + | ||
| 332 | + ASSERT_TRUE(checker.CheckReplayMode(args, msg)); | ||
| 333 | + | ||
| 334 | + args.argAicMetrics.pcSamplingEnable = true; | ||
| 335 | + ASSERT_FALSE(checker.CheckReplayMode(args, msg)); | ||
| 336 | + ASSERT_EQ(msg, expectedMsg); | ||
| 337 | + args.argAicMetrics.pcSamplingEnable = false; | ||
| 338 | + | ||
| 339 | + args.argAicMetrics.roofline = true; | ||
| 340 | + ASSERT_FALSE(checker.CheckReplayMode(args, msg)); | ||
| 341 | + ASSERT_EQ(msg, expectedMsg); | ||
| 342 | + args.argAicMetrics.roofline = false; | ||
| 343 | + | ||
| 344 | + args.argAicMetrics.isSource = true; | ||
| 345 | + ASSERT_FALSE(checker.CheckReplayMode(args, msg)); | ||
| 346 | + ASSERT_EQ(msg, expectedMsg); | ||
| 347 | + args.argAicMetrics.isSource = false; | ||
| 348 | + | ||
| 349 | + args.argAicMetrics.pipeTimelineEnable = true; | ||
| 350 | + ASSERT_FALSE(checker.CheckReplayMode(args, msg)); | ||
| 351 | + ASSERT_EQ(msg, expectedMsg); | ||
| 352 | + args.argAicMetrics.pipeTimelineEnable = false; | ||
| 353 | + | ||
| 354 | + args.argAicMetrics.instrTimelineEnable = true; | ||
| 355 | + ASSERT_FALSE(checker.CheckReplayMode(args, msg)); | ||
| 356 | + ASSERT_EQ(msg, expectedMsg); | ||
| 357 | + GlobalMockObject::verify(); | ||
| 358 | +} | ||
| 359 | + | ||
| 360 | +TEST(ArgChecker, ascend910b_range_replay_with_roofline_expect_return_true) { | ||
| 361 | + GlobalMockObject::verify(); | ||
| 362 | + ProfArgs args; | ||
| 363 | + args.argReplayMode = "range"; | ||
| 364 | + args.argMstx = "on"; | ||
| 365 | + args.argAicMetrics.roofline = true; | ||
| 366 | + std::string msg; | ||
| 367 | + ArgChecker checker(""); | ||
| 368 | + MOCKER(&Common::HalHelper::GetPlatformType).stubs().will(returnValue(Common::ChipType::ASCEND910B)); | ||
| 369 | + | ||
| 370 | + ASSERT_TRUE(checker.CheckReplayMode(args, msg)); | ||
| 371 | + GlobalMockObject::verify(); | ||
| 372 | +} | ||
| 373 | + | ||
| 320 | TEST(ArgChecker, config_with_launch_count_check) | 374 | TEST(ArgChecker, config_with_launch_count_check) |
| 321 | { | 375 | { |
| 322 | ProfArgs args; | 376 | ProfArgs args; |
| @@ -496,6 +550,23 @@ TEST(ArgChecker, args_with_core_id_expect_success) | |||
| 496 | ASSERT_TRUE(checker.CheckCoreId(args, msg)); | 550 | ASSERT_TRUE(checker.CheckCoreId(args, msg)); |
| 497 | } | 551 | } |
| 498 | 552 | ||
| 553 | +TEST(ArgChecker, device_core_id_on_ascend950_requires_timeline_detail) { | ||
| 554 | + GlobalMockObject::verify(); | ||
| 555 | + ArgChecker checker("device"); | ||
| 556 | + Common::ProfArgs args; | ||
| 557 | + std::string msg; | ||
| 558 | + args.runMode = "device"; | ||
| 559 | + args.argCoreId = "0"; | ||
| 560 | + MOCKER(&Common::HalHelper::GetPlatformType).stubs().will(returnValue(Common::ChipType::ASCEND950)); | ||
| 561 | + | ||
| 562 | + ASSERT_FALSE(checker.CheckCoreId(args, msg)); | ||
| 563 | + ASSERT_EQ(msg, "--core-id requires --aic-metrics=TimelineDetail."); | ||
| 564 | + | ||
| 565 | + args.argAicMetrics.isDeviceToSimulator = true; | ||
| 566 | + ASSERT_TRUE(checker.CheckCoreId(args, msg)); | ||
| 567 | + GlobalMockObject::verify(); | ||
| 568 | +} | ||
| 569 | + | ||
| 499 | TEST(ArgChecker, args_with_timeout) | 570 | TEST(ArgChecker, args_with_timeout) |
| 500 | { | 571 | { |
| 501 | ArgChecker checker("simulator"); | 572 | ArgChecker checker("simulator"); |
| @@ -842,6 +913,7 @@ TEST(ArgChecker, test_CheckDump_device_unsupported_soc_expect_return_false) { | |||
| 842 | std::string msg; | 913 | std::string msg; |
| 843 | args.runMode = "device"; | 914 | args.runMode = "device"; |
| 844 | args.argDump = "on"; | 915 | args.argDump = "on"; |
| 916 | + args.argAicMetrics.isDeviceToSimulator = true; | ||
| 845 | MOCKER(&Common::HalHelper::GetPlatformType).stubs().will(returnValue(Common::ChipType::ASCEND950)); | 917 | MOCKER(&Common::HalHelper::GetPlatformType).stubs().will(returnValue(Common::ChipType::ASCEND950)); |
| 846 | ASSERT_FALSE(checker.CheckDump(args, msg)); | 918 | ASSERT_FALSE(checker.CheckDump(args, msg)); |
| 847 | ASSERT_TRUE(msg.find("wrong soc platform") != std::string::npos); | 919 | ASSERT_TRUE(msg.find("wrong soc platform") != std::string::npos); |
| @@ -65,20 +65,50 @@ TEST(Interface, args_init_with_invalid_param_expect_return_false) | |||
| 65 | ASSERT_FALSE(ret); | 65 | ASSERT_FALSE(ret); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | -TEST(Interface, args_init_with_device_dump_on_ascend950_expect_return_false) { | 68 | +TEST(Interface, args_init_with_device_dump_on_ascend950_with_timeline_detail_expect_return_false) { |
| 69 | + GlobalMockObject::verify(); | ||
| 70 | + MOCKER(&Common::HalHelper::GetPlatformType).stubs().will(returnValue(Common::ChipType::ASCEND950)); | ||
| 71 | + Common::ProfArgs args; | ||
| 72 | + char *argv[5]; | ||
| 73 | + argv[0] = "msopprof"; | ||
| 74 | + argv[1] = "--application=/bin/true"; | ||
| 75 | + argv[2] = "--aic-metrics=TimelineDetail"; | ||
| 76 | + argv[3] = "--dump=on"; | ||
| 77 | + argv[4] = "--output=./output"; | ||
| 78 | + bool ret = ProfArgsInit(args, 5, argv, nullptr); | ||
| 79 | + ASSERT_FALSE(ret); | ||
| 80 | + GlobalMockObject::verify(); | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +TEST(Interface, args_init_with_device_core_id_on_ascend950_without_timeline_detail_expect_return_false) { | ||
| 69 | GlobalMockObject::verify(); | 84 | GlobalMockObject::verify(); |
| 70 | MOCKER(&Common::HalHelper::GetPlatformType).stubs().will(returnValue(Common::ChipType::ASCEND950)); | 85 | MOCKER(&Common::HalHelper::GetPlatformType).stubs().will(returnValue(Common::ChipType::ASCEND950)); |
| 71 | Common::ProfArgs args; | 86 | Common::ProfArgs args; |
| 72 | char *argv[4]; | 87 | char *argv[4]; |
| 73 | argv[0] = "msopprof"; | 88 | argv[0] = "msopprof"; |
| 74 | argv[1] = "--application=/bin/true"; | 89 | argv[1] = "--application=/bin/true"; |
| 75 | - argv[2] = "--dump=on"; | 90 | + argv[2] = "--core-id=0"; |
| 76 | argv[3] = "--output=./output"; | 91 | argv[3] = "--output=./output"; |
| 77 | bool ret = ProfArgsInit(args, 4, argv, nullptr); | 92 | bool ret = ProfArgsInit(args, 4, argv, nullptr); |
| 78 | ASSERT_FALSE(ret); | 93 | ASSERT_FALSE(ret); |
| 79 | GlobalMockObject::verify(); | 94 | GlobalMockObject::verify(); |
| 80 | } | 95 | } |
| 81 | 96 | ||
| 97 | +TEST(Interface, args_init_with_device_core_id_on_ascend950_with_timeline_detail_expect_return_true) { | ||
| 98 | + GlobalMockObject::verify(); | ||
| 99 | + MOCKER(&Common::HalHelper::GetPlatformType).stubs().will(returnValue(Common::ChipType::ASCEND950)); | ||
| 100 | + Common::ProfArgs args; | ||
| 101 | + char *argv[5]; | ||
| 102 | + argv[0] = "msopprof"; | ||
| 103 | + argv[1] = "--application=/bin/true"; | ||
| 104 | + argv[2] = "--aic-metrics=TimelineDetail,Default"; | ||
| 105 | + argv[3] = "--core-id=0"; | ||
| 106 | + argv[4] = "--output=./output"; | ||
| 107 | + bool ret = ProfArgsInit(args, 5, argv, nullptr); | ||
| 108 | + ASSERT_TRUE(ret); | ||
| 109 | + GlobalMockObject::verify(); | ||
| 110 | +} | ||
| 111 | + | ||
| 82 | TEST(Interface, PlatformInit_failed) | 112 | TEST(Interface, PlatformInit_failed) |
| 83 | { | 113 | { |
| 84 | GlobalMockObject::verify(); | 114 | GlobalMockObject::verify(); |