diff --git a/src/mldebug/aie_status.py b/src/mldebug/aie_status.py index 0ba2f95..f8a6872 100644 --- a/src/mldebug/aie_status.py +++ b/src/mldebug/aie_status.py @@ -5,6 +5,7 @@ Utility to help make sense of AIE register Values """ +import os import re import json import subprocess @@ -17,7 +18,7 @@ class AIEStatus: Top level class to manage aie status """ - def __init__(self, backend, get_debug_tiles, aie_iface, overlay): + def __init__(self, backend, get_debug_tiles, aie_iface, overlay, debug_map_json=None): """ Initialize the AIEStatus manager. @@ -26,12 +27,15 @@ def __init__(self, backend, get_debug_tiles, aie_iface, overlay): get_debug_tiles: Function to retrieve tiles of interest. aie_iface: Interface containing register maps and parsing. overlay: Overlay type string, e.g. "1x4x4". + debug_map_json: Optional; default path to debug_map.json used to resolve + the ASM hang line when callers do not pass one explicitly. """ self.backend = backend self.aie_iface = aie_iface self.get_debug_tiles = get_debug_tiles self.results = {} self.overlay = {} + self.default_debug_map_json = debug_map_json self.guidance_checker: Optional[AIEGuidanceChecker] = None if overlay == "1x4x4": self.overlay = self.aie_iface.parse_overlay() @@ -410,6 +414,8 @@ def update(self, tile_type=None, vaiml=False, advanced=False, debug_map_json=Non advanced: Optional; include extra diagnostics. debug_map_json: Optional; debug map path for microcontroller section. """ + if debug_map_json is None: + debug_map_json = self.default_debug_map_json if not tile_type: tile_type = self.aie_iface.TILE_TYPES @@ -467,6 +473,12 @@ def _get_uc_status(self, debug_map_json=None): self._append_uc_status() # Add HSA queue status for aie2ps self._append_hsa_queue_status() + if debug_map_json is not None and not os.path.exists(debug_map_json): + print( + f"[WARNING] debug_map.json not found at {debug_map_json}. " + "ASM hang line will be omitted from the AIE status." + ) + debug_map_json = None if debug_map_json is not None: with open(debug_map_json, "r", encoding="utf-8") as f: data = json.load(f) @@ -501,6 +513,8 @@ def get_uc_status(self, debug_map_json=None, guidance=False): debug_map_json: Optional; debug info file. guidance: Optional; if True, run guidance checks after status. Default: True """ + if debug_map_json is None: + debug_map_json = self.default_debug_map_json self.results = {} if self.aie_iface.HAS_UC_MODULE: self._get_uc_status(debug_map_json=debug_map_json) diff --git a/src/mldebug/client_debug.py b/src/mldebug/client_debug.py index 5e15f42..a041376 100644 --- a/src/mldebug/client_debug.py +++ b/src/mldebug/client_debug.py @@ -94,7 +94,8 @@ def __init__(self, args, ctx_id, pid, output_dir): self.impl = self.impls[0] self.status_handle = AIEStatus( - self.impl, self.design_info.overlay.get_tiles, args.aie_iface, self.design_info.overlay.get_repr() + self.impl, self.design_info.overlay.get_tiles, args.aie_iface, self.design_info.overlay.get_repr(), + debug_map_json=getattr(args, "debug_map_json", None) ) # Initialize specialized components (share mutable lists by reference)