Explorer output
The explorer reads .discopop/profiler and writes its results to .discopop/explorer/. It removes the directory at the start of a run. Relative paths of the options below refer to the .discopop directory the explorer runs in.
.discopop/
├── explorer/
│ ├── patterns.json
│ ├── pattern_decisions.json
│ ├── detection_result_dump.json
│ └── side_effects.json.gz
├── patch_generator/<pattern id>/<n>.patch
├── patch_applicator/applied_suggestions.json
├── line_mapping.json
└── next_free_pattern_id.txt
patterns.json
explorer/patterns.json (option --json) contains the detected patterns. It has the keys version and patterns; patterns maps a pattern type to a list of patterns. Only the detectors that ran appear: do_all and reduction by default, task with --enable-patterns task, plus the always present, usually empty lists optimizer_output and merged_pattern.
{
"version": "CURRENTLY INVALID!",
"patterns": {
"optimizer_output": [],
"merged_pattern": [],
"do_all": [ { "pattern_id": 0, "node_id": "1:7", "start_line": "1:20", "...": "..." } ],
"reduction": [ { "pattern_id": 1, "node_id": "1:12", "start_line": "1:24", "...": "..." } ]
}
}
The version field is not maintained at the moment and always contains the text CURRENTLY INVALID!. The fields of the patterns are described on the pages Parallel patterns, Do-All and Reduction.
pattern_decisions.json
explorer/pattern_decisions.json (option --pattern-decisions; without a value nothing is recorded) lists which regions the detectors examined and what they decided. For the example:
{
"format_version": 1,
"detectors": { "doall_reduction": ["doall", "reduction"] },
"decisions": [
{
"detector": "doall_reduction",
"pattern_types": ["doall", "reduction"],
"region": { "node_id": "1:7", "file_id": 1, "start_line": 20, "end_line": 22, "kind": "loop" },
"outcome": "accepted",
"patterns": [ { "type": "doall", "pattern_id": 0 } ],
"reasons": []
}
]
}
For a rejected region, outcome says so and reasons explains why.
detection_result_dump.json
explorer/detection_result_dump.json (option --dump-detection-result) is a jsonpickle dump of the whole detection result, including the program execution graph. It is large and meant for tools that reload the result, not for reading.
side_effects.json.gz
explorer/side_effects.json.gz is a gzip-compressed JSON export of the functions, their parameters and local variables, the dependencies with their callpath contexts, and the calls that were executed. The MCP server reads it to answer get_side_effects. The file starts with "format_version": 1; the explorer writes it with every run and removes a stale file if the export fails.
Patches
For every pattern the explorer runs the patch generator, which writes patch_generator/<pattern id>/<n>.patch (a unified diff against the source files named in FileMapping.txt):
@@ -21,6 +21,7 @@
Arr[i] = i % 13;
}
+ #pragma omp parallel for firstprivate(N) reduction(+:sum)
for (int i = 0; i < N; i++) {
sum += Arr[i];
}
The patch applicator records the patches it applied in patch_applicator/applied_suggestions.json; before the first application the list is empty:
{"applied": []}
next_free_pattern_id.txt
The explorer takes pattern ids from next_free_pattern_id.txt (a plain number, protected by next_free_pattern_id.txt.lock) in its working directory, which is the .discopop directory. After the example run it contains 2. line_mapping.json is described on the File mapping page.