From 7bbc94507abb85d9e38313ab1af0307fe19ca756 Mon Sep 17 00:00:00 2001 From: wuyulong11 Date: Tue, 18 Apr 2023 15:27:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E9=80=82=E9=85=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=A5=E6=BA=90csv=E6=96=87=E4=BB=B6=E8=A1=A8=E5=A4=B4?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E3=80=90=E4=BF=AE=E6=94=B9=E4=BA=BA?= =?UTF-8?q?=E3=80=91=20wuyulong=2030031080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profiler/run_generator.py | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) 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 d2504d62f..afb4006dc 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 @@ -351,22 +351,9 @@ class RunGenerator(object): return datas def _generate_kernel_table(self): - display_columns = { - 'Step ID': 'Step ID', - 'Op Name': 'Name', - 'Op Type': 'Type', - 'Task Type': 'Accelerator Core', - 'Task Start Time': 'Start Time', - 'Task Duration(us)': 'Duration(us)', - 'Task Wait Time(us)': 'Wait Time(us)', - 'Block Dim': 'Block Dim', - 'Input Shapes': 'Input Shapes', - 'Input Data Types': 'Input Data Types', - 'Input Formats': 'Input Formats', - 'Output Shapes': 'Output Shapes', - 'Output Data Types': 'Output Data Types', - 'Output Formats': 'Output Formats' - } + display_columns = ('Step ID', 'Name', 'Type', 'Accelerator Core', 'Start Time', 'Duration(us)', 'Wait Time(us)', + 'Block Dim', 'Input Shapes', 'Input Data Types', 'Input Formats', 'Output Shapes', + 'Output Data Types', 'Output Formats') display_idxs = [] table = {'columns': [], 'rows': []} result = { @@ -385,9 +372,9 @@ class RunGenerator(object): elif column == 'Task Type': self.core_type_idx = idx - if display_columns.get(column) is not None: + if column in display_columns: display_idxs.append(idx) - table['columns'].append({'type': 'string', 'name': display_columns[column]}) + table['columns'].append({'type': 'string', 'name': column}) table['rows'] = [self._handle_kernel_table_rows(display_idxs, ls) for idx, ls in enumerate(datas) if idx != 0] return result -- Gitee From b1282ad5e8c142c5671771c06c77523a9f0a4dc0 Mon Sep 17 00:00:00 2001 From: wuyulong11 Date: Tue, 18 Apr 2023 16:22:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E9=80=82=E9=85=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=A5=E6=BA=90csv=E6=96=87=E4=BB=B6=E8=A1=A8=E5=A4=B4?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E3=80=90=E4=BF=AE=E6=94=B9=E4=BA=BA?= =?UTF-8?q?=E3=80=91=20wuyulong=2030031080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../torch_tb_profiler/profiler/run_generator.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 afb4006dc..d28ebf8b4 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 @@ -344,8 +344,8 @@ class RunGenerator(object): reader = csv.DictReader(f) for row in reader: data = [] - data.append(row.get('Op Name')) - data.append(float(row.get('Task Duration(us)'))) + data.append(row.get('Name')) + data.append(float(row.get('Duration(us)'))) pie['rows'].append(data) datas = {'total': pie} return datas @@ -365,11 +365,11 @@ class RunGenerator(object): path = self.profile_data.kernel_file_path datas = self._get_csv_data(path) for idx, column in enumerate(datas[0]): - if column == 'Op Name': + if column == 'Name': self.name_idx = idx - elif column == 'Task Duration(us)': + elif column == 'Duration(us)': self.duration_idx = idx - elif column == 'Task Type': + elif column == 'Type': self.core_type_idx = idx if column in display_columns: -- Gitee From 748e7cc56a81b7702e32c25fa4675bbdba5ba056 Mon Sep 17 00:00:00 2001 From: wuyulong11 Date: Wed, 19 Apr 2023 17:04:24 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E9=80=82=E9=85=8Dworker=5Fspan=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=91=BD=E5=90=8D=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20=E3=80=90=E4=BF=AE=E6=94=B9=E4=BA=BA=E3=80=91=20wuyulong=203?= =?UTF-8?q?0031080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tb_plugins/profiling/tb_plugin/torch_tb_profiler/consts.py | 2 +- .../profiling/tb_plugin/torch_tb_profiler/profiler/data.py | 2 +- .../profiling/tb_plugin/torch_tb_profiler/profiler/loader.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/consts.py b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/consts.py index f558aec48..0a54ae568 100644 --- a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/consts.py +++ b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/consts.py @@ -12,7 +12,7 @@ WORKER_PATTERN = re.compile(r"""^(.*?) # worker name (?:\.gz)?$""", re.X) # optional .gz extension TRACE_PATTERN = re.compile(r"""^trace_view\.json(\.gz)?$""") -WORKER_SPAN_PATTERN = re.compile(r"""([^\\]*_\d+)_(\d+)$""") +WORKER_SPAN_PATTERN = re.compile(r"""([^\\]*)_(\d+)$""") NODE_PROCESS_PATTERN = re.compile(r"""^(.*)_(\d+)""") MONITOR_RUN_REFRESH_INTERNAL_IN_SECONDS = 10 diff --git a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/data.py b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/data.py index fd553c741..01864509c 100644 --- a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/data.py +++ b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/data.py @@ -101,7 +101,7 @@ class RunProfileData(object): self.recommendations = [] @staticmethod - def parse(run_name, worker, span_name, span, path, cache_dir): + def parse(worker, span, path, cache_dir): trace_json = {} trace_path = path has_trace = False diff --git a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/loader.py b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/loader.py index 8d8e93171..ac1501aa5 100644 --- a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/loader.py +++ b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/loader.py @@ -82,7 +82,7 @@ class RunLoader(object): try: logger.debug('Parse trace, run_dir=%s, data_dir=%s', self.run_dir, path) local_file = self.caches.get_remote_cache(io.join(self.run_dir, path)) - data = RunProfileData.parse(self.run_name, worker, span_name, span, local_file, self.caches.cache_dir) + data = RunProfileData.parse(worker, span, local_file, self.caches.cache_dir) if data.trace_file_path != local_file: self.caches.add_file(local_file, data.trace_file_path) -- Gitee