|
15 | 15 | class GigascaleAllPairsCflrToolRunner(AbstractAllPairsCflrToolRunner):
|
16 | 16 | @property
|
17 | 17 | def base_command(self) -> Optional[str]:
|
18 |
| - return ( |
19 |
| - f'./run.sh -wdlrb -i datasets/dacapo9/{self.graph_path.stem}' |
20 |
| - if self.grammar_path.stem in {"java_points_to", "java_points_to_rewritten"} |
21 |
| - else None |
22 |
| - ) |
| 18 | + if self.grammar_path.stem not in {"java_points_to", "java_points_to_rewritten"}: |
| 19 | + return None |
| 20 | + base_path = os.path.dirname(self.graph_path) |
| 21 | + gigascale_path = os.path.join(base_path, 'Gigascale') |
| 22 | + adapted_graph_path = os.path.join(gigascale_path, self.graph_path.stem) |
| 23 | + os.makedirs(adapted_graph_path, exist_ok=True) |
| 24 | + |
| 25 | + alloc_path = os.path.join(adapted_graph_path, 'Alloc.csv') |
| 26 | + assign_path = os.path.join(adapted_graph_path, 'Assign.csv') |
| 27 | + load_path = os.path.join(adapted_graph_path, 'Load.csv') |
| 28 | + store_path = os.path.join(adapted_graph_path, 'Store.csv') |
| 29 | + |
| 30 | + with open(alloc_path, 'w') as alloc_file, \ |
| 31 | + open(assign_path, 'w') as assign_file, \ |
| 32 | + open(load_path, 'w') as load_file, \ |
| 33 | + open(store_path, 'w') as store_file: |
| 34 | + |
| 35 | + with open(self.graph_path, 'r') as graph_file: |
| 36 | + for line in graph_file: |
| 37 | + line_data = line.strip().split() |
| 38 | + if len(line_data) == 0: |
| 39 | + continue |
| 40 | + |
| 41 | + source, target, label = line_data[:3] |
| 42 | + # NOTE: It's not a mistake that `target` and `source` are sometimes swapped |
| 43 | + # The swap is required to get an answer consistent with other tools. |
| 44 | + if label == 'alloc': |
| 45 | + alloc_file.write(f'"var_{source}","var_{target}"\n') |
| 46 | + elif label == 'assign': |
| 47 | + assign_file.write(f'"var_{target}","var_{source}"\n') |
| 48 | + elif label == 'load_i': |
| 49 | + field = line_data[3] |
| 50 | + load_file.write(f'"var_{target}","var_{source}","field_{field}"\n') |
| 51 | + elif label == 'store_i': |
| 52 | + field = line_data[3] |
| 53 | + store_file.write(f'"var_{target}","var_{source}","field_{field}"\n') |
| 54 | + else: |
| 55 | + assert "_r" in label, (f"Label '{label} must be 'alloc', 'assign' " |
| 56 | + f"or 'load_i' or 'store_i' or contain '_r") |
| 57 | + return f'./run.sh -wdlrb -i {adapted_graph_path}' |
23 | 58 |
|
24 | 59 | @property
|
25 | 60 | def work_dir(self) -> Optional[Path]:
|
|
0 commit comments