43 return StatusCode::SUCCESS;
65 uint64_t *stripClusters = stripOutput.data();
66 uint64_t *pixelClusters = pixelOutput.data();
68 unsigned int numStripClusters = stripClusters[0];
71 unsigned int numPixelClusters = pixelClusters[0];
74 std::unique_ptr<EFTrackingTransient::Metadata>
metadata =
75 std::make_unique<EFTrackingTransient::Metadata>();
77 metadata->numOfStripClusters = numStripClusters;
78 metadata->scRdoIndexSize = numStripClusters;
79 metadata->numOfPixelClusters = numPixelClusters;
80 metadata->pcRdoIndexSize = numPixelClusters;
88 return StatusCode::SUCCESS;
97 if (!scContainerHandle.
isValid())
100 return StatusCode::FAILURE;
104 if (!pcContainerHandle.
isValid())
107 return StatusCode::FAILURE;
111 std::vector<uint64_t> encodedStripClusters;
112 std::vector<uint64_t> encodedPixelClusters;
123 kernel.setArg<cl::Buffer>(0, inputPixelBuffer);
124 kernel.setArg<cl::Buffer>(1, inputStripBuffer);
125 kernel.setArg<cl::Buffer>(2, outputPixelBuffer);
126 kernel.setArg<cl::Buffer>(3, outputStripBuffer);
130 acc_queue.enqueueWriteBuffer(inputPixelBuffer, CL_FALSE, 0,
sizeof(
uint64_t) * encodedPixelClusters.size(), encodedPixelClusters.data(), NULL, NULL);
131 acc_queue.enqueueWriteBuffer(inputStripBuffer, CL_FALSE, 0,
sizeof(
uint64_t) * encodedStripClusters.size(), encodedStripClusters.data(), NULL, NULL);
137 acc_queue.enqueueTask(kernel);
144 acc_queue.enqueueReadBuffer(outputPixelBuffer, CL_FALSE, 0,
sizeof(
uint64_t) * pixelChainOutput.size(), pixelChainOutput.data(), NULL, NULL);
145 acc_queue.enqueueReadBuffer(outputStripBuffer, CL_FALSE, 0,
sizeof(
uint64_t) * stripChainOutput.size(), stripChainOutput.data(), NULL, NULL);
149 return StatusCode::SUCCESS;
162 std::vector<uint64_t> encodedPixelRDO;
163 std::vector<uint64_t> encodedStripRDO;
165 std::vector<IdentifierHash> listOfPixelIds;
166 std::vector<IdentifierHash> listOfStripIds;
172 for (
unsigned int i = 0;
i < encodedPixelRDO.size();
i++)
174 ATH_MSG_DEBUG(
"Pixel RDO[" <<
i <<
"]: " << std::hex << encodedPixelRDO[
i] << std::dec);
176 for (
unsigned int i = 0;
i < encodedStripRDO.size();
i++)
178 ATH_MSG_DEBUG(
"Strip RDO[" <<
i <<
"]: " << std::hex << encodedStripRDO[
i] << std::dec);
183 cl::Buffer pixelClusterInputBuffer(
m_context, CL_MEM_READ_ONLY,
sizeof(
uint64_t) * encodedPixelRDO.size(), NULL, &
err);
184 cl::Buffer stripClusterInputBuffer(
m_context, CL_MEM_READ_ONLY,
sizeof(
uint64_t) * encodedStripRDO.size(), NULL, &
err);
202 pixelClusteringKernel.setArg<cl::Buffer>(0, pixelClusterInputBuffer);
203 pixelClusteringKernel.setArg<cl::Buffer>(1, pixelClusterOutputBuffer);
204 pixelClusteringKernel.setArg<cl::Buffer>(2, pixelClusterEDMOutputBuffer);
207 stripClusteringKernel.setArg<cl::Buffer>(0, stripClusterInputBuffer);
208 stripClusteringKernel.setArg<cl::Buffer>(1, stripClusterOutputBuffer);
209 stripClusteringKernel.setArg<cl::Buffer>(2, stripClusterEDMOutputBuffer);
210 stripClusteringKernel.setArg<
unsigned int>(3, encodedStripRDO.size());
214 pixelL2GKernel.setArg<cl::Buffer>(0, pixelClusterOutputBuffer);
215 pixelL2GKernel.setArg<cl::Buffer>(1, pixelClusterEDMOutputBuffer);
216 pixelL2GKernel.setArg<cl::Buffer>(2, pixelL2GOutputBuffer);
217 pixelL2GKernel.setArg<cl::Buffer>(3, pixelL2GEDMOutputBuffer);
220 stripL2GKernel.setArg<cl::Buffer>(0, stripClusterOutputBuffer);
221 stripL2GKernel.setArg<cl::Buffer>(1, stripClusterEDMOutputBuffer);
222 stripL2GKernel.setArg<cl::Buffer>(2, stripL2GOutputBuffer);
223 stripL2GKernel.setArg<cl::Buffer>(3, stripL2GEDMOutputBuffer);
227 edmPrepKernel.setArg<cl::Buffer>(0, pixelL2GEDMOutputBuffer);
228 edmPrepKernel.setArg<cl::Buffer>(1, stripL2GEDMOutputBuffer);
229 edmPrepKernel.setArg<cl::Buffer>(2, edmPixelOutputBuffer);
230 edmPrepKernel.setArg<cl::Buffer>(3, edmStripOutputBuffer);
236 acc_queue.enqueueWriteBuffer(pixelClusterInputBuffer, CL_FALSE, 0,
sizeof(
uint64_t) * encodedPixelRDO.size(), encodedPixelRDO.data(), NULL, &cl_evt_write_pixel_input);
237 acc_queue.enqueueWriteBuffer(stripClusterInputBuffer, CL_FALSE, 0,
sizeof(
uint64_t) * encodedStripRDO.size(), encodedStripRDO.data(), NULL, &cl_evt_write_strip_input);
238 std::vector<cl::Event> cl_evt_vec_pixel_input{cl_evt_write_pixel_input};
239 std::vector<cl::Event> cl_evt_vec_strip_input{cl_evt_write_strip_input};
251 acc_queue.enqueueTask(pixelClusteringKernel, &cl_evt_vec_pixel_input, &cl_evt_pixel_clustering);
252 acc_queue.enqueueTask(stripClusteringKernel, &cl_evt_vec_strip_input, &cl_evt_strip_clustering);
254 std::vector<cl::Event> cl_evt_vec_pixel_clustering{cl_evt_pixel_clustering};
255 std::vector<cl::Event> cl_evt_vec_strip_clustering{cl_evt_strip_clustering};
256 acc_queue.enqueueTask(pixelL2GKernel, &cl_evt_vec_pixel_clustering, &cl_evt_pixel_l2g);
257 acc_queue.enqueueTask(stripL2GKernel, &cl_evt_vec_strip_clustering, &cl_evt_strip_l2g);
258 std::vector<cl::Event> cl_evt_vec_l2g{cl_evt_pixel_l2g, cl_evt_strip_l2g};
260 acc_queue.enqueueTask(edmPrepKernel, &cl_evt_vec_l2g, &cl_evt_edm_prep);
268 acc_queue.enqueueReadBuffer(edmPixelOutputBuffer, CL_FALSE, 0,
sizeof(
uint64_t) * pixelChainOutput.size(), pixelChainOutput.data(), NULL, &cl_evt_pixel_cluster_output);
269 acc_queue.enqueueReadBuffer(edmStripOutputBuffer, CL_FALSE, 0,
sizeof(
uint64_t) * stripChainOutput.size(), stripChainOutput.data(), NULL, &cl_evt_strip_cluster_output);
274 cl_ulong pixel_input_start = cl_evt_write_pixel_input.getProfilingInfo<CL_PROFILING_COMMAND_START>();
275 cl_ulong pixel_input_end = cl_evt_write_pixel_input.getProfilingInfo<CL_PROFILING_COMMAND_END>();
276 cl_ulong pixel_input_time = pixel_input_end - pixel_input_start;
278 ATH_MSG_DEBUG(
"Pixel input buffer write time: " << pixel_input_time / 1e6 <<
" ms");
281 cl_ulong strip_input_start = cl_evt_write_strip_input.getProfilingInfo<CL_PROFILING_COMMAND_START>();
282 cl_ulong strip_input_end = cl_evt_write_strip_input.getProfilingInfo<CL_PROFILING_COMMAND_END>();
283 cl_ulong strip_input_time = strip_input_end - strip_input_start;
285 ATH_MSG_DEBUG(
"Strip input buffer write time: " << strip_input_time / 1e6 <<
" ms");
288 cl_ulong pixel_clustering_start = cl_evt_pixel_clustering.getProfilingInfo<CL_PROFILING_COMMAND_START>();
289 cl_ulong pixel_clustering_end = cl_evt_pixel_clustering.getProfilingInfo<CL_PROFILING_COMMAND_END>();
290 cl_ulong pixel_clustering_time = pixel_clustering_end - pixel_clustering_start;
292 ATH_MSG_DEBUG(
"Pixel clustering time: " << pixel_clustering_time / 1e6 <<
" ms");
295 cl_ulong strip_clustering_start = cl_evt_strip_clustering.getProfilingInfo<CL_PROFILING_COMMAND_START>();
296 cl_ulong strip_clustering_end = cl_evt_strip_clustering.getProfilingInfo<CL_PROFILING_COMMAND_END>();
297 cl_ulong strip_clustering_time = strip_clustering_end - strip_clustering_start;
299 ATH_MSG_DEBUG(
"Strip clustering time: " << strip_clustering_time / 1e6 <<
" ms");
302 cl_ulong pixel_l2g_start = cl_evt_pixel_l2g.getProfilingInfo<CL_PROFILING_COMMAND_START>();
303 cl_ulong pixel_l2g_end = cl_evt_pixel_l2g.getProfilingInfo<CL_PROFILING_COMMAND_END>();
304 cl_ulong pixel_l2g_time = pixel_l2g_end - pixel_l2g_start;
306 ATH_MSG_DEBUG(
"Pixel L2G time: " << pixel_l2g_time / 1e6 <<
" ms");
309 cl_ulong strip_l2g_start = cl_evt_strip_l2g.getProfilingInfo<CL_PROFILING_COMMAND_START>();
310 cl_ulong strip_l2g_end = cl_evt_strip_l2g.getProfilingInfo<CL_PROFILING_COMMAND_END>();
311 cl_ulong strip_l2g_time = strip_l2g_end - strip_l2g_start;
313 ATH_MSG_DEBUG(
"Strip L2G time: " << strip_l2g_time / 1e6 <<
" ms");
316 cl_ulong edm_prep_start = cl_evt_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_START>();
317 cl_ulong edm_prep_end = cl_evt_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>();
318 cl_ulong edm_prep_time = edm_prep_end - edm_prep_start;
320 ATH_MSG_DEBUG(
"EDMPrep time: " << edm_prep_time / 1e6 <<
" ms");
323 cl_ulong kernel_start = cl_evt_pixel_clustering.getProfilingInfo<CL_PROFILING_COMMAND_QUEUED>();
324 cl_ulong kernel_end = cl_evt_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>();
325 cl_ulong kernel_time = kernel_end - kernel_start;
327 ATH_MSG_DEBUG(
"Kernel execution time: " << kernel_time / 1e6 <<
" ms");
330 cl_ulong pixel_output_start = cl_evt_pixel_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_START>();
331 cl_ulong pixel_output_end = cl_evt_pixel_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_END>();
332 cl_ulong pixel_output_time = pixel_output_end - pixel_output_start;
334 ATH_MSG_DEBUG(
"Pixel output buffer read time: " << pixel_output_time / 1e6 <<
" ms");
337 cl_ulong strip_output_start = cl_evt_strip_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_START>();
338 cl_ulong strip_output_end = cl_evt_strip_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_END>();
339 cl_ulong strip_output_time = strip_output_end - strip_output_start;
341 ATH_MSG_DEBUG(
"Strip output buffer read time: " << strip_output_time / 1e6 <<
" ms");
343 return StatusCode::SUCCESS;
364 return StatusCode::SUCCESS;