Skip to content

[Feature] Generate MindStudio Insight replay traces from kernel args dump #836

@vegetabledoww

Description

@vegetabledoww

Summary

Add a first-class Insight Trace replay workflow that consumes kernel args dump artifacts and generates a MindStudio Insight-compatible simulator trace directory.

The runtime side already has dump producer work, including tensor dump infrastructure and args metadata export. This feature covers the consumer side: take a dump directory, select a target kernel dispatch, reconstruct replay arguments, generate a replay workspace, run msprof op simulator, and export the simulator/ directory that MindStudio Insight can open.

Motivation / Use Case

When debugging or profiling a single incore kernel, developers need a way to move from an observed runtime execution to an offline replay artifact that can be inspected in MindStudio Insight.

Before this feature, the workflow required manually converting dump output into an --arg-spec JSON file. That manual step is error-prone and duplicates information already present in dispatch-level kernel args dumps.

A direct dump-to-replay path would allow developers to:

  • Reuse runtime dump artifacts as replay inputs
  • Select a specific func_id and dispatch_id
  • Avoid manually writing tensor/scalar arg specs
  • Generate a replay workspace for a single kernel_entry(args) kernel
  • Export a MindStudio Insight-compatible simulator/ artifact

Proposed API / Behavior

Add CLI support similar to:

python -m simpler_setup.tools.insight_trace \
  <test_module> \
  --case <case_name> \
  --func-id <func_id> \
  --dump-dir <dump_output_dir> \
  --dispatch-id <dispatch_id>

Expected behavior:

  1. Load the scene case and select the target incore kernel by --func-id.
  2. Read kernel_args_dump.json from either:
    • <dump-dir>/kernel_args_dump.json
    • <dump-dir>/tensor_dump/kernel_args_dump.json
  3. Select the dispatch matching both func_id and dispatch_id.
  4. Convert tensor and scalar entries into replay TraceArg values.
  5. Ignore runtime context slots such as local/global context pointers when generating single-task replay args.
  6. Generate the replay workspace and run the existing msprof op simulator collect/export path.
  7. Print the generated MindStudio Insight input directory:
<workspace>/insight_export/OPPROF_*/simulator/

Relationship to Existing Work

This is the consumer side of the dump pipeline.

Related existing work:

This issue is related to those diagnostics capabilities, but it does not close them. It adds the offline replay/Insight consumption path on top of dump artifacts.

Acceptance Criteria

  • simpler_setup.tools.insight_trace accepts --dump-dir and --dispatch-id for the simpler backend.
  • The CLI requires --func-id when --dump-dir is used.
  • Dispatch-level tensor/scalar args are parsed from kernel_args_dump.json.
  • Local/global context slots are filtered out for single-task replay.
  • Unit tests cover dump arg parsing, context slot filtering, and func_id + dispatch_id matching.
  • A real paged_attention CaseSmall1 / SF replay can generate a MindStudio Insight-compatible simulator/ directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions