forked from nod-ai/shark-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tuner] Add direct TD spec generation for candidates (nod-ai#606)
This PR adds direct transform dialect spec generation for candidate configurations. This is the first part of the large refactoring described in nod-ai#577. The way TD specs are generated is by matching against certain types of operations, and then creating a named sequence with `transform.iree.match.cast_compatible_dag_from_root` based on the matched operation. This is done for each configuration found, and the specs are saved to the temporary tuning directory to be used later in tuning. One main difference in the flow of candidate generation is that state is no longer tracked by saving files to a temporary directory. Instead, ir modules are passed to each function, and only at the very end of candidate generation are the transform dialect specs written to files. This makes things cleaner, since there no longer needs to be a coordination of file paths. Signed-off-by: Max Dawkins <[email protected]>
- Loading branch information
Showing
12 changed files
with
900 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2024 Advanced Micro Devices, Inc. | ||
# | ||
# Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2024 Advanced Micro Devices, Inc. | ||
# | ||
# Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
from . import tuner_test | ||
|
||
tuner_test.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2024 Advanced Micro Devices, Inc | ||
# | ||
# Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
from tuner import libtuner | ||
|
||
|
||
def main(): | ||
args = libtuner.parse_arguments() | ||
|
||
path_config = libtuner.PathConfig() | ||
path_config.base_dir.mkdir(parents=True, exist_ok=True) | ||
path_config.output_unilog.touch() | ||
candidate_trackers: list[libtuner.CandidateTracker] = [] | ||
stop_after_phase: str = args.stop_after | ||
|
||
print("Setup logging") | ||
libtuner.setup_logging(args, path_config) | ||
print(path_config.run_log, end="\n\n") | ||
|
||
if not args.dry_run: | ||
print("Validating devices") | ||
libtuner.validate_devices(args.devices) | ||
print("Validation successful!\n") | ||
|
||
print("Generating candidates...") | ||
candidates = libtuner.generate_candidate_specs( | ||
args, path_config, candidate_trackers | ||
) | ||
print(f"Stored candidate specs in {path_config.specs_dir}\n") | ||
if stop_after_phase == libtuner.ExecutionPhases.generate_candidates: | ||
return | ||
|
||
print("Check the detailed execution logs in:") | ||
print(path_config.run_log.resolve()) | ||
|
||
for candidate in candidate_trackers: | ||
libtuner.logging.debug(candidate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.