
Script for op level debug of aie4 flow.
Gets L1 fusion artifacts as input. Calls aie4 flow, meta json generation and aie-runner.
The script generates report.csv and nodelist.txt next to the script.

Reports op level max diff using aie-runner. Uses unique nodes list to internally generate nodelist.txt for op-by-op debugging.
aie4 flow is called for each op separately to avoid cases, where partitioner splits several ops in one subgrpah.
It is possible also to have subgraph level report. In this flow it doesn't generate nodelist.txt, and calls aie4 flow once.

Usage:
    python qhw4_op_level_debug.py -mp <original_model_path> --runner <waic_runner_exe_path> [--output <WAIC_Outputs_path>] [--single] [--subgraph] [--nodelist <path_to_nodelist>] [--skipped <path_to_skipped_nodes_list>] [--wgt] [--clean]

Required arguments:
  -mp, --model_path <model_path>      - Path to original onnx model
  -r, --runner <waic_runner_exe_path> - Path to aie-runner executable (waic_runner.exe).

Optional arguments:
  -fe, --fe_dir <fe_dir>              - Path to WAIC output directory, default is "./WAIC_Outputs".
                                        Directory where L1 fusion outputs are stored.
  -output, --output_dir <output_dir>  - Path to directory to store AIE4 generated artifacts.
  -ort, --ort_dir <ort_dir>           - Path to ORT data directory.
  --skip_compiling                    - Skips AIE4 compiling step and runs aie-runner on pregenerated
                                        artifacts.
  --skip_running                      - Skips aie-runner execution (compile only). Use this to compile
                                        on one machine and run on another.
  --subgraph                          - Generates subgrpah level max diff, disabled by default.
  --single                            - Select a single instance for an op, disabled by default (used for op-level debugging).
  --skipped <skipped_nodelist_path>   - Path to skipped nodes list file. In case of op-level debugging the script filters out
                                        the skipped nodes from nodelist.txt before the run.
  --nodelist <nodelist_path>          - Path to predefined nodelist for op-level debugging. The script will use passed
                                        nodelist.txt instead of generating it.
  - wgt, --check_wgt                  - Checks whether wgt.bin for the ops specified in nodelist exist, disabled by default
  --clean                             - Delete artifacts generated by aie4.
                                        It removes op_*, fused_*, cut_graphs, model_elf, *_alloc.json.
                                        skipped_nodelist.txt is not removed to use if required.
