Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/mldebug/aie_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Utility to help make sense of AIE register Values
"""

import os
import re
import json
import subprocess
Expand All @@ -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.

Expand All @@ -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()
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/mldebug/client_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading