Skip to content

Commit c55b756

Browse files
Li Shishili
authored andcommitted
[fix] cflownet performance test:add batch (#1024)
Co-authored-by: shili <[email protected]>
1 parent abe8f82 commit c55b756

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

examples/vai_library/samples/cflownet/test_performance_cflownet.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 Xilinx Inc.
2+
* Copyright 2022-2023 Advanced Micro Devices Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -157,7 +157,15 @@ inline BenchMarkResult thread_main_for_performance(const PointsList *points_list
157157
while (!g_stop) {
158158
vitis::ai::TimeMeasure::getThreadLocalForDpu().reset();
159159
auto start = std::chrono::steady_clock::now();
160-
model->run( (*points_list)[ret++].data());
160+
// model->run( (*points_list)[ret++].data());
161+
auto batch = model->get_input_batch();
162+
std::vector<const float*> imgs;
163+
imgs.reserve(batch);
164+
for (auto n = 0u; n < batch; n++) {
165+
imgs.push_back((*points_list)[ret++].data());
166+
}
167+
model->run(imgs );
168+
161169
auto end = std::chrono::steady_clock::now();
162170
auto end2endtime =
163171
int(std::chrono::duration_cast<std::chrono::microseconds>(end - start)
@@ -166,7 +174,7 @@ inline BenchMarkResult thread_main_for_performance(const PointsList *points_list
166174

167175
e2e_stat_samples.addSample(end2endtime);
168176
dpu_stat_samples.addSample(dputime);
169-
_counter += 1;
177+
_counter += batch;
170178
}
171179
return BenchMarkResult{ret, std::move(e2e_stat_samples),
172180
std::move(dpu_stat_samples)};

0 commit comments

Comments
 (0)