@@ -1278,6 +1278,8 @@ class argument
12781278 { return arg.type ; }
12791279};
12801280
1281+ namespace xbi = xrt_core::bo_int;
1282+
12811283// class buffer_cache - A thread safe cache to hold pre created buffers
12821284//
12831285// This class maintains a fixed size pool of reusable buffers to
@@ -1290,6 +1292,7 @@ class buffer_cache
12901292 xrt::hw_context m_hw_ctx;
12911293 std::vector<uint8_t > m_buf_data;
12921294 const std::size_t m_max_cache_size;
1295+ xbi::use_type m_use_flag;
12931296
12941297 mutable std::mutex m_mutex;
12951298 mutable std::vector<xrt::bo> m_bo_cache;
@@ -1303,7 +1306,7 @@ class buffer_cache
13031306 }
13041307
13051308 static std::vector<xrt::bo>
1306- initialize_bo_cache (const xrt::hw_context& hwctx, size_t cache_size, size_t bo_size)
1309+ initialize_bo_cache (const xrt::hw_context& hwctx, size_t cache_size, size_t bo_size, xbi::use_type flag )
13071310 {
13081311 if (!cache_size)
13091312 return {};
@@ -1312,17 +1315,18 @@ class buffer_cache
13121315 cache.reserve (cache_size);
13131316
13141317 for (size_t i = 0 ; i < cache_size; ++i)
1315- cache.push_back (xrt::ext::bo (hwctx, bo_size));
1318+ cache.push_back (xbi::create_bo (hwctx, bo_size, flag ));
13161319
13171320 return cache;
13181321 }
13191322
13201323public:
1321- buffer_cache (xrt::hw_context ctx, std::vector<uint8_t >&& data, size_t max_size)
1324+ buffer_cache (xrt::hw_context ctx, std::vector<uint8_t >&& data, size_t max_size, xbi::use_type flag )
13221325 : m_hw_ctx(std::move(ctx))
13231326 , m_buf_data(std::move(data))
13241327 , m_max_cache_size(max_size)
1325- , m_bo_cache{initialize_bo_cache (m_hw_ctx, m_max_cache_size, m_buf_data.size ())}
1328+ , m_use_flag(flag)
1329+ , m_bo_cache{initialize_bo_cache (m_hw_ctx, m_max_cache_size, m_buf_data.size (), m_use_flag)}
13261330 {}
13271331
13281332 xrt::bo
@@ -1338,7 +1342,7 @@ class buffer_cache
13381342 }
13391343
13401344 if (!bo)
1341- bo = xrt::ext::bo (m_hw_ctx, m_buf_data.size ()); // create new bo if cache is empty
1345+ bo = xbi::create_bo (m_hw_ctx, m_buf_data.size (), m_use_flag ); // create new bo if cache is empty
13421346
13431347 fill_bo_with_data (bo, m_buf_data);
13441348 return bo;
@@ -1360,6 +1364,7 @@ class buffer_cache
13601364} // namespace
13611365
13621366namespace xrt {
1367+
13631368// struct kernel_impl - The internals of an xrtKernelHandle
13641369//
13651370// An single object of kernel_type can be shared with multiple
@@ -1648,7 +1653,8 @@ class kernel_impl : public std::enable_shared_from_this<kernel_impl>
16481653 size_t max_pool_size = std::max (pool_memory_size / ctrlpkt_buf_size, min_pool_size);
16491654
16501655 // Create and return buffer_cache with calculated pool size
1651- return std::make_unique<buffer_cache>(ctx, std::move (ctrlpkt_data), max_pool_size);
1656+ // use ctrlpkt flag while creating buffers
1657+ return std::make_unique<buffer_cache>(ctx, std::move (ctrlpkt_data), max_pool_size, xbi::use_type::ctrlpkt);
16521658 }
16531659
16541660public:
0 commit comments