1414
1515#include " GPUChainITS.h"
1616#include " GPUConstantMem.h"
17+ #include " GPUDefParametersConstants.h"
1718#include " DataFormatsITS/TrackITS.h"
18- #include " ITStracking /ExternalAllocator.h"
19+ #include " ITSMFTTracking /ExternalAllocator.h"
1920#include " GPUReconstructionIncludesITS.h"
2021
2122using namespace o2 ::gpu;
2223
23- namespace o2 ::its
24+ namespace
2425{
25- class GPUFrameworkExternalAllocator final : public o2::its ::ExternalAllocator
26+ class GPUFrameworkExternalAllocator final : public o2::itsmft::tracking ::ExternalAllocator
2627{
2728 public:
28- void * allocate (size_t size) final
29+ explicit GPUFrameworkExternalAllocator (GPUReconstruction* fwr) : mFWReco(fwr) {}
30+ void * allocate (size_t size, Type type) final
2931 {
30- return mFWReco ->AllocateDirectMemory (size, mType );
32+ return mFWReco ->AllocateDirectMemory (size, type );
3133 }
32- void deallocate (char * ptr, size_t size) final {} // this is a simple no-op
33- void pushTagOnStack (uint64_t tag) final
34- {
35- mFWReco ->PushNonPersistentMemory (tag);
36- }
37- void popTagOffStack (uint64_t tag) final
38- {
39- mFWReco ->PopNonPersistentMemory (gpudatatypes::RecoStep::ITSTracking, tag);
40- }
41- void setReconstructionFramework (o2::gpu::GPUReconstruction* fwr) { mFWReco = fwr; }
34+ void deallocate (char *, size_t ) final {}
35+ void pushTagOnStack (uint64_t tag) final { mFWReco ->PushNonPersistentMemory (tag); }
36+ void popTagOffStack (uint64_t tag) final { mFWReco ->PopNonPersistentMemory (gpudatatypes::RecoStep::ITSTracking, tag); }
4237
4338 private:
44- o2::gpu:: GPUReconstruction* mFWReco ;
39+ GPUReconstruction* mFWReco ;
4540};
46- } // namespace o2::its
41+ } // namespace
4742
4843GPUChainITS::~GPUChainITS () = default ;
4944
5045GPUChainITS::GPUChainITS (GPUReconstruction* rec) : GPUChain(rec) {}
5146
5247int32_t GPUChainITS::Init () { return 0 ; }
5348
49+ void GPUChainITS::MemorySize (size_t & gpuMem, size_t & pageLockedHostMem)
50+ {
51+ gpuMem = constants::GPU_DEFAULT_MEMORY_SIZE ;
52+ pageLockedHostMem = constants::GPU_DEFAULT_HOST_MEMORY_SIZE ;
53+ }
54+
5455o2::its::TrackerTraits<7 >* GPUChainITS::GetITSTrackerTraits ()
5556{
5657 if (mITSTrackerTraits == nullptr ) {
@@ -74,14 +75,20 @@ o2::its::TimeFrame<7>* GPUChainITS::GetITSTimeframe()
7475 }
7576#if !defined(GPUCA_STANDALONE)
7677 if (mITSTimeFrame ->isGPU ()) {
77- mFrameworkAllocator .reset (new o2::its::GPUFrameworkExternalAllocator ());
78- mFrameworkAllocator ->setReconstructionFramework (rec ());
79- mITSTimeFrame ->setFrameworkAllocator (mFrameworkAllocator .get ());
78+ mITSTimeFrame ->setFrameworkAllocator (GetITSMFTFrameworkAllocator ());
8079 }
8180#endif
8281 return mITSTimeFrame .get ();
8382}
8483
84+ o2::itsmft::tracking::ExternalAllocator* GPUChainITS::GetITSMFTFrameworkAllocator ()
85+ {
86+ if (mFrameworkAllocator == nullptr && mRec ->IsGPU ()) {
87+ mFrameworkAllocator = std::make_unique<GPUFrameworkExternalAllocator>(rec ());
88+ }
89+ return mFrameworkAllocator .get ();
90+ }
91+
8592int32_t GPUChainITS::PrepareEvent () { return 0 ; }
8693
8794int32_t GPUChainITS::Finalize () { return 0 ; }
0 commit comments