Skip to content

Commit

Permalink
feat: added parameter for scheduling clause detection
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasrothenberger committed Sep 22, 2023
1 parent 56a0475 commit 4b0f18c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions discopop_explorer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
from argparse import ArgumentParser
from pathlib import Path

from .discopop_explorer import ExplorerArguments, run
from discopop_library.global_data.version.utils import get_version
from discopop_library.PathManagement.PathManagement import get_path, get_path_or_none
from .discopop_explorer import ExplorerArguments, run


def parse_args() -> ExplorerArguments:
Expand Down Expand Up @@ -81,6 +80,10 @@ def parse_args() -> ExplorerArguments:
"--task-pattern", action="store_true",
help="Enables the task parallelism pattern identification. Requires --cu-inst-res and --llvm-cxxfilt-path to be set.",
)
experimental_parser.add_argument(
"--detect-scheduling-clauses", action="store_true",
help="Enables the detection of scheduling clauses for parallel loops.")

experimental_parser.add_argument(
"--generate-data-cu-inst", type=str, default=None,
help="Generates Data_CUInst.txt file and stores it in the given directory. Stops the regular execution of the discopop_explorer. Requires --cu-xml, --dep-file, --loop-counter, --reduction.",
Expand Down Expand Up @@ -138,6 +141,7 @@ def parse_args() -> ExplorerArguments:
file_mapping_file=arguments.fmap,
plugins=arguments.plugins,
enable_task_pattern=arguments.task_pattern,
detect_scheduling_clauses=arguments.detect_scheduling_clauses,
enable_profiling_dump_file=arguments.profiling,
enable_pet_dump_file=arguments.dump_pet,
enable_detection_result_dump_file=arguments.dump_detection_result,
Expand Down
4 changes: 4 additions & 0 deletions discopop_explorer/discopop_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class ExplorerArguments(object):
enable_detection_result_dump_file: Optional[str] # None means no dump, otherwise the path
# experimental features:
enable_task_pattern: bool
detect_scheduling_clauses: bool
generate_data_cu_inst: Optional[str] # none: generate Data_CUInst.txt & exit
cu_inst_result_file: Optional[str]
llvm_cxxfilt_path: Optional[str]
Expand Down Expand Up @@ -99,6 +100,7 @@ def __run(
llvm_cxxfilt_path: Optional[str] = None,
discopop_build_path: Optional[str] = None,
enable_task_pattern: bool = False,
enable_detection_of_scheduling_clauses: bool = False,
) -> DetectionResult:
pet = PETGraphX.from_parsed_input(*parse_inputs(cu_xml, dep_file, reduction_file, file_mapping))
print("PET CREATION FINISHED.")
Expand Down Expand Up @@ -127,6 +129,7 @@ def __run(
llvm_cxxfilt_path,
discopop_build_path,
enable_task_pattern,
enable_detection_of_scheduling_clauses,
)

for plugin_name in plugins:
Expand Down Expand Up @@ -170,6 +173,7 @@ def run(arguments: ExplorerArguments):
llvm_cxxfilt_path=arguments.llvm_cxxfilt_path,
discopop_build_path=arguments.discopop_build_path,
enable_task_pattern=arguments.enable_task_pattern,
enable_detection_of_scheduling_clauses=arguments.detect_scheduling_clauses,
)

end = time.time()
Expand Down
7 changes: 5 additions & 2 deletions discopop_explorer/pattern_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def detect_patterns(
llvm_cxxfilt_path,
discopop_build_path,
enable_task_pattern,
enable_detection_of_scheduling_clauses,
):
"""Runs pattern discovery on the CU graph"""
self.__merge(False, True)
Expand Down Expand Up @@ -110,8 +111,10 @@ def detect_patterns(
# will be moved and calculated based on the optimization graph
# res.combined_gpu = detect_combined_gpu(self.pet, res, project_folder_path)

# identify scheduling clauses
return self.__identify_scheduling_clauses(res, project_path, file_mapping)
if enable_detection_of_scheduling_clauses:
# identify scheduling clauses
return self.__identify_scheduling_clauses(res, project_path, file_mapping)
return res

def __identify_scheduling_clauses(
self,
Expand Down

0 comments on commit 4b0f18c

Please sign in to comment.