Skip to content

Commit c3327c3

Browse files
Dev to Main for v1.1 (#9)
* Remove hardcoded batch size from kernel execution * Implement setBatchSize for complete Stack * Remove RingBuffer from Synchronous Inference and add full batch mapping * Deduplicate batchsize in basedriver & fix unittests * Fix integrationtests * Change input kernel code to run concurrrently to output kernel code * Optimize inference of lower batch sizes * Increase packing performance * Further optimize OpenMP * Optimize Utils * Some small changes * Add example data * Small Amounts of cleanup * Change Driver to run without XRT managed kernels * Add more efficient version of execute method * Hotfix FPGA bricking * Simplify inference interface to speed up inference * Update unittest * Simplify code * Update CMake * Fix Release Build CMakeLists * Fix wrong old variable names in CMake * Fix formatting * Change format target --------- Co-authored-by: Linus Jungemann <[email protected]> Co-authored-by: Linus Jungemann <[email protected]>
1 parent 21d7ae8 commit c3327c3

38 files changed

+875
-1010
lines changed

CMakeLists.txt

Lines changed: 60 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.16)
22

33
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
44
message(STATUS "${CMAKE_MODULE_PATH}")
5-
SET(FINNC_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
6-
SET(FINNC_BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
5+
SET(FINN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
6+
SET(FINN_BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
77
SET(CMAKE_COLOR_MAKEFILE ON)
88

99

@@ -45,14 +45,14 @@ include(cmake/CheckSubmodules.cmake)
4545

4646
# Doxygen
4747

48-
option(FINNC_BUILD_DOC "Build documentation" OFF)
48+
option(FINN_BUILD_DOC "Build documentation" OFF)
4949

5050
if (CMAKE_BUILD_TYPE STREQUAL "Release")
51-
set(FINNC_BUILD_DOC ON)
51+
set(FINN_BUILD_DOC ON)
5252
endif()
5353

5454
# Setup the doxygen code documentation
55-
if(FINNC_BUILD_DOC)
55+
if(FINN_BUILD_DOC)
5656
find_package(Doxygen)
5757
if (DOXYGEN_FOUND)
5858
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in)
@@ -72,17 +72,6 @@ endif()
7272

7373
#INCLUDES
7474

75-
# Custom paths for the unittest configuration and the header for in-use compilation
76-
if(DEFINED FINN_CUSTOM_UNITTEST_CONFIG)
77-
message(STATUS "Added custom unittest config path (${FINN_CUSTOM_UNITTEST_CONFIG})!")
78-
add_definitions(-DFINN_CUSTOM_UNITTEST_CONFIG=${FINN_CUSTOM_UNITTEST_CONFIG})
79-
endif()
80-
81-
if(DEFINED FINN_HEADER_LOCATION)
82-
message(STATUS "Added custom FINN-compiled header path (${FINN_HEADER_LOCATION})!")
83-
add_definitions(-DFINN_HEADER_LOCATION=${FINN_HEADER_LOCATION})
84-
endif()
85-
8675
#set(Boost_USE_STATIC_LIBS ON)
8776

8877
#Threads
@@ -100,15 +89,15 @@ find_package(OpenMP)
10089
#Boost
10190
set(Boost_DEBUG OFF)
10291
set(Boost_NO_SYSTEM_PATHS ON)
103-
set(BOOST_ROOT "${FINNC_BASE_DIR}/deps/finn_boost")
104-
set(BOOST_INCLUDEDIR "${FINNC_BASE_DIR}/deps/finn_boost")
105-
set(BOOST_LIBRARYDIR "${FINNC_BASE_DIR}/deps/finn_boost/stage/lib/boost")
92+
set(BOOST_ROOT "${FINN_BASE_DIR}/deps/finn_boost")
93+
set(BOOST_INCLUDEDIR "${FINN_BASE_DIR}/deps/finn_boost")
94+
set(BOOST_LIBRARYDIR "${FINN_BASE_DIR}/deps/finn_boost/stage/lib/boost")
10695
set(Boost_NAMESPACE "finnBoost")
107-
set(FINNC_SAVE_BOOST_ROOT $ENV{BOOST_ROOT})
96+
set(FINN_SAVE_BOOST_ROOT $ENV{BOOST_ROOT})
10897
set(ENV{BOOST_ROOT} "")
10998
find_package(Boost 1.80.0 COMPONENTS system log log_setup program_options filesystem ${BOOST_THREAD} REQUIRED)
11099
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
111-
set(ENV{BOOST_ROOT} ${FINNC_SAVE_BOOST_ROOT})
100+
set(ENV{BOOST_ROOT} ${FINN_SAVE_BOOST_ROOT})
112101
message(STATUS "${Boost_LIBRARIES}")
113102

114103
#mdspan
@@ -132,10 +121,35 @@ set(JSON_BuildTests OFF)
132121
add_subdirectory(external/json)
133122
include_directories(SYSTEM external/json/include/)
134123

124+
# Custom paths for the unittest configuration and the header for in-use compilation
125+
if(DEFINED FINN_CUSTOM_UNITTEST_CONFIG)
126+
message(STATUS "Added custom unittest config path (${FINN_CUSTOM_UNITTEST_CONFIG})!")
127+
add_definitions(-DFINN_CUSTOM_UNITTEST_CONFIG=${FINN_CUSTOM_UNITTEST_CONFIG})
128+
get_filename_component(FINN_CUSTOM_UNITTEST_CONFIG_FOLDER ${FINN_CUSTOM_UNITTEST_CONFIG} DIRECTORY)
129+
get_filename_component(FINN_CUSTOM_UNITTEST_CONFIG_NAME ${FINN_CUSTOM_UNITTEST_CONFIG} NAME)
130+
if (EXISTS "${FINN_CUSTOM_UNITTEST_CONFIG_FOLDER}/${FINN_CUSTOM_UNITTEST_CONFIG_NAME}" AND NOT IS_DIRECTORY "${FINN_CUSTOM_UNITTEST_CONFIG_FOLDER}/${FINN_CUSTOM_UNITTEST_CONFIG_NAME}")
131+
message(STATUS "Custom FINN header: found")
132+
else()
133+
message(FATAL_ERROR "Could not find FINN header at ${FINN_CUSTOM_UNITTEST_CONFIG_FOLDER}/${FINN_CUSTOM_UNITTEST_CONFIG_NAME}!")
134+
endif()
135+
endif()
136+
137+
if(DEFINED FINN_HEADER_LOCATION)
138+
message(STATUS "Added custom FINN-compiled header path (${FINN_HEADER_LOCATION})!")
139+
add_definitions(-DFINN_HEADER_LOCATION=${FINN_HEADER_LOCATION})
140+
get_filename_component(FINN_HEADER_LOCATION_FOLDER ${FINN_HEADER_LOCATION} DIRECTORY)
141+
get_filename_component(FINN_HEADER_LOCATION_NAME ${FINN_HEADER_LOCATION} NAME)
142+
if (EXISTS "${FINN_HEADER_LOCATION_FOLDER}/${FINN_HEADER_LOCATION_NAME}" AND NOT IS_DIRECTORY "${FINN_HEADER_LOCATION_FOLDER}/${FINN_HEADER_LOCATION_NAME}")
143+
message(STATUS "Custom FINN header: found")
144+
else()
145+
message(FATAL_ERROR "Could not find FINN header at ${FINN_HEADER_LOCATION_FOLDER}/${FINN_HEADER_LOCATION_NAME}!")
146+
endif()
147+
endif()
148+
135149
# Build Unit tests
136150
# Include before clang-tidy inclusion to exclude folder from clang-tidy
137151

138-
set(FINNC_ENABLE_TESTING "Build all tests (default is ON)" ON)
152+
set(FINN_ENABLE_TESTING "Build all tests (default is ON)" ON)
139153
FetchContent_MakeAvailable(googletest googlebenchmark)
140154
include(cmake/AddUnittest.cmake)
141155
include(cmake/AddBenchmark.cmake)
@@ -144,7 +158,7 @@ include(cmake/AddIntegrationtest.cmake)
144158
enable_testing()
145159
set(ENV{GTEST_OUTPUT} "json")
146160

147-
if (FINNC_ENABLE_TESTING)
161+
if (FINN_ENABLE_TESTING)
148162
message(STATUS "Finn C++ unittests:")
149163
add_subdirectory(unittests)
150164
message(STATUS "Finn C++ benchmarks:")
@@ -157,17 +171,17 @@ endif()
157171
add_library(finnc_options INTERFACE)
158172
add_library(finnc::finnc_options ALIAS finnc_options)
159173

160-
OPTION(FINNC_ENABLE_ALLOPT "Enable all optimizations" ON)
161-
if(${FINNC_ENABLE_ALLOPT})
174+
OPTION(FINN_ENABLE_ALLOPT "Enable all optimizations" ON)
175+
if(${FINN_ENABLE_ALLOPT})
162176
message(STATUS "All optimizations are enabled")
163177
target_compile_options(
164178
finnc_options
165179
INTERFACE -O3 -march=native -mtune=native -fstack-protector-strong -fopenmp -ffunction-sections -fdata-sections -pipe -funroll-loops)
166180
endif()
167181

168182
### Enable compiler warnings
169-
option(FINNC_ENABLE_WARNINGS "Enable warnings" ON)
170-
if (FINNC_ENABLE_WARNINGS)
183+
option(FINN_ENABLE_WARNINGS "Enable warnings" ON)
184+
if (FINN_ENABLE_WARNINGS)
171185
include(cmake/CompilerWarnings.cmake)
172186
finnc_set_project_warnings(
173187
finnc_options
@@ -176,7 +190,7 @@ if (FINNC_ENABLE_WARNINGS)
176190
""
177191
""
178192
"")
179-
endif (FINNC_ENABLE_WARNINGS)
193+
endif (FINN_ENABLE_WARNINGS)
180194

181195
#
182196
# Create options for including cmake files from the cmake folder with a bit of output.
@@ -198,38 +212,38 @@ endmacro()
198212
#message(STATUS "Build mode ${CMAKE_BUILD_TYPE}")
199213
if (CMAKE_BUILD_TYPE STREQUAL "Release")
200214
#message(WARNING "Analysers are off for Release build!")
201-
set(CLANG_FORMAT OFF)
202-
set(CLANG_TIDY OFF)
203-
set(CPP_CHECK OFF)
204-
set(IWYU OFF)
215+
set(FINN_CLANG_FORMAT OFF)
216+
set(FINN_CLANG_TIDY OFF)
217+
set(FINN_CPP_CHECK OFF)
218+
set(FINN_IWYU OFF)
205219
endif ()
206220

207221
#Sanitizers & Checks
208222

209223
include(cmake/Sanitizers.cmake)
210224

211-
OPTION(FINNC_ENABLE_SANITIZERS "Enable default analyzers" ON)
212-
OPTION(FINNC_ENABLE_THREAD_SANITIZERS "Enable thread analyzer" OFF)
213-
OPTION(FINNC_ENABLE_MEMORY_SANITIZERS "Enable memory analyzer" OFF)
225+
OPTION(FINN_ENABLE_SANITIZERS "Enable default analyzers" ON)
226+
OPTION(FINN_ENABLE_THREAD_SANITIZERS "Enable thread analyzer" OFF)
227+
OPTION(FINN_ENABLE_MEMORY_SANITIZERS "Enable memory analyzer" OFF)
214228

215-
if (FINNC_ENABLE_SANITIZERS)
229+
if (FINN_ENABLE_SANITIZERS)
216230
finncpp_enable_sanitizers(finnc_options
217-
${FINNC_ENABLE_SANITIZERS}
218-
${FINNC_ENABLE_SANITIZERS}
219-
${FINNC_ENABLE_SANITIZERS}
220-
${FINNC_ENABLE_THREAD_SANITIZERS}
221-
${FINNC_ENABLE_MEMORY_SANITIZERS})
231+
${FINN_ENABLE_SANITIZERS}
232+
${FINN_ENABLE_SANITIZERS}
233+
${FINN_ENABLE_SANITIZERS}
234+
${FINN_ENABLE_THREAD_SANITIZERS}
235+
${FINN_ENABLE_MEMORY_SANITIZERS})
222236
else()
223237
message(STATUS "All Sanitizers disabled.")
224238
endif()
225239

226240
message(STATUS "Checks:")
227241
list(APPEND CMAKE_MESSAGE_INDENT " ") #indent +1
228-
check_include(IPO "InterproceduralOptimization" InterproceduralOptimization.cmake)
229-
check_include(CLANG_FORMAT "clang-format" ClangFormat.cmake)
230-
check_include(CLANG_TIDY "clang-tidy" ClangTidy.cmake)
231-
check_include(CPP_CHECK "cppcheck" CppCheck.cmake)
232-
check_include(IWYU "iwyu" IWYU.cmake)
242+
check_include(FINN_IPO "InterproceduralOptimization" InterproceduralOptimization.cmake)
243+
check_include(FINN_CLANG_FORMAT "clang-format" ClangFormat.cmake)
244+
check_include(FINN_CLANG_TIDY "clang-tidy" ClangTidy.cmake)
245+
check_include(FINN_CPP_CHECK "cppcheck" CppCheck.cmake)
246+
check_include(FINN_IWYU "iwyu" IWYU.cmake)
233247
list(POP_BACK CMAKE_MESSAGE_INDENT) #indent -1
234248

235249
add_subdirectory(src)

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ git submodule update --init --recursive
6464
(git checkout <branch>)
6565
./buildDependencies.sh
6666
mkdir build && cd build
67-
cmake -DCMAKE_BUILD_TYPE=Release -DFINNC_ENABLE_SANITIZERS=Off -DFINN_HEADER_LOCATION=%YOUR_CONFIG_HEADER_LOCATION% ..
67+
cmake -DCMAKE_BUILD_TYPE=Release -DFINN_ENABLE_SANITIZERS=Off -DFINN_HEADER_LOCATION=%YOUR_CONFIG_HEADER_LOCATION% ..
6868
make -j $(nprocs)
6969
```
7070

@@ -78,7 +78,7 @@ By default, the FINN pipeline will not compile the FINN driver for you. After a
7878
```bash
7979
./buildDependencies.sh
8080
mkdir build && cd build
81-
cmake -DCMAKE_BUILD_TYPE=Release -DFINNC_ENABLE_SANITIZERS=Off ..
81+
cmake -DCMAKE_BUILD_TYPE=Release -DFINN_ENABLE_SANITIZERS=Off ..
8282
make -j $(nprocs)
8383
```
8484

@@ -134,6 +134,7 @@ Use ```xbutil``` to get information about the cards and configure them manually
134134
### External Use
135135

136136
**TLDR:**
137+
137138
```bash
138139
git submodule add https://github.com/eki-project/finn-cpp-driver.git
139140
cd finn-cpp-driver && git checkout dev && cd ..
@@ -154,7 +155,7 @@ add_subdirectory(external/finn-cpp-driver)
154155
#Link an example application against the finn driver
155156
#TODO: Maybe rework this so this is nicer with an exported targets?
156157
add_executable(main main.cpp)
157-
target_include_directories(main SYSTEM PRIVATE ${XRT_INCLUDE_DIRS} ${FINNC_SRC_DIR})
158+
target_include_directories(main SYSTEM PRIVATE ${XRT_INCLUDE_DIRS} ${FINN_SRC_DIR})
158159
target_link_directories(main PRIVATE ${XRT_LIB_CORE_LOCATION} ${XRT_LIB_OCL_LOCATION} ${BOOST_LIBRARYDIR})
159160
target_link_libraries(main PRIVATE finnc_core OpenCL xrt_coreutil uuid finnc_utils ${Boost_LIBRARIES})
160161
```

benchmarks/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
add_custom_target(Benchmarks)
22
set_target_properties(Benchmarks PROPERTIES FOLDER "benchmarks")
33

4-
set(FINNC_BENCHMARK_DIR ${CMAKE_CURRENT_BINARY_DIR})
4+
set(FINN_BENCHMARK_DIR ${CMAKE_CURRENT_BINARY_DIR})
55

66
add_benchmark(DataPackingBenchmark.cpp)
77
add_benchmark(CustomDynamicBitsetBenchmark.cpp)

benchmarks/DeviceBufferBenchmark.cpp

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <thread>
2222

2323
#include "xrt/xrt_device.h"
24-
#include "xrt/xrt_kernel.h"
2524

2625
// Provides config and shapes for testing
2726
#include "../unittests/core/UnittestConfig.h"
@@ -32,14 +31,14 @@ const unsigned int benchmarkBufferSize = 10000;
3231
const unsigned int iterations = 100;
3332

3433
static void BM_VecCopyBase(benchmark::State& state) {
35-
auto filler = FinnUtils::BufferFiller(0, 255);
36-
auto device = xrt::device();
37-
auto kernel = xrt::kernel();
38-
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, kernel, myShapePacked, benchmarkBufferSize);
34+
FinnUtils::BufferFiller filler(0, 255);
35+
xrt::device device;
36+
xrt::uuid uuid;
37+
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, uuid, myShapePacked, benchmarkBufferSize);
3938
auto dat1 = std::vector<uint8_t>();
4039
auto dat2 = std::vector<uint8_t>();
41-
dat1.resize(idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART));
42-
dat2.resize(idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART));
40+
dat1.resize(idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE));
41+
dat2.resize(idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE));
4342
filler.fillRandom(dat1);
4443
filler.fillRandom(dat2);
4544
for (auto _ : state) {
@@ -55,12 +54,12 @@ BENCHMARK(BM_VecCopyBase)->Iterations(iterations);
5554
//! Notation: CV = Changing vector, SV = Static vector, RP = Reference passing, IP = Iterator passing
5655

5756
static void BM_StoreCVRP(benchmark::State& state) {
58-
auto filler = FinnUtils::BufferFiller(0, 255);
59-
auto device = xrt::device();
60-
auto kernel = xrt::kernel();
61-
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, kernel, myShapePacked, benchmarkBufferSize);
57+
FinnUtils::BufferFiller filler(0, 255);
58+
xrt::device device;
59+
xrt::uuid uuid;
60+
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, uuid, myShapePacked, benchmarkBufferSize);
6261
Finn::vector<uint8_t> data;
63-
data.resize(idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART));
62+
data.resize(idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE));
6463
for (auto _ : state) {
6564
for (unsigned int i = 0; i < benchmarkBufferSize; i++) {
6665
filler.fillRandom(data.begin(), data.end());
@@ -72,12 +71,12 @@ BENCHMARK(BM_StoreCVRP)->Iterations(iterations);
7271

7372

7473
static void BM_StoreSVRP(benchmark::State& state) {
75-
auto filler = FinnUtils::BufferFiller(0, 255);
76-
auto device = xrt::device();
77-
auto kernel = xrt::kernel();
78-
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, kernel, myShapePacked, benchmarkBufferSize);
74+
FinnUtils::BufferFiller filler(0, 255);
75+
xrt::device device;
76+
xrt::uuid uuid;
77+
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, uuid, myShapePacked, benchmarkBufferSize);
7978
std::vector<uint8_t> data;
80-
data.resize(idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART));
79+
data.resize(idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE));
8180
for (auto _ : state) {
8281
for (unsigned int i = 0; i < benchmarkBufferSize; i++) {
8382
filler.fillRandom(data);
@@ -89,12 +88,12 @@ BENCHMARK(BM_StoreSVRP)->Iterations(iterations);
8988

9089

9190
static void BM_StoreCVIP(benchmark::State& state) {
92-
auto filler = FinnUtils::BufferFiller(0, 255);
93-
auto device = xrt::device();
94-
auto kernel = xrt::kernel();
95-
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, kernel, myShapePacked, benchmarkBufferSize);
91+
FinnUtils::BufferFiller filler(0, 255);
92+
xrt::device device;
93+
xrt::uuid uuid;
94+
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, uuid, myShapePacked, benchmarkBufferSize);
9695
Finn::vector<uint8_t> data;
97-
data.resize(idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART));
96+
data.resize(idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE));
9897
for (auto _ : state) {
9998
for (unsigned int i = 0; i < benchmarkBufferSize; i++) {
10099
idb.store(data);
@@ -105,12 +104,12 @@ BENCHMARK(BM_StoreCVIP)->Iterations(iterations);
105104

106105

107106
static void BM_StoreSVIP(benchmark::State& state) {
108-
auto filler = FinnUtils::BufferFiller(0, 255);
109-
auto device = xrt::device();
110-
auto kernel = xrt::kernel();
111-
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, kernel, myShapePacked, benchmarkBufferSize);
107+
FinnUtils::BufferFiller filler(0, 255);
108+
xrt::device device;
109+
xrt::uuid uuid;
110+
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, uuid, myShapePacked, benchmarkBufferSize);
112111
Finn::vector<uint8_t> data;
113-
data.resize(idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART));
112+
data.resize(idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE));
114113
for (auto _ : state) {
115114
for (unsigned int i = 0; i < benchmarkBufferSize; i++) {
116115
idb.store(data);
@@ -125,9 +124,9 @@ static void BM_StoreFCVRP(benchmark::State& state) {
125124
auto device = xrt::device();
126125
auto kernel = xrt::kernel();
127126
auto idb = Finn::DeviceInputBuffer<uint8_t>("Tester", device, kernel, myShapePacked, benchmarkBufferSize);
128-
const auto bytesPerSample = idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART);
127+
const auto bytesPerSample = idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE);
129128
std::vector<uint8_t> data;
130-
data.resize(idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART));
129+
data.resize(idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE));
131130
for (auto _ : state) {
132131
for (unsigned int i = 0; i < benchmarkBufferSize; i++) {
133132
idb.storeFast(data);
@@ -142,9 +141,9 @@ static void BM_StoreFCVIP(benchmark::State& state) {
142141
auto device = xrt::device();
143142
auto kernel = xrt::kernel();
144143
auto idb = Finn::DeviceInputBuffer<uint8_t>("Tester", device, kernel, myShapePacked, benchmarkBufferSize);
145-
const auto bytesPerSample = idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART);
144+
const auto bytesPerSample = idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE);
146145
std::vector<uint8_t> data;
147-
data.resize(idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART));
146+
data.resize(idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE));
148147
for (auto _ : state) {
149148
for (unsigned int i = 0; i < benchmarkBufferSize; i++) {
150149
idb.storeFast(data.begin(), data.end());
@@ -155,10 +154,10 @@ BENCHMARK(BM_StoreFCVIP)->Iterations(iterations);
155154
*/
156155

157156
static void BM_StoreMultithreaded_CVRP(benchmark::State& state) {
158-
auto filler = FinnUtils::BufferFiller(0, 255);
159-
auto device = xrt::device();
160-
auto kernel = xrt::kernel();
161-
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, kernel, myShapePacked, benchmarkBufferSize * 10);
157+
FinnUtils::BufferFiller filler(0, 255);
158+
xrt::device device;
159+
xrt::uuid uuid;
160+
auto idb = Finn::SyncDeviceInputBuffer<uint8_t>("Tester", device, uuid, myShapePacked, benchmarkBufferSize * 10);
162161

163162
// Prepare multithreading (allocate beforehand to improve vector performance)
164163
using Sample = Finn::vector<uint8_t>;
@@ -177,7 +176,7 @@ static void BM_StoreMultithreaded_CVRP(benchmark::State& state) {
177176
datas[i].resize(countSamplesPerThread);
178177
for (unsigned int j = 0; j < countSamplesPerThread; j++) {
179178
datas[i][j] = Sample();
180-
datas[i][j].resize(idb.size(SIZE_SPECIFIER::ELEMENTS_PER_PART));
179+
datas[i][j].resize(idb.size(SIZE_SPECIFIER::FEATUREMAP_SIZE));
181180
filler.fillRandom(datas[i][j].begin(), datas[i][j].end());
182181
}
183182
}

0 commit comments

Comments
 (0)