diff --git a/README.md b/README.md index 9545196..e6c8fbc 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,6 @@ options: Use -d flag to specify device. --dump-aie-status Write AIE status to a file and exit. - --no_header Assume raw core dump without header. Use with -c. -d DEV, --device DEV AIE device [phx,stx,telluride]. Default: telluride -o , --overlay Overlay used by design. Default: 4x4 diff --git a/src/mldebug/backend/core_dump_impl.py b/src/mldebug/backend/core_dump_impl.py index 0825d20..e66a9db 100644 --- a/src/mldebug/backend/core_dump_impl.py +++ b/src/mldebug/backend/core_dump_impl.py @@ -15,7 +15,6 @@ try: from .xrt_backend import MlDebug - HAS_XRT_BACKEND = True except ImportError: HAS_XRT_BACKEND = False diff --git a/src/mldebug/input_parser.py b/src/mldebug/input_parser.py index c7c4c90..ba5cb59 100644 --- a/src/mldebug/input_parser.py +++ b/src/mldebug/input_parser.py @@ -293,18 +293,28 @@ def set_device(args) -> None: None """ endmsg = "\n" + + # Core-dump device comes from the file header. Peek to detect it and to see + # if the file even has a header; a headerless dump needs an explicit -d. + header_variant = None + if getattr(args, "core_dump", None): + header_variant = CoreDumpFallbackReader.peek_device(args.core_dump) + args.no_header = header_variant is None + if args.no_header and not args.device: + print( + "[ERROR] Core dump file has no readable header. Re-run with -d/--device " + "to specify the device (e.g. -d telluride) so the raw dump can be parsed." + ) + cleanup_and_exit(args) + if args.device: # User-specified device; honor it as the variant and derive the base. args.sub_device = args.device args.device = get_base_device(args.device) else: endmsg = " Use -d to specify a diferent device.\n" - variant = None - - # For core dumps, the device is baked into the file header. Detect it now - # so the overlay (built before the backend) uses the correct aie_iface. - if getattr(args, "core_dump", None) and not getattr(args, "no_header", False): - variant = CoreDumpFallbackReader.peek_device(args.core_dump) + # Prefer the header-detected device. + variant = header_variant if variant is None: variant = _detect_vaiml_variant(args.aie_dir) diff --git a/src/mldebug/mldebug_cli.py b/src/mldebug/mldebug_cli.py index 6dd79f4..08cc501 100644 --- a/src/mldebug/mldebug_cli.py +++ b/src/mldebug/mldebug_cli.py @@ -242,9 +242,6 @@ def app(): help="Write AIE status to a file and exit.\n", default=None, ) - p.add_argument( - "--no_header", action="store_true", help="Assume raw core dump without header. Use with -c." - ) # Hidden Argument # 'AIE Device type' p.add_argument( @@ -311,8 +308,9 @@ def app(): dest="load_script", default=None, metavar="", - help="Execute a Python script in the advanced shell namespace.\n" - "Exits after the script unless -i or -s is also specified.\n", + help=_dev_cli_help( + "Execute a Python script in the advanced shell namespace.\n" + ), ) p.add_argument( "-e", @@ -366,7 +364,7 @@ def app(): "mock_hang", "l2_ifm_dump", "text_dump", - "l1_ofm_dump", + #"l1_ofm_dump", "skip_iter", "dump_temps", "multistamp", @@ -378,7 +376,7 @@ def app(): # "layer_status : Dump AIE status at start of each layer\n" # "l2_dump_only : Dump only L2 buffers\n" "l2_ifm_dump : Dump only L2 IFM buffers\n" - "l1_ofm_dump : Dump L1 ofm buffers in addition to others\n" + #"l1_ofm_dump : Dump L1 ofm buffers in addition to others\n" "text_dump : Dump in text format\n" "skip_iter : Skip iterations in batch mode when possible\n" "skip_iter2 : skip_iter using lcp lock.(Telluride only)\n"