8 const std::string&
name,
9 ISvcLocator* pSvcLocator
17 for (
const auto& interfaceDefinition : kernelDefinition) {
18 const std::string& storeGateKey = interfaceDefinition.at(
"storeGateKey");
22 if (interfaceDefinition.at(
"interfaceMode") ==
"INPUT") {
26 else if (interfaceDefinition.at(
"interfaceMode") ==
"OUTPUT") {
31 ATH_MSG_ERROR(
"Failed to map kernel definitions to xrt objects.");
33 return StatusCode::FAILURE;
38 return StatusCode::SUCCESS;
45 xrt::device device = xrt::device(0);
48 std::vector<xrt::run>
runs{};
49 std::vector<xrt::kernel> kernels{};
50 std::vector<xrt::bo> inputBuffers{};
51 std::vector<xrt::bo> outputBuffers{};
54 kernels.emplace_back(device, uuid, kernelName, xrt::kernel::cu_access_mode::exclusive);
55 runs.emplace_back(kernels.back());
57 for (
const auto& interfaceDefinition : kernelDefinition) {
58 const int argumentIndex = std::stoi(interfaceDefinition.at(
"argumentIndex"));
62 if (interfaceDefinition.at(
"interfaceMode") ==
"INPUT") {
63 ATH_MSG_INFO(
"Mapping: " << kernelName <<
",\tINPUT,\t" << argumentIndex);
65 inputBuffers.emplace_back(device,
67 kernels.back().group_id(argumentIndex));
69 runs.back().set_arg(argumentIndex, inputBuffers.back());
71 else if (interfaceDefinition.at(
"interfaceMode") ==
"OUTPUT") {
72 ATH_MSG_INFO(
"Mapping: " << kernelName <<
",\tOUTPUT,\t" << argumentIndex);
74 outputBuffers.emplace_back(device,
76 kernels.back().group_id(argumentIndex));
78 runs.back().set_arg(argumentIndex, outputBuffers.back());
81 ATH_MSG_ERROR(
"Failed to map kernel definitions to xrt objects.");
83 return StatusCode::FAILURE;
89 std::size_t handleIndex = 0;
99 inputBuffers[handleIndex].sync(XCL_BO_SYNC_BO_TO_DEVICE);
122 outputBuffers[handleIndex].sync(XCL_BO_SYNC_BO_FROM_DEVICE);
128 return StatusCode::SUCCESS;