Skip to content

Commit

Permalink
#1200: Save all ttrt perf artifacts by default (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
tapspatel authored Nov 8, 2024
1 parent 09f34bc commit 2cb0bf2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 64 deletions.
39 changes: 0 additions & 39 deletions runtime/tools/python/test/test_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,6 @@ def test_clean_artifacts_cmd_perf():
sub_process_command(command)


def test_save_artifacts_perf():
API.initialize_apis()
custom_args = {}
custom_args[
"--result-file"
] = f"ttrt-results/{inspect.currentframe().f_code.co_name}.json"
custom_args["binary"] = PERF_BINARY_FILE_PATH
custom_args["--host-only"] = True
custom_args["--clean-artifacts"] = True
custom_args["--save-artifacts"] = True
perf_instance = API.Perf(args=custom_args)
perf_instance()


def test_save_artifacts_cmd_perf():
command = f"ttrt perf {PERF_BINARY_FILE_PATH} --clean-artifacts --save-artifacts --host-only --log-file ttrt-results/{inspect.currentframe().f_code.co_name}.log --result-file ttrt-results/{inspect.currentframe().f_code.co_name}.json"
sub_process_command(command)


def test_log_file_perf():
API.initialize_apis()
custom_args = {}
Expand All @@ -111,26 +92,6 @@ def test_log_file_cmd_perf():
sub_process_command(command)


def test_artifact_dir_perf():
API.initialize_apis()
custom_args = {}
custom_args[
"--result-file"
] = f"ttrt-results/{inspect.currentframe().f_code.co_name}.json"
custom_args["binary"] = PERF_BINARY_FILE_PATH
custom_args["--host-only"] = True
custom_args["--clean-artifacts"] = True
custom_args["--save-artifacts"] = True
custom_args["--artifact-dir"] = f"{os.getcwd()}/ttrt-artifacts"
perf_instance = API.Perf(args=custom_args)
perf_instance()


def test_artifact_dir_cmd_perf():
command = f"ttrt perf {PERF_BINARY_FILE_PATH} --clean-artifacts --save-artifacts --artifact-dir {os.getcwd()}/ttrt-artifacts --host-only --log-file ttrt-results/{inspect.currentframe().f_code.co_name}.log --result-file ttrt-results/{inspect.currentframe().f_code.co_name}.json"
sub_process_command(command)


def test_program_index_perf():
API.initialize_apis()
custom_args = {}
Expand Down
36 changes: 11 additions & 25 deletions runtime/tools/python/ttrt/common/perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ def initialize_api():
choices=[True, False],
help="clean all artifacts from previous runs",
)
Perf.register_arg(
name="--save-artifacts",
type=bool,
default=False,
choices=[True, False],
help="save all artifacts during run",
)
Perf.register_arg(
name="--log-file",
type=str,
Expand Down Expand Up @@ -448,20 +441,20 @@ def signal_handler(sig, frame):

# copy all relevant files into perf folder for this test
perf_folder_path = self.artifacts.get_binary_perf_folder_path(bin)
if self["--save-artifacts"]:
self.file_manager.copy_file(perf_folder_path, tracy_file_path)
self.file_manager.copy_file(
perf_folder_path, tracy_ops_times_file_path
)
self.artifacts.save_binary(bin, self.query)
self.file_manager.copy_file(perf_folder_path, tracy_file_path)
self.file_manager.copy_file(
perf_folder_path, tracy_ops_times_file_path
)
self.file_manager.copy_file(
perf_folder_path, tracy_ops_data_file_path
)

if not self["--host-only"]:
self.file_manager.copy_file(
perf_folder_path, tracy_ops_data_file_path
perf_folder_path, profiler_device_side_log_path
)

if not self["--host-only"]:
self.file_manager.copy_file(
perf_folder_path, profiler_device_side_log_path
)

process_ops(None, None, False)
self.file_manager.copy_file(
perf_folder_path,
Expand Down Expand Up @@ -507,13 +500,6 @@ def signal_handler(sig, frame):
def postprocess(self):
self.logging.debug(f"------postprocessing perf API")

if self["--save-artifacts"]:
for bin in self.ttnn_binaries:
self.artifacts.save_binary(bin, self.query)

for bin in self.ttmetal_binaries:
self.artifacts.save_binary(bin, self.query)

for bin in self.ttnn_binaries:
if bin.test_result == "pass":
test_result = {
Expand Down

0 comments on commit 2cb0bf2

Please sign in to comment.