Skip to content

Runner script for Detailed Profile data using control instrumentation on VE2 - #72

Merged
jvillarre merged 1 commit into
Xilinx:mainfrom
IshitaGhosh:ve2runner
Nov 18, 2026
Merged

jvillarre merged 1 commit into
Xilinx:mainfrom
IshitaGhosh:ve2runner

Conversation

@IshitaGhosh

Copy link
Copy Markdown

Runner script for collecting Detailed Profile data using control instrumentation on VE2

VE2 Detailed Profile Report board runner

vaiprofile_detailed_report_ve2_board_runner.py runs VAIML tests on a VE2 PetaLinux board and captures
control_instrumentation based detailed profiling data for each test, stored in the vaiprofile_reports
sub-directory of each test. To generate the Detailed Profile Report with Boundness Classification, copy the
vaiprofile_reports sub-directory of each test to a Linux x86 machine and analyze it with
vaiprofile --generate-profile-report (see below).

Usage

python3 vaiprofile_detailed_report_ve2_board_runner.py --test-path <test or folder of tests> [options]
Option Description
--test-path PATH A test folder, or a folder holding test folders at any depth (required)
--runner PATH ve2.py to use (default: the nearest ve2.py per test: the test folder, its parents up to --test-path, then, for a single test, its parent)
--no-detailed-profiling Only do the base run of each test
--timeout SECONDS Per-step timeout (default 1800)
--skip-setup Skip the pip3 config / pip3 install setup commands
--dry-run Print the setup and run commands; run nothing
-h, --help Show help

--help-all is not listed in --help. It shows the help with the full flow description and the hidden options
(--help-all, --archive, --extract-dir). Both --help and --help-all print to stdout.

A test folder is one holding onnx_model/ or vitisai_config.json. It needs onnx_model/*.onnx,
vitisai_config.json and overlay/x_plus_ml.pdi plus overlay/x_plus_ml.dtbo. If vaiml_config.custom_ops
is set, it also needs custom_ops_config.json.

Flow

  1. Setup board and environment, done once:
    • the pip3 setup commands, unless --skip-setup is given;
    • the environment variables (LD_LIBRARY_PATH, XRT_AIARM, ...);
    • a check of the flexmlrt, voe and onnxruntime-vitisai packages. Missing packages are installed from
      the first whl_files/ folder found.
  2. For each test:
    1. Reload the overlay with fpgautil -R and fpgautil -b ./overlay/x_plus_ml.pdi -o ./overlay/x_plus_ml.dtbo.
    2. Base Run: python ve2.py --input_model onnx_model/<model>.onnx --analyzer_profiling True.
      • The run uses vitisai_config.json with control_instrumentation removed from
        vaiml_config.ai_analyzer_enhanced_profiling.
      • If the run passes, vitisai_config.json is restored.
      • If it fails, vitisai_config.json is left as it is, and the original is kept as
        vitisai_config.json.with_control_instrumentation.
    3. Backup collect, done once per test, after the Base Run passes and before the first profiling run
      (Run A). It runs only if detailed profiling is on.
      • If the test folder holds aie_dtrace_ctx_*.ct, dtrace_dump_ctx_*.json or vai_profile*.zip files
        from earlier runs, they are saved in backup_vaiprofile_<YYYYmmdd_HHMMSS>.zip. That way, data from
        before this script ran is kept separately from the data of Runs A to D.
        • If dtrace files are present, vaiprofile-collect-data is run and its vai_profile.zip becomes the
          backup.
        • Existing vai_profile*.zip files are moved aside before that collect, so it cannot overwrite them.
          They are then added into the backup under their own names and removed from the test folder.
      • If there are no such files, the step is skipped.
      • If the backup collect fails, a warning is printed and the profiling runs still go ahead. Any old
        vai_profile*.zip files are still saved in the backup.
    4. Profiling Runs A to D, after the backup collect, unless --no-detailed-profiling is given and only
      if the Base Run passed:
      • Each run uses vitisai_config.json with control_instrumentation added and its own
        profiling_runtime_config.
      • The data is collected with vaiprofile-collect-data.
      • vitisai_config.json is restored afterwards.
Run Folder under vaiprofile_reports/ profiling_runtime_config.control_instrumentation
A detailed_core_shim_read_ch_0 interface_tile: detailed_ddr_read_bandwidth:0, aie_tile: compute_io_bound
B detailed_shim_read_ch_1 interface_tile: detailed_ddr_read_bandwidth:1
C detailed_shim_write_ch_0 interface_tile: detailed_ddr_write_bandwidth:0
D detailed_shim_write_ch_1 interface_tile: detailed_ddr_write_bandwidth:1

If control_instrumentation is not found in vitisai_config.json, vitisai_config.json.with_control_instrumentation
or vitisai_config.json.orig, the script prints a warning that the design may not be compiled with
control_instrumentation. The profiling runs still go ahead.

Output

Path Contents
<test-path>/setup.log Output of the setup commands
<test-path>/vaiprofile_detailed_run_summary.csv One row per test: status, exit code, timings, profiling results, notes
<test>/fpgautil.log Output of the overlay reload
<test>/board_run.log Output of the Base Run
<test>/backup_vaiprofile_<YYYYmmdd_HHMMSS>.zip Backup of earlier dtrace data and vai_profile*.zip files, if any
<test>/vaiprofile-collect-data_backup.log Output of the backup vaiprofile-collect-data, if it ran
<test>/vaiprofile_reports/<run>/ Per profiling run: vitisai_config.json, board_run.log, vaiprofile-collect-data.log, vaiprofile_data.zip

The script exits non-zero if any Base Run or profiling run did not pass.

Examples

# All tests under a folder, with detailed profiling (default)
python3 vaiprofile_detailed_report_ve2_board_runner.py --test-path /mnt/designs

# One test, base run only, setup already done
python3 vaiprofile_detailed_report_ve2_board_runner.py --test-path /mnt/designs/resnet50 \
    --no-detailed-profiling --skip-setup

# See what would run
python3 vaiprofile_detailed_report_ve2_board_runner.py --test-path /mnt/designs --dry-run

Generating Detailed Profile Report with Boundness Classification on Linux x86

Copy each test's vaiprofile_reports folder to Linux x86. Then run vaiprofile with the test case path, followed
by all the vaiprofile_data.zip files collected in vaiprofile_reports:

vaiprofile --generate-profile-report <testcase_path> [all the vaiprofile_data.zip collected in vaiprofile_reports]

For example:

vaiprofile --generate-profile-report <testcase_path> \
    <testcase_path>/vaiprofile_reports/detailed_core_shim_read_ch_0/vaiprofile_data.zip \
    <testcase_path>/vaiprofile_reports/detailed_shim_read_ch_1/vaiprofile_data.zip \
    <testcase_path>/vaiprofile_reports/detailed_shim_write_ch_0/vaiprofile_data.zip \
    <testcase_path>/vaiprofile_reports/detailed_shim_write_ch_1/vaiprofile_data.zip

…rumentation on VE2

Co-authored-by: Cursor <cursoragent@cursor.com>
@jvillarre
jvillarre self-requested a review November 18, 2026 19:16
@jvillarre
jvillarre merged commit cd1c0f6 into Xilinx:main Nov 18, 2026
1 check passed
@IshitaGhosh
IshitaGhosh deleted the ve2runner branch November 18, 2026 21:31
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