ATLAS Offline Software
Loading...
Searching...
No Matches
F1X0XRTIntegrationAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9#ifndef EFTRACKING_FPGA_INTEGRATION_F1X0XRTIntegrationAlg_H
10#define EFTRACKING_FPGA_INTEGRATION_F1X0XRTIntegrationAlg_H
11
12// EFTracking include
16
17// Athena include
20#include "GaudiKernel/ServiceHandle.h"
21#include "GaudiKernel/IChronoSvc.h"
24
25// XRT native C++ API
26#include <xrt/xrt_device.h>
27#include <xrt/xrt_kernel.h>
28#include <xrt/xrt_bo.h>
29#include <xrt/xrt_uuid.h>
30
31#include <atomic>
32#include <cstdint>
33#include <string>
34#include <vector>
35
37{
44 {
45 public:
46 using IntegrationBase::IntegrationBase;
47 virtual StatusCode initialize() override final;
48 virtual StatusCode execute(const EventContext &ctx) const override final;
49 virtual StatusCode finalize() override final;
50
51 private:
52 ServiceHandle<IChronoSvc> m_chronoSvc{"ChronoStatSvc", name()};
53
54 SG::ReadHandleKey<std::vector<uint64_t>> m_FPGAPixelRDO{this, "FPGAEncodedPixelKey", "FPGAEncodedPixelRDOs", "Pixel RDO converted to FPGA format"};
55 SG::ReadHandleKey<std::vector<uint64_t>> m_FPGAStripRDO{this, "FPGAEncodedStripKey", "FPGAEncodedStripRDOs", "Strip RDO converted to FPGA format"};
56
57 SG::ReadHandleKey<int> m_FPGAPixelRDOSize{this, "FPGAEncodedPixelSizeKey", "FPGAEncodedPixelSizeRDOs", "Pixel RDO converted to FPGA format"};
58 SG::ReadHandleKey<int> m_FPGAStripRDOSize{this, "FPGAEncodedStripSizeKey", "FPGAEncodedStripSizeRDOs", "Strip RDO converted to FPGA format"};
59
60 SG::WriteHandleKey<std::vector<uint32_t>> m_FPGAPixelOutput{this, "FPGAOutputPixelKey", "FPGAPixelOutput", "Pixel output from FPGA format"};
61 SG::WriteHandleKey<std::vector<uint32_t>> m_FPGAStripOutput{this, "FPGAOutputStripKey", "FPGAStripOutput", "Strip output from FPGA format"};
62
63 Gaudi::Property<int> m_FPGAThreads{this, "FPGAThreads", 1, "number of FPGA threads to initialize"};
64
65 Gaudi::Property<std::string> m_xclbin{
66 this, "xclbin", "", "xclbin path and name"};
67
68 Gaudi::Property<bool> m_doF110{
69 this, "doF110", false, "Run F110 instead of F100"};
70
71 Gaudi::Property<std::string> m_pixelEdmKernelName{
72 this, "PixelEDMPrepKernelName", "", "Name of the Pixel EDM kernel"};
73
74 Gaudi::Property<std::string> m_stripEdmKernelName{
75 this, "StripEDMPrepKernelName", "", "Name of the Strip EDM kernel"};
76
77 Gaudi::Property<std::string> m_pixelClusterKernelName{
78 this, "PixelClusterKernelName", "", "Name of the pixel clustering kernel"};
79
80 Gaudi::Property<std::string> m_stripClusterKernelName{
81 this, "StripClusterKernelName", "", "Name of the strip clustering kernel"};
82
83 Gaudi::Property<std::string> m_pixelL2GKernelName{
84 this, "PixelL2GKernelName", "", "Name of the pixel L2G kernel"};
85
86 Gaudi::Property<std::string> m_stripL2GKernelName{
87 this, "StripL2GKernelName", "", "Name of the strip L2G kernel"};
88
89 // Counters / timing (nanoseconds)
90 mutable std::atomic<uint64_t> m_numEvents{0};
91 mutable std::atomic<uint64_t> m_pixelInputTime{0};
92 mutable std::atomic<uint64_t> m_stripInputTime{0};
93 mutable std::atomic<uint64_t> m_pixelClusteringTime{0};
94 mutable std::atomic<uint64_t> m_stripClusteringTime{0};
95 mutable std::atomic<uint64_t> m_pixelL2GTime{0};
96 mutable std::atomic<uint64_t> m_stripL2GTime{0};
97 mutable std::atomic<uint64_t> m_edmPrepTime{0};
98 mutable std::atomic<uint64_t> m_pixelEdmPrepTime{0};
99 mutable std::atomic<uint64_t> m_stripEdmPrepTime{0};
100 mutable std::atomic<uint64_t> m_pixelOutputTime{0};
101 mutable std::atomic<uint64_t> m_stripOutputTime{0};
102 mutable std::atomic<uint64_t> m_kernelTime{0};
103
104 // XRT device / xclbin
105 xrt::device m_xrtDevice;
106 xrt::uuid m_xrtUuid;
107
108 // Kernels (XRT)
109 // Clustering
110 mutable std::vector<xrt::kernel> m_pixelClusteringKernels ATLAS_THREAD_SAFE;
111 mutable std::vector<xrt::kernel> m_stripClusteringKernels ATLAS_THREAD_SAFE;
112
113 // L2G
114 mutable std::vector<xrt::kernel> m_pixelL2GKernels ATLAS_THREAD_SAFE; // F100
115 mutable std::vector<xrt::kernel> m_stripL2GKernels ATLAS_THREAD_SAFE;
116
117 // EDM prep
118 mutable std::vector<xrt::kernel> m_pixelEdmPrepKernels ATLAS_THREAD_SAFE;
119 mutable std::vector<xrt::kernel> m_stripEdmPrepKernels ATLAS_THREAD_SAFE;
120
121 // Buffers (XRT BOs) — must be mutable for execute() const
122 mutable std::vector<xrt::bo> m_pixelClusterInputBOList ATLAS_THREAD_SAFE;
123 mutable std::vector<xrt::bo> m_stripClusterInputBOList ATLAS_THREAD_SAFE;
124
125 mutable std::vector<xrt::bo> m_pixelClusterOutputBOList ATLAS_THREAD_SAFE; // (F100 only)
126 mutable std::vector<xrt::bo> m_stripClusterOutputBOList ATLAS_THREAD_SAFE;
127 mutable std::vector<xrt::bo> m_pixelClusterEDMOutputBOList ATLAS_THREAD_SAFE;
128 mutable std::vector<xrt::bo> m_stripClusterEDMOutputBOList ATLAS_THREAD_SAFE;
129
130 mutable std::vector<xrt::bo> m_pixelL2GOutputBOList ATLAS_THREAD_SAFE; // (F100 only)
131 mutable std::vector<xrt::bo> m_stripL2GOutputBOList ATLAS_THREAD_SAFE;
132 mutable std::vector<xrt::bo> m_pixelL2GEDMOutputBOList ATLAS_THREAD_SAFE; // (F100 only)
133 mutable std::vector<xrt::bo> m_stripL2GEDMOutputBOList ATLAS_THREAD_SAFE;
134
135 mutable std::vector<xrt::bo> m_edmPixelOutputBOList ATLAS_THREAD_SAFE;
136 mutable std::vector<xrt::bo> m_edmStripOutputBOList ATLAS_THREAD_SAFE;
137
138 void getListofCUs(std::vector<std::string>& cuNames);
139 };
140}
141
142#endif // EFTRACKING_FPGA_INTEGRATION_F1X0XRTIntegrationAlg_H
Benchmark algorithm for FPGA integration and output conversion.
std::atomic< uint64_t > m_pixelEdmPrepTime
Time for pixel EDM preparation (F110)
std::atomic< uint64_t > m_stripClusteringTime
Time for strip clustering.
ServiceHandle< IChronoSvc > m_chronoSvc
Service for timing the algorithm.
std::atomic< uint64_t > m_pixelOutputTime
Time for pixel output buffer read.
virtual StatusCode execute(const EventContext &ctx) const override final
Should be overriden by derived classes to perform meaningful work.
std::vector< xrt::kernel > m_pixelClusteringKernels ATLAS_THREAD_SAFE
SG::WriteHandleKey< std::vector< uint32_t > > m_FPGAStripOutput
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAPixelRDO
std::atomic< uint64_t > m_numEvents
Number of events processed.
std::atomic< uint64_t > m_pixelInputTime
Time for pixel input buffer write.
Gaudi::Property< bool > m_doF110
Boolean to run F110 instead of F100.
std::atomic< uint64_t > m_stripEdmPrepTime
Time for strip EDM preparation (F110)
SG::WriteHandleKey< std::vector< uint32_t > > m_FPGAPixelOutput
std::atomic< uint64_t > m_edmPrepTime
Time for EDM preparation (F100)
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAStripRDO
std::atomic< uint64_t > m_stripOutputTime
Time for strip output buffer read.
void getListofCUs(std::vector< std::string > &cuNames)
std::atomic< uint64_t > m_stripL2GTime
Time for strip L2G.
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
std::atomic< uint64_t > m_stripInputTime
Time for strip input buffer write.
std::atomic< uint64_t > m_pixelClusteringTime
Time for pixel clustering.
std::atomic< uint64_t > m_pixelL2GTime
Time for pixel L2G (F100)
virtual StatusCode initialize() override final
Detect the OpenCL devices and prepare OpenCL context.
std::atomic< uint64_t > m_kernelTime
Time window covering kernel execution.
The base class for the EFTracking FPGA integration development.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
The class for enconding RDO to FPGA format.