Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[autotuner]: allow absence of hotspot information #646

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions discopop_library/EmpiricalAutotuning/ArgumentClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ def __validate(self) -> None:
os.path.join(self.dot_dp_path, "profiler"),
os.path.join(self.dot_dp_path, "explorer"),
os.path.join(self.dot_dp_path, "patch_generator"),
os.path.join(self.dot_dp_path, "hotspot_detection"),
os.path.join(self.dot_dp_path, "hotspot_detection", "Hotspots.json"),
os.path.join(self.dot_dp_path, "line_mapping.json"),
]
for file in required_files:
Expand Down
20 changes: 16 additions & 4 deletions discopop_library/EmpiricalAutotuning/Autotuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
from typing import List, Optional, Set, Tuple, cast

import jsonpickle # type: ignore
from discopop_explorer.PEGraphX import LoopNode
from discopop_library.EmpiricalAutotuning.ArgumentClasses import AutotunerArguments
from discopop_library.EmpiricalAutotuning.Classes.CodeConfiguration import CodeConfiguration
from discopop_library.EmpiricalAutotuning.Classes.ExecutionResult import ExecutionResult
from discopop_library.EmpiricalAutotuning.Statistics.StatisticsGraph import NodeShape, StatisticsGraph
from discopop_library.EmpiricalAutotuning.Types import SUGGESTION_ID
from discopop_library.EmpiricalAutotuning.utils import get_applicable_suggestion_ids
from discopop_library.HostpotLoader.HotspotLoaderArguments import HotspotLoaderArguments
from discopop_library.HostpotLoader.HotspotNodeType import HotspotNodeType
from discopop_library.HostpotLoader.HotspotType import HotspotType
from discopop_library.HostpotLoader.hostpot_loader import run as load_hotspots
from discopop_library.result_classes.DetectionResult import DetectionResult
Expand Down Expand Up @@ -75,11 +77,21 @@ def run(arguments: AutotunerArguments) -> None:
visited_configurations: List[List[SUGGESTION_ID]] = []
best_suggestion_configuration: Tuple[List[SUGGESTION_ID], CodeConfiguration] = ([], reference_configuration)
for hotspot_type in [HotspotType.YES, HotspotType.MAYBE, HotspotType.NO]:
if hotspot_type not in hotspot_information:
continue
# for all loops in descending order by average execution time
loop_tuples = hotspot_information[hotspot_type]
if hotspot_information:
# hotspot information exists
if hotspot_type not in hotspot_information:
continue
# for all loops in descending order by average execution time
loop_tuples = hotspot_information[hotspot_type]
sorted_loop_tuples = sorted(loop_tuples, key=lambda x: x[4], reverse=True)
else:
# no hotspot information was found
# get loop tuples from detection result
loop_nodes = detection_result.pet.all_nodes(type=LoopNode)
loop_tuples = [(l.file_id, l.start_line, HotspotNodeType.LOOP, "", 0.0) for l in loop_nodes]

sorted_loop_tuples = sorted(loop_tuples, key=lambda x: x[4], reverse=True)

for loop_tuple in sorted_loop_tuples:
loop_str = (
""
Expand Down
Loading