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::WriteHandleKey<std::vector<uint64_t>> m_FPGAPixelOutput{this, "FPGAOutputPixelKey", "FPGAPixelOutput", "Pixel output from FPGA format"};
58  SG::WriteHandleKey<std::vector<uint64_t>> m_FPGAStripOutput{this, "FPGAOutputStripKey", "FPGAStripOutput", "Strip output from FPGA format"};
59 
60  Gaudi::Property<int> m_FPGAThreads{this, "FPGAThreads", 1, "number of FPGA threads to initialize"};
61 
62  Gaudi::Property<std::string> m_xclbin{
63  this, "xclbin", "", "xclbin path and name"};
64 
65  Gaudi::Property<bool> m_doF110{
66  this, "doF110", false, "Run F110 instead of F100"};
67 
68  Gaudi::Property<std::string> m_pixelEdmKernelName{
69  this, "PixelEDMPrepKernelName", "", "Name of the Pixel EDM kernel"};
70 
71  Gaudi::Property<std::string> m_stripEdmKernelName{
72  this, "StripEDMPrepKernelName", "", "Name of the Strip EDM kernel"};
73 
74  Gaudi::Property<std::string> m_pixelClusterKernelName{
75  this, "PixelClusterKernelName", "", "Name of the pixel clustering kernel"};
76 
77  Gaudi::Property<std::string> m_stripClusterKernelName{
78  this, "StripClusterKernelName", "", "Name of the strip clustering kernel"};
79 
80  Gaudi::Property<std::string> m_pixelL2GKernelName{
81  this, "PixelL2GKernelName", "", "Name of the pixel L2G kernel"};
82 
83  Gaudi::Property<std::string> m_stripL2GKernelName{
84  this, "StripL2GKernelName", "", "Name of the strip L2G kernel"};
85 
86  // Counters / timing (nanoseconds)
87  mutable std::atomic<uint64_t> m_numEvents{0};
88  mutable std::atomic<uint64_t> m_pixelInputTime{0};
89  mutable std::atomic<uint64_t> m_stripInputTime{0};
90  mutable std::atomic<uint64_t> m_pixelClusteringTime{0};
91  mutable std::atomic<uint64_t> m_stripClusteringTime{0};
92  mutable std::atomic<uint64_t> m_pixelL2GTime{0};
93  mutable std::atomic<uint64_t> m_stripL2GTime{0};
94  mutable std::atomic<uint64_t> m_edmPrepTime{0};
95  mutable std::atomic<uint64_t> m_pixelEdmPrepTime{0};
96  mutable std::atomic<uint64_t> m_stripEdmPrepTime{0};
97  mutable std::atomic<uint64_t> m_pixelOutputTime{0};
98  mutable std::atomic<uint64_t> m_stripOutputTime{0};
99  mutable std::atomic<uint64_t> m_kernelTime{0};
100 
101  // XRT device / xclbin
102  xrt::device m_xrtDevice;
103  xrt::uuid m_xrtUuid;
104 
105  // Kernels (XRT)
106  // Clustering
107  mutable std::vector<xrt::kernel> m_pixelClusteringKernels ATLAS_THREAD_SAFE;
108  mutable std::vector<xrt::kernel> m_stripClusteringKernels ATLAS_THREAD_SAFE;
109 
110  // L2G
111  mutable std::vector<xrt::kernel> m_pixelL2GKernels ATLAS_THREAD_SAFE; // F100
112  mutable std::vector<xrt::kernel> m_stripL2GKernels ATLAS_THREAD_SAFE;
113 
114  // EDM prep
115  mutable std::vector<xrt::kernel> m_pixelEdmPrepKernels ATLAS_THREAD_SAFE;
116  mutable std::vector<xrt::kernel> m_stripEdmPrepKernels ATLAS_THREAD_SAFE;
117 
118  // Buffers (XRT BOs) — must be mutable for execute() const
119  mutable std::vector<xrt::bo> m_pixelClusterInputBOList ATLAS_THREAD_SAFE;
120  mutable std::vector<xrt::bo> m_stripClusterInputBOList ATLAS_THREAD_SAFE;
121 
122  mutable std::vector<xrt::bo> m_pixelClusterOutputBOList ATLAS_THREAD_SAFE; // (F100 only)
123  mutable std::vector<xrt::bo> m_stripClusterOutputBOList ATLAS_THREAD_SAFE;
124  mutable std::vector<xrt::bo> m_pixelClusterEDMOutputBOList ATLAS_THREAD_SAFE;
125  mutable std::vector<xrt::bo> m_stripClusterEDMOutputBOList ATLAS_THREAD_SAFE;
126 
127  mutable std::vector<xrt::bo> m_pixelL2GOutputBOList ATLAS_THREAD_SAFE; // (F100 only)
128  mutable std::vector<xrt::bo> m_stripL2GOutputBOList ATLAS_THREAD_SAFE;
129  mutable std::vector<xrt::bo> m_pixelL2GEDMOutputBOList ATLAS_THREAD_SAFE; // (F100 only)
130  mutable std::vector<xrt::bo> m_stripL2GEDMOutputBOList ATLAS_THREAD_SAFE;
131 
132  mutable std::vector<xrt::bo> m_edmPixelOutputBOList ATLAS_THREAD_SAFE;
133  mutable std::vector<xrt::bo> m_edmStripOutputBOList ATLAS_THREAD_SAFE;
134 
135  void getListofCUs(std::vector<std::string>& cuNames);
136  };
137 }
138 
139 #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:65
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:90
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripL2GTime
std::atomic< uint64_t > m_stripL2GTime
Time for strip L2G.
Definition: F1X0XRTIntegrationAlg.h:93
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelOutputTime
std::atomic< uint64_t > m_pixelOutputTime
Time for pixel output buffer read.
Definition: F1X0XRTIntegrationAlg.h:97
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:60
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripClusterKernelName
Gaudi::Property< std::string > m_stripClusterKernelName
Definition: F1X0XRTIntegrationAlg.h:77
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_xrtUuid
xrt::uuid m_xrtUuid
Definition: F1X0XRTIntegrationAlg.h:103
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_kernelTime
std::atomic< uint64_t > m_kernelTime
Time window covering kernel execution.
Definition: F1X0XRTIntegrationAlg.h:99
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_xrtDevice
xrt::device m_xrtDevice
Definition: F1X0XRTIntegrationAlg.h:102
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripInputTime
std::atomic< uint64_t > m_stripInputTime
Time for strip input buffer write.
Definition: F1X0XRTIntegrationAlg.h:89
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelL2GTime
std::atomic< uint64_t > m_pixelL2GTime
Time for pixel L2G (F100)
Definition: F1X0XRTIntegrationAlg.h:92
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripClusterInputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:120
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelInputTime
std::atomic< uint64_t > m_pixelInputTime
Time for pixel input buffer write.
Definition: F1X0XRTIntegrationAlg.h:88
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelEdmKernelName
Gaudi::Property< std::string > m_pixelEdmKernelName
Definition: F1X0XRTIntegrationAlg.h:68
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::getListofCUs
void getListofCUs(std::vector< std::string > &cuNames)
Definition: F1X0XRTIntegrationAlg.cxx:371
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_edmStripOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:133
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_pixelL2GEDMOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:129
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:140
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:74
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:108
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_numEvents
std::atomic< uint64_t > m_numEvents
Number of events processed.
Definition: F1X0XRTIntegrationAlg.h:87
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:96
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::finalize
virtual StatusCode finalize() override final
Definition: F1X0XRTIntegrationAlg.cxx:347
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:80
EFTrackingFPGAIntegration
The class for enconding RDO to FPGA format.
Definition: BenchmarkAlg.h:28
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_stripEdmPrepKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:116
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_xclbin
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
Definition: F1X0XRTIntegrationAlg.h:62
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_pixelL2GOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:127
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripOutputTime
std::atomic< uint64_t > m_stripOutputTime
Time for strip output buffer read.
Definition: F1X0XRTIntegrationAlg.h:98
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_pixelClusteringKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:107
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_pixelClusterEDMOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:124
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:119
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:132
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_FPGAPixelOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAPixelOutput
Definition: F1X0XRTIntegrationAlg.h:57
xAODClusterMaker.h
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_edmPrepTime
std::atomic< uint64_t > m_edmPrepTime
Time for EDM preparation (F100)
Definition: F1X0XRTIntegrationAlg.h:94
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_pixelEdmPrepKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:115
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripClusterOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:123
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripEdmKernelName
Gaudi::Property< std::string > m_stripEdmKernelName
Definition: F1X0XRTIntegrationAlg.h:71
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripL2GKernelName
Gaudi::Property< std::string > m_stripL2GKernelName
Definition: F1X0XRTIntegrationAlg.h:83
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_pixelClusterOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:122
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripClusterEDMOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:125
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_pixelL2GKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:111
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripL2GEDMOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:130
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_pixelEdmPrepTime
std::atomic< uint64_t > m_pixelEdmPrepTime
Time for pixel EDM preparation (F110)
Definition: F1X0XRTIntegrationAlg.h:95
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::bo > m_stripL2GOutputBOList ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:128
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg
Benchmark algorithm for FPGA integration and output conversion.
Definition: F1X0XRTIntegrationAlg.h:44
TrigRoiDescriptorCollection.h
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_FPGAStripOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAStripOutput
Definition: F1X0XRTIntegrationAlg.h:58
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::ATLAS_THREAD_SAFE
std::vector< xrt::kernel > m_stripL2GKernels ATLAS_THREAD_SAFE
Definition: F1X0XRTIntegrationAlg.h:112
ServiceHandle< IChronoSvc >
EFTrackingFPGAIntegration::F1X0XRTIntegrationAlg::m_stripClusteringTime
std::atomic< uint64_t > m_stripClusteringTime
Time for strip clustering.
Definition: F1X0XRTIntegrationAlg.h:91