diff --git a/tb_plugins/profiling/tb_plugin/fe/src/components/Operator.tsx b/tb_plugins/profiling/tb_plugin/fe/src/components/Operator.tsx index 86ef715e1af2e9032959f6bc5123fb21c64cff62..3fb2503f3386684dc2ff158f30088b4db920bc18 100644 --- a/tb_plugins/profiling/tb_plugin/fe/src/components/Operator.tsx +++ b/tb_plugins/profiling/tb_plugin/fe/src/components/Operator.tsx @@ -35,7 +35,9 @@ import { makeChartHeaderRenderer, useTooltipCommonStyles } from './helpers' import { OperationTable } from './tables/OperationTable' import { DeviceSelfTimeTooltip, + DeviceSelfTimeTooltipAscend, DeviceTotalTimeTooltip, + DeviceTotalTimeTooltipAscend, HostSelfTimeTooltip, HostTotalTimeTooltip } from './TooltipDescriptions' @@ -166,7 +168,7 @@ export const Operator: React.FC = (props) => { )} @@ -181,7 +183,7 @@ export const Operator: React.FC = (props) => { )} diff --git a/tb_plugins/profiling/tb_plugin/fe/src/components/TooltipDescriptions.ts b/tb_plugins/profiling/tb_plugin/fe/src/components/TooltipDescriptions.ts index 8c60bfb05a0fa8ebdf899c5fc6141a42f6626c2e..8f434221ddbdbd48a7a41ab6c73b2901519007c5 100644 --- a/tb_plugins/profiling/tb_plugin/fe/src/components/TooltipDescriptions.ts +++ b/tb_plugins/profiling/tb_plugin/fe/src/components/TooltipDescriptions.ts @@ -13,8 +13,12 @@ Other: The time not included in any of the above.` export const DeviceSelfTimeTooltip = `The accumulated time spent on GPU, not including this operator’s child operators.` +export const DeviceSelfTimeTooltipAscend = `The accumulated time spent on NPU, not including this operator’s child operators.` + export const DeviceTotalTimeTooltip = `The accumulated time spent on GPU, including this operator’s child operators.` +export const DeviceTotalTimeTooltipAscend = `The accumulated time spent on NPU, including this operator’s child operators.` + export const HostSelfTimeTooltip = `The accumulated time spent on Host, not including this operator’s child operators.` export const HostTotalTimeTooltip = `The accumulated time spent on Host, including this operator’s child operators.` diff --git a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/run_generator.py b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/run_generator.py index 504e8b1ad8af688a9dd0076986ae20da20fa431e..7fd44d6e6e8d61c0e421b0a852ce6cff1319256a 100644 --- a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/run_generator.py +++ b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/run_generator.py @@ -37,7 +37,7 @@ class RunGenerator(object): profile_run.profiler_start_ts = self.profile_data.profiler_start_ts profile_run.overview = self._generate_overview() - if self.device_target == 'GPU': + if self.device_target != 'Ascend': profile_run.views.append(consts.OVERALL_VIEW) profile_run.overview = self._generate_overview() @@ -49,6 +49,17 @@ class RunGenerator(object): profile_run.operation_table_by_name_input = self._generate_op_table( self.profile_data.op_list_groupby_name_input, True) profile_run.operation_stack_by_name_input = self._generate_op_table_for_stack(True) + + if self.profile_data.has_kernel: + profile_run.views.append(consts.KERNEL_VIEW) + profile_run.kernel_table = self._generate_kernel_table_gpu() + profile_run.kernel_op_table = self._generate_kernel_op_table_gpu() + profile_run.kernel_pie = self._generate_kernel_pie_gpu() + profile_run.tc_pie = self._generate_tc_pie_gpu() + + if self.profile_data.memory_snapshot: + profile_run.views.append(consts.MEMORY_VIEW) + profile_run.memory_snapshot = self.profile_data.memory_snapshot else: if self.profile_data.has_operator_view: profile_run.views.append(consts.OP_VIEW) @@ -59,18 +70,19 @@ class RunGenerator(object): profile_run.operation_table_by_name_input = self._get_operator_table_by_name(True) profile_run.operation_stack_by_name_input = self._get_call_stack_by_name_shapes(True) - if self.profile_data.has_kernel: - profile_run.views.append(consts.KERNEL_VIEW) - if self.device_target == 'Ascend': + if self.profile_data.has_kernel: + profile_run.views.append(consts.KERNEL_VIEW) profile_run.kernel_table = self._generate_kernel_table_npu() profile_run.kernel_op_table = self._generate_kernel_op_table_npu() profile_run.kernel_pie = self._generate_kernel_pie_npu() profile_run.tc_pie = self._generate_tc_pie_npu() - else: - profile_run.kernel_table = self._generate_kernel_table_gpu() - profile_run.kernel_op_table = self._generate_kernel_op_table_gpu() - profile_run.kernel_pie = self._generate_kernel_pie_gpu() - profile_run.tc_pie = self._generate_tc_pie_gpu() + + if self.profile_data.has_memory: + profile_run.views.append(consts.MEMORY_VIEW) + profile_run.memory_div_curve = None + self.process_data, self.pta_or_ge_data, peak_memory_events = self._handle_memory_data() + profile_run.memory_all_curve = self._get_memory_all_curve() + profile_run.memory_events = self._get_memory_event(peak_memory_events) if self.profile_data.has_trace: profile_run.views.append(consts.TRACE_VIEW) @@ -90,16 +102,6 @@ class RunGenerator(object): profile_run.pl_tid2tree = self.profile_data.pl_tid2tree profile_run.device_target = self.device_target - if self.device_target == 'Ascend' and self.profile_data.has_memory: - profile_run.views.append(consts.MEMORY_VIEW) - profile_run.memory_div_curve = None - self.process_data, self.pta_or_ge_data, peak_memory_events = self._handle_memory_data() - profile_run.memory_all_curve = self._get_memory_all_curve() - profile_run.memory_events = self._get_memory_event(peak_memory_events) - elif self.profile_data.memory_snapshot: - profile_run.views.append(consts.MEMORY_VIEW) - profile_run.memory_snapshot = self.profile_data.memory_snapshot - profile_run.module_stats = aggegate_module_view(self.profile_data.tid2tree, self.profile_data.events) profile_run.pl_module_stats = aggegate_pl_module_view(self.profile_data.tid2tree, self.profile_data.events) if profile_run.is_pytorch_lightning and profile_run.pl_module_stats: