Skip to content

Commit

Permalink
Adding buffer objects creation to class initialization list
Browse files Browse the repository at this point in the history
Signed-off-by: Akshay Tondak <[email protected]>
  • Loading branch information
Akshay Tondak authored and Akshay Tondak committed Sep 20, 2024
1 parent ef37f4e commit 0b9b9ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions src/runtime_src/core/tools/common/tests/TestHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
// - device: Reference to the xrt::device object
// - kernel: Reference to the xrt::kernel object
BO_set::BO_set(xrt::device& device, xrt::kernel& kernel, size_t buffer_size)
: buffer_size(buffer_size)
: buffer_size(buffer_size),
bo_instr (xrt::bo(device, buffer_size, XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5))),
bo_ifm (xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(1))),
bo_param (xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(2))),
bo_ofm (xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(3))),
bo_inter (xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(4))),
bo_mc (xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(7)))
{
// Initialize buffer objects with appropriate flags and group IDs
bo_instr = xrt::bo(device, buffer_size, XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5));
bo_ifm = xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(1));
bo_param = xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(2));
bo_ofm = xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(3));
bo_inter = xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(4));
bo_mc = xrt::bo(device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(7));

// no-op instruction buffer
std::memset(bo_instr.map<char*>(), (uint8_t)0, buffer_size);
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime_src/core/tools/common/tests/TestHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

// Class representing a set of buffer objects (BOs)
class BO_set {
size_t buffer_size; // Size of the buffer
xrt::bo bo_instr; // Buffer object for instructions
xrt::bo bo_ifm; // Buffer object for input feature map
xrt::bo bo_param; // Buffer object for parameters
xrt::bo bo_ofm; // Buffer object for output feature map
xrt::bo bo_inter; // Buffer object for intermediate data
xrt::bo bo_mc; // Buffer object for memory controller
uint32_t instr_size; // Size of the instruction buffer
size_t buffer_size; // Size of the buffer

public:
// Constructor to initialize buffer objects
Expand Down

0 comments on commit 0b9b9ba

Please sign in to comment.