Skip to content

Conversation

vinicius-r-silva
Copy link
Collaborator

This PR introduces the Trace Generator Tool along with improvements in the documentation at traces/stf_trace_archive/README.md and traces/docker_stf_trace_gen/README.md. The main goal of this tool is to create STF trace and it's metadata file for workload using docker.

The trace generator tool comes with three different modes

  • Macro → uses START_TRACE and STOP_TRACE macros embedded in the workload
  • Instruction Count (insn_count) → traces a fixed number of instructions after skipping some
  • Program Counter (pc_count) → traces after a specific program counter (PC) is reached

Other options included in the tool are:

  • --isa ISA. Instruction set architecture (e.g., rv64imafdc).
  • --dump. Create a trace file dump.
  • --pk. Run Spike with pk (proxy kernel).

This PR files follows this structure:

README.md                  # Main documentation file
README.md                  # Trace generator documentation file
src/
├── data/                  # Core data models and classes
├── converters/                  # Converter classes
├── factories/              # Factory classes
├── utils/                 # Utility functions and helpers
└── generate_trace.py       # Main CLI entry point

Quickstart

  1. Macro mode (SPIKE only)
    Trace using START_TRACE / STOP_TRACE markers inside the workload:

    python generate_trace.py --emulator spike macro workload.elf
  2. Instruction Count mode
    Skip 1000 instructions, then trace 5000 instructions:

    python generate_trace.py --emulator qemu insn_count \
        --num-instructions 5000 --start-instruction 1000 workload.elf
  3. Program Counter mode (QEMU only)
    Start tracing after PC 0x80000000 is hit 5 times, trace 2000 instructions:

    python generate_trace.py --emulator qemu pc_count \
        --num-instructions 2000 --start-pc 0x80000000 --pc-threshold 5 workload.elf

Next Steps:

  • Integrate utils/docker_orchestrator.py with all docker related function created on PR Initial Flow Script for riscv-perf-model #275
  • Add a simpoint option, passing a simpoint file as input and generating traces from it
  • Validate and compare trace results generated by both Spike and QEMU
  • Look at including a Macro mode for the qemu plugin
  • Create test classes

@Jatin-exe Jatin-exe self-requested a review September 15, 2025 17:05
Copy link
Collaborator

@Jatin-exe Jatin-exe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Jatin-exe Jatin-exe merged commit a96b43e into riscv-software-src:master Sep 16, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants