Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/mldebug/scripts/vaiprofile-collect-data
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
# Packages VAIProfile inputs from a hardware run directory into vai_profile.zip (top-level files only),
# then moves collected files into vai_profile_data (or vai_profile_data_<n> if the name exists).
# Collects: aie_event_runtime_config_ctx_<id>_run_<id>.json, aie_trace_ctx_*_run_*_inf_*_strm_*.txt,
# dtrace_dump_ctx*.py, record_timer_*.json (incl. record_timer_inference_*, record_timer_ts*, etc.),
# dtrace_dump_ctx*.py, aie_dtrace_*.ct, dtrace_dump_*.json,
# record_timer_*.json (incl. record_timer_inference_*, record_timer_ts*, etc.),
# onnxruntime_profile_*.json.
# vai_profile.zip remains at the run directory root.
# vai_profile.zip remains at the run directory root (or vai_profile_<n>.zip if the name already exists).
# Usage: vaiprofile-collect-data <hardware_run_directory>
# Requires: zip (Info-ZIP) on PATH.

Expand Down Expand Up @@ -52,6 +53,12 @@ done
for f in dtrace_dump_ctx*.py; do
files+=("$f")
done
for f in aie_dtrace_*.ct; do
files+=("$f")
done
for f in dtrace_dump_*.json; do
files+=("$f")
done
for f in record_timer_*.json; do
files+=("$f")
done
Expand All @@ -68,17 +75,19 @@ if ((${#files[@]} == 0)); then
exit 1
fi

# Pick a single index shared by vai_profile_<n>.zip and vai_profile_data_<n>,
# so the zip and its extracted data directory always use the same suffix.
out="${root}/vai_profile.zip"
rm -f "$out"
zip -j -q "$out" -- "${files[@]}"

profile_dir="${root}/vai_profile_data"
if [[ -e "$profile_dir" ]]; then
if [[ -e "$out" || -e "$profile_dir" ]]; then
n=1
while [[ -e "${root}/vai_profile_data_${n}" ]]; do
while [[ -e "${root}/vai_profile_${n}.zip" || -e "${root}/vai_profile_data_${n}" ]]; do
((n++)) || true
done
out="${root}/vai_profile_${n}.zip"
profile_dir="${root}/vai_profile_data_${n}"
fi
zip -j -q "$out" -- "${files[@]}"

mkdir -p "$profile_dir"
mv -- "${files[@]}" "$profile_dir/"
Loading