From f538bd38d985e746ebddaae212d9fa1c3706584b Mon Sep 17 00:00:00 2001 From: Jyotheeswar Ganne Date: Wed, 24 Jun 2026 23:58:11 -0600 Subject: [PATCH 1/2] Fix missing ASM hang line in --dump-aie-status The --dump-aie-status path called AIEStatus.get() without forwarding the resolved debug_map.json path, so debug_map_json defaulted to None and the ASM hang line (ASM_OPCODE/ASM_OPCODE_LINE/ASM_OPCODE_FILE) was never emitted. - Forward args.debug_map_json into get() in launch_debug, guarded by an os.path.exists check that warns and degrades when the map is missing. - Harden _get_uc_status to skip (with a warning) instead of raising when the debug_map_json path does not exist. Co-authored-by: Cursor --- src/mldebug/aie_status.py | 7 +++++++ src/mldebug/mldebug_cli.py | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mldebug/aie_status.py b/src/mldebug/aie_status.py index 0ba2f95..6ea2642 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 @@ -467,6 +468,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) diff --git a/src/mldebug/mldebug_cli.py b/src/mldebug/mldebug_cli.py index b41ac19..640b6e6 100644 --- a/src/mldebug/mldebug_cli.py +++ b/src/mldebug/mldebug_cli.py @@ -152,10 +152,18 @@ def launch_debug(args, output_dir): _apply_unsupported_kernels_from_args(args) handle = ClientDebug(args, context_id, pid, output_dir) if args.dump_aie_status: + dmj = getattr(args, "debug_map_json", None) + if dmj is not None and not os.path.exists(dmj): + print( + f"[WARNING] debug_map.json not found at {dmj}. " + "ASM hang line will be omitted from the AIE status." + ) + dmj = None handle.status_handle.get( args.dump_aie_status, advanced=True, - guidance=False + guidance=False, + debug_map_json=dmj ) print(f"[INFO] Advanced AIE status written to {args.dump_aie_status}") return From 73cbd03f3b45d5136b60d56638025d8afeccf944 Mon Sep 17 00:00:00 2001 From: Jyotheeswar Ganne Date: Thu, 25 Jun 2026 00:13:29 -0600 Subject: [PATCH 2/2] Resolve ASM hang line for all status entry points Centralize debug_map.json resolution so the ASM hang line is emitted by every status entry point (--dump-aie-status, --exec "status()"/"uc_status()", and the interactive a/u commands), not just --dump-aie-status. - AIEStatus stores a default debug_map_json (from args) at construction; update() and get_uc_status() fall back to it when callers pass None. - ClientDebug forwards args.debug_map_json into the AIEStatus constructor. - Drop the now-redundant explicit pass/guard in the --dump-aie-status branch. Co-authored-by: Cursor --- src/mldebug/aie_status.py | 9 ++++++++- src/mldebug/client_debug.py | 3 ++- src/mldebug/mldebug_cli.py | 10 +--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mldebug/aie_status.py b/src/mldebug/aie_status.py index 6ea2642..f8a6872 100644 --- a/src/mldebug/aie_status.py +++ b/src/mldebug/aie_status.py @@ -18,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. @@ -27,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() @@ -411,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 @@ -508,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) diff --git a/src/mldebug/mldebug_cli.py b/src/mldebug/mldebug_cli.py index 640b6e6..b41ac19 100644 --- a/src/mldebug/mldebug_cli.py +++ b/src/mldebug/mldebug_cli.py @@ -152,18 +152,10 @@ def launch_debug(args, output_dir): _apply_unsupported_kernels_from_args(args) handle = ClientDebug(args, context_id, pid, output_dir) if args.dump_aie_status: - dmj = getattr(args, "debug_map_json", None) - if dmj is not None and not os.path.exists(dmj): - print( - f"[WARNING] debug_map.json not found at {dmj}. " - "ASM hang line will be omitted from the AIE status." - ) - dmj = None handle.status_handle.get( args.dump_aie_status, advanced=True, - guidance=False, - debug_map_json=dmj + guidance=False ) print(f"[INFO] Advanced AIE status written to {args.dump_aie_status}") return