Skip to content

Commit

Permalink
allow npu_perf_trace.sh to trace shim_test (#247)
Browse files Browse the repository at this point in the history
Signed-off-by: Max Zhen <max.zhen@amd.com>
  • Loading branch information
maxzhen authored Sep 10, 2024
1 parent 182163a commit 79c1313
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/driver/tools/npu_perf_analyze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ while [ $# -gt 0 ]; do
;;
*)
break
;;
esac
shift
done
Expand Down
12 changes: 12 additions & 0 deletions src/driver/tools/npu_perf_trace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ fi
# Global variables
sdt_pre_enabled=0
xrt_lib_prefix="/opt/xilinx/xrt/lib"
while [ $# -gt 0 ]; do
case "$1" in
-libdir | -l)
xrt_lib_prefix=$2
shift
;;
*)
break
;;
esac
shift
done
accel_debugfs="/sys/kernel/debug/accel"
xrt_libs="${xrt_lib_prefix}/libxrt_coreutil.so,${xrt_lib_prefix}/libxrt_driver_xdna.so"
perf_record_args="-e amdxdna_trace:* "
Expand Down
6 changes: 4 additions & 2 deletions test/shim_test/io_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ int verify_output(int8_t* buf, const std::string &wrk_path)
ss >> key >> str_val;
ss.clear();
golden_output_files.push_back(wrk_path + "golden_" + str_val + ".bin");
dump_output_files.push_back(wrk_path + "dump_" + str_val + ".bin");
dump_output_files.push_back("/tmp/dump_" + str_val + "." + std::to_string(getpid()) + ".bin");

getline(myfile, line);
ss.str(line);
Expand Down Expand Up @@ -239,12 +239,14 @@ int verify_output(int8_t* buf, const std::string &wrk_path)

int ret = 0;
for (int i = 0; i < num_outputs; i++) {
std::cout << "Examing output: " << golden_output_files[i] << std::endl;
ret = comp_buf_strides(buf + output_ddr_addr[i], golden_output_files[i],
dump_output_files[i], output_shapes[i], output_strides[i]);
if (ret) {
std::cout << "Examing failed, ret " << ret << std::endl;
std::cout << "Examing output: " << dump_output_files[i] << std::endl;
break;
} else {
std::remove(dump_output_files[i].c_str());
}
}

Expand Down

0 comments on commit 79c1313

Please sign in to comment.