|
15 | 15 | #include "GPUTRDTrackerKernels.h" |
16 | 16 | #include "GPUTRDGeometry.h" |
17 | 17 | #include "GPUConstantMem.h" |
| 18 | +#include "GPUCommonTypeTraits.h" |
18 | 19 | #if defined(WITH_OPENMP) && !defined(GPUCA_GPUCODE) |
19 | 20 | #include "GPUReconstruction.h" |
20 | 21 | #endif |
21 | 22 |
|
22 | 23 | using namespace GPUCA_NAMESPACE::gpu; |
23 | 24 |
|
24 | 25 | template <int I> |
25 | | -GPUdii() void GPUTRDTrackerKernels::Thread(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors) |
| 26 | +GPUdii() void GPUTRDTrackerKernels::Thread(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors, GPUTRDTracker* externalInstance) |
26 | 27 | { |
27 | | - auto& trdTracker = processors.getTRDTracker<I>(); |
28 | | - GPUCA_OPENMP(parallel for if(!trdTracker.GetRec().GetProcessingSettings().ompKernels) num_threads(trdTracker.GetRec().GetProcessingSettings().ompThreads)) |
29 | | - for (int i = get_global_id(0); i < trdTracker.NTracks(); i += get_global_size(0)) { |
30 | | - trdTracker.DoTrackingThread(i, get_global_id(0)); |
| 28 | + auto* trdTracker = &processors.getTRDTracker<I>(); |
| 29 | +#ifndef GPUCA_GPUCODE_DEVICE |
| 30 | + if constexpr (std::is_same_v<decltype(trdTracker), decltype(externalInstance)>) { |
| 31 | + if (externalInstance) { |
| 32 | + trdTracker = externalInstance; |
| 33 | + } |
| 34 | + } |
| 35 | +#endif |
| 36 | + GPUCA_OPENMP(parallel for if(!trdTracker->GetRec().GetProcessingSettings().ompKernels) num_threads(trdTracker->GetRec().GetProcessingSettings().ompThreads)) |
| 37 | + for (int i = get_global_id(0); i < trdTracker->NTracks(); i += get_global_size(0)) { |
| 38 | + trdTracker->DoTrackingThread(i, get_global_id(0)); |
31 | 39 | } |
32 | 40 | } |
33 | 41 |
|
34 | | -template GPUd() void GPUTRDTrackerKernels::Thread<0>(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors); |
| 42 | +template GPUd() void GPUTRDTrackerKernels::Thread<0>(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors, GPUTRDTracker* externalInstance); |
35 | 43 | #ifdef GPUCA_HAVE_O2HEADERS |
36 | | -template GPUd() void GPUTRDTrackerKernels::Thread<1>(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors); |
37 | | -#endif |
| 44 | +template GPUd() void GPUTRDTrackerKernels::Thread<1>(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors, GPUTRDTracker* externalInstance); |
| 45 | +#endif // GPUCA_HAVE_O2HEADERS |
0 commit comments