ATLAS Offline Software
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 
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:
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
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_doF110
Gaudi::Property< bool > m_doF110
Boolean to run F110 instead of F100.
Definition: F1X0XRTIntegrationAlg.h:68
IRegSelTool.h
IntegrationBase
The base class for the EFTracking FPGA integration development.
Definition: IntegrationBase.h:38
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_chronoSvc
ServiceHandle< IChronoSvc > m_chronoSvc
Service for timing the algorithm.
Definition: F1X0XRTIntegrationAlg.h:52
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelClusteringTime
std::atomic< uint64_t > m_pixelClusteringTime
Time for pixel clustering.
Definition: F1X0XRTIntegrationAlg.h:93
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripL2GTime
std::atomic< uint64_t > m_stripL2GTime
Time for strip L2G.
Definition: F1X0XRTIntegrationAlg.h:96
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelOutputTime
std::atomic< uint64_t > m_pixelOutputTime
Time for pixel output buffer read.
Definition: F1X0XRTIntegrationAlg.h:100
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_FPGAPixelRDOSize
SG::ReadHandleKey< int > m_FPGAPixelRDOSize
Definition: F1X0XRTIntegrationAlg.h:57
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_FPGAPixelRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAPixelRDO
Definition: F1X0XRTIntegrationAlg.h:54
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_FPGAThreads
Gaudi::Property< int > m_FPGAThreads
Definition: F1X0XRTIntegrationAlg.h:63
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripClusterKernelName
Gaudi::Property< std::string > m_stripClusterKernelName
Definition: F1X0XRTIntegrationAlg.h:80
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_xrtUuid
xrt::uuid m_xrtUuid
Definition: F1X0XRTIntegrationAlg.h:106
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_kernelTime
std::atomic< uint64_t > m_kernelTime
Time window covering kernel execution.
Definition: F1X0XRTIntegrationAlg.h:102
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_xrtDevice
xrt::device m_xrtDevice
Definition: F1X0XRTIntegrationAlg.h:105
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripInputTime
std::atomic< uint64_t > m_stripInputTime
Time for strip input buffer write.
Definition: F1X0XRTIntegrationAlg.h:92
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelL2GTime
std::atomic< uint64_t > m_pixelL2GTime
Time for pixel L2G (F100)
Definition: F1X0XRTIntegrationAlg.h:95
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripClusterInputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:123
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelInputTime
std::atomic< uint64_t > m_pixelInputTime
Time for pixel input buffer write.
Definition: F1X0XRTIntegrationAlg.h:91
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelEdmKernelName
Gaudi::Property< std::string > m_pixelEdmKernelName
Definition: F1X0XRTIntegrationAlg.h:71
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::getListofCUs
void getListofCUs(std::vector< std::string > &cuNames)
Definition: F1X0XRTIntegrationAlg.cxx:377
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_edmStripOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:136
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_pixelL2GEDMOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:132
IntegrationBase.h
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Should be overriden by derived classes to perform meaningful work.
Definition: F1X0XRTIntegrationAlg.cxx:142
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelClusterKernelName
Gaudi::Property< std::string > m_pixelClusterKernelName
Definition: F1X0XRTIntegrationAlg.h:77
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_FPGAStripRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAStripRDO
Definition: F1X0XRTIntegrationAlg.h:55
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_stripClusteringKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:111
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_numEvents
std::atomic< uint64_t > m_numEvents
Number of events processed.
Definition: F1X0XRTIntegrationAlg.h:90
SCT_RDO_Container.h
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripEdmPrepTime
std::atomic< uint64_t > m_stripEdmPrepTime
Time for strip EDM preparation (F110)
Definition: F1X0XRTIntegrationAlg.h:99
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::finalize
virtual StatusCode finalize() override final
Definition: F1X0XRTIntegrationAlg.cxx:353
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_FPGAStripRDOSize
SG::ReadHandleKey< int > m_FPGAStripRDOSize
Definition: F1X0XRTIntegrationAlg.h:58
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelL2GKernelName
Gaudi::Property< std::string > m_pixelL2GKernelName
Definition: F1X0XRTIntegrationAlg.h:83
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_FPGAStripOutput
SG::WriteHandleKey< std::vector< uint32_t > > m_FPGAStripOutput
Definition: F1X0XRTIntegrationAlg.h:61
EFTrackingFPGAIntegration
The class for enconding RDO to FPGA format.
Definition: F100DataEncodingAlg.h:27
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_stripEdmPrepKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:119
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_xclbin
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
Definition: F1X0XRTIntegrationAlg.h:65
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_pixelL2GOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:130
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripOutputTime
std::atomic< uint64_t > m_stripOutputTime
Time for strip output buffer read.
Definition: F1X0XRTIntegrationAlg.h:101
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_pixelClusteringKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:110
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_pixelClusterEDMOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:127
EFTrackingTransient.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_pixelClusterInputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:122
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::initialize
virtual StatusCode initialize() override final
Detect the OpenCL devices and prepare OpenCL context.
Definition: F1X0XRTIntegrationAlg.cxx:28
PixelRDO_Container.h
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_edmPixelOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:135
xAODClusterMaker.h
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_edmPrepTime
std::atomic< uint64_t > m_edmPrepTime
Time for EDM preparation (F100)
Definition: F1X0XRTIntegrationAlg.h:97
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_pixelEdmPrepKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:118
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripClusterOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:126
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripEdmKernelName
Gaudi::Property< std::string > m_stripEdmKernelName
Definition: F1X0XRTIntegrationAlg.h:74
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_FPGAPixelOutput
SG::WriteHandleKey< std::vector< uint32_t > > m_FPGAPixelOutput
Definition: F1X0XRTIntegrationAlg.h:60
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripL2GKernelName
Gaudi::Property< std::string > m_stripL2GKernelName
Definition: F1X0XRTIntegrationAlg.h:86
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_pixelClusterOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:125
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripClusterEDMOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:128
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_pixelL2GKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:114
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripL2GEDMOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:133
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelEdmPrepTime
std::atomic< uint64_t > m_pixelEdmPrepTime
Time for pixel EDM preparation (F110)
Definition: F1X0XRTIntegrationAlg.h:98
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripL2GOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:131
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg
Benchmark algorithm for FPGA integration and output conversion.
Definition: F1X0XRTIntegrationAlg.h:44
TrigRoiDescriptorCollection.h
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_stripL2GKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:115
ServiceHandle< IChronoSvc >
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripClusteringTime
std::atomic< uint64_t > m_stripClusteringTime
Time for strip clustering.
Definition: F1X0XRTIntegrationAlg.h:94