Skip to content

Commit

Permalink
fix: potential false positive reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasrothenberger committed Jul 12, 2024
1 parent 179c8f8 commit 906c5e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
3 changes: 1 addition & 2 deletions discopop_explorer/pattern_detectors/do_all_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def __check_loop_dependencies(
)
cond_2 = len([cf for cf in called_functions_lineids if cf in dep.metadata_inter_call_dep]) > 0
cond_3 = len([t for t in parent_loops if t in dep.metadata_inter_iteration_dep]) > 0
if (cond_1) or ((cond_2) and (cond_3)):
if cond_1 or cond_2 or cond_3:
return True
# if it is an intra iteration dependency, it is problematic if it belongs to a parent loop
else:
Expand Down Expand Up @@ -416,7 +416,6 @@ def __get_parent_loops(pet: PEGraphX, root_loop: LoopNode) -> List[LineID]:
if s not in visited and s not in queue:
queue.append(s)

parents.remove(root_loop.id)
return [pet.node_at(p).start_position() for p in parents]


Expand Down
25 changes: 7 additions & 18 deletions discopop_explorer/pattern_detectors/reduction_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,24 +261,14 @@ def __check_loop_dependencies(
else:
# RAW does not target a reduction variable.
# RAW problematic, if it is not an intra-iteration RAW.
if (
not dep.intra_iteration
and (dep.metadata_intra_iteration_dep is None or len(dep.metadata_intra_iteration_dep) == 0)
and parent_function_lineid
in (dep.metadata_intra_call_dep if dep.metadata_intra_call_dep is not None else [])
) or (
(
False
if dep.metadata_inter_call_dep is None
else (len([cf for cf in called_functions_lineids if cf in dep.metadata_inter_call_dep]) > 0)
)
and (
False
if dep.metadata_inter_iteration_dep is None
else (len([t for t in parent_loops if t in dep.metadata_inter_iteration_dep]) > 0)
)
):
cond_1 = (len(dep.metadata_intra_iteration_dep) == 0) and parent_function_lineid in (
dep.metadata_intra_call_dep if dep.metadata_intra_call_dep is not None else []
)
cond_2 = len([cf for cf in called_functions_lineids if cf in dep.metadata_inter_call_dep]) > 0
cond_3 = len([t for t in parent_loops if t in dep.metadata_inter_iteration_dep]) > 0
if cond_1 or cond_2 or cond_3:
return True
# check for
elif dep.dtype == DepType.WAR:
# check WAR dependencies
# WAR problematic, if it is not an intra-iteration WAR and the variable is not private or firstprivate
Expand Down Expand Up @@ -338,7 +328,6 @@ def __get_parent_loops(pet: PEGraphX, root_loop: LoopNode) -> List[LineID]:
if s not in visited and s not in queue:
queue.append(s)

parents.remove(root_loop.id)
return [pet.node_at(p).start_position() for p in parents]


Expand Down

0 comments on commit 906c5e1

Please sign in to comment.