//-*- Mode: C++ -*-
// ************************************************************************
-// This file is property of and copyright by the ALICE HLT Project *
+// This file is property of and copyright by the ALICE HLT Project *
// ALICE Experiment at CERN, All rights reserved. *
// See cxx source for full Copyright notice *
// *
#ifndef ALIHLTTPCCATRACKLETCONSTRUCTOR_H
#define ALIHLTTPCCATRACKLETCONSTRUCTOR_H
+#ifdef HLTCA_GPUCODE
+#define HLTCA_GPU_USE_INT short
+#else
+#define HLTCA_GPU_USE_INT int
+#endif
#include "AliHLTTPCCADef.h"
+#include "AliHLTTPCCAGPUConfig.h"
+#include "AliHLTTPCCATrackParam.h"
/**
* @class AliHLTTPCCATrackletConstructor
- *
+ *
*/
+class AliHLTTPCCATracker;
+
class AliHLTTPCCATrackletConstructor
{
- public:
+ public:
- class AliHLTTPCCASharedMemory
+ class AliHLTTPCCASharedMemory
{
- friend class AliHLTTPCCATrackletConstructor;
- public:
+ friend class AliHLTTPCCATrackletConstructor;
+ public:
#if !defined(HLTCA_GPUCODE)
- AliHLTTPCCASharedMemory()
- : fItr0(0), fItr1(0), fNRows(0), fUsedHits(0), fMinStartRow(0), fMaxStartRow(0)
- {}
-
- AliHLTTPCCASharedMemory( const AliHLTTPCCASharedMemory& /*dummy*/)
- : fItr0(0), fItr1(0), fNRows(0), fUsedHits(0), fMinStartRow(0), fMaxStartRow(0)
- {}
- AliHLTTPCCASharedMemory& operator=(const AliHLTTPCCASharedMemory& /*dummy*/){ return *this; }
+ AliHLTTPCCASharedMemory()
+ : fNextTrackletFirst(0), fNextTrackletCount(0), fNextTrackletNoDummy(0), fNextTrackletStupidDummy(0), fNextTrackletFirstRun(0), fNTracklets(0), fSliceDone(0) {}
+
+ AliHLTTPCCASharedMemory( const AliHLTTPCCASharedMemory& /*dummy*/ )
+ : fNextTrackletFirst(0), fNextTrackletCount(0), fNextTrackletNoDummy(0), fNextTrackletStupidDummy(0), fNextTrackletFirstRun(0), fNTracklets(0), fSliceDone(0) {}
+ AliHLTTPCCASharedMemory& operator=( const AliHLTTPCCASharedMemory& /*dummy*/ ) { return *this; }
+#endif
+
+ protected:
+#ifdef HLTCA_GPU_PREFETCHDATA
+ uint4 fData[2][ALIHLTTPCCATRACKLET_CONSTRUCTOR_TEMP_MEM / 4]; // temp memory
+ AliHLTTPCCARow fRow[2]; // row
+#else
+ AliHLTTPCCARow fRows[HLTCA_ROW_COUNT];
+#endif
+ int fNextTrackletFirst;
+ int fNextTrackletCount;
+ int fNextTrackletNoDummy;
+ int fNextTrackletStupidDummy;
+ int fNextTrackletFirstRun;
+ int fNTracklets;
+ int fSliceDone;
+
+#ifdef HLTCA_GPU_TRACKLET_CONSTRUCTOR_DO_PROFILE
+ int fMaxSync;
#endif
- protected:
- uint4 fData[2][(5000+5000+5000)/4]; // temp memory
- Int_t fItr0; // start track index
- Int_t fItr1; // end track index
- Int_t fNRows; // n rows
- Int_t *fUsedHits; // array of used hits
- Int_t fMinStartRow; // min start row
- Int_t fMinStartRow32[32]; // min start row for each thread in warp
- Int_t fMaxStartRow; // max start row
- Int_t fMaxStartRow32[32];// max start row for each thread in warp
+
+ int fTrackletStoreCount[2][HLTCA_ROW_COUNT / HLTCA_GPU_SCHED_ROW_STEP + 1];
};
- class AliHLTTPCCAThreadMemory
+ class AliHLTTPCCAThreadMemory
{
- friend class AliHLTTPCCATrackletConstructor;
- public:
+ friend class AliHLTTPCCATrackletConstructor;
+ public:
#if !defined(HLTCA_GPUCODE)
- AliHLTTPCCAThreadMemory()
- : fItr(0), fFirstRow(0), fLastRow(0), fStartRow(0), fEndRow(0), fCurrIH(0), fIsMemThread(0), fGo(0), fSave(0), fCurrentData(0), fStage(0), fNHits(0), fNMissed(0), fLastY(0), fLastZ(0)
- {}
-
- AliHLTTPCCAThreadMemory( const AliHLTTPCCAThreadMemory& /*dummy*/)
- : fItr(0), fFirstRow(0), fLastRow(0), fStartRow(0), fEndRow(0), fCurrIH(0), fIsMemThread(0), fGo(0), fSave(0), fCurrentData(0), fStage(0), fNHits(0), fNMissed(0), fLastY(0), fLastZ(0)
- {}
- AliHLTTPCCAThreadMemory& operator=(const AliHLTTPCCAThreadMemory& /*dummy*/){ return *this; }
+ AliHLTTPCCAThreadMemory()
+ : fItr( 0 ), fFirstRow( 0 ), fLastRow( 0 ), fStartRow( 0 ), fEndRow( 0 ), fCurrIH( 0 ), fGo( 0 ), fCurrentData( 0 ), fStage( 0 ), fNHits( 0 ), fNMissed( 0 ), fLastY( 0 ), fLastZ( 0 ) {}
+
+ AliHLTTPCCAThreadMemory( const AliHLTTPCCAThreadMemory& /*dummy*/ )
+ : fItr( 0 ), fFirstRow( 0 ), fLastRow( 0 ), fStartRow( 0 ), fEndRow( 0 ), fCurrIH( 0 ), fGo( 0 ), fCurrentData( 0 ), fStage( 0 ), fNHits( 0 ), fNMissed( 0 ), fLastY( 0 ), fLastZ( 0 ) {}
+ AliHLTTPCCAThreadMemory& operator=( const AliHLTTPCCAThreadMemory& /*dummy*/ ) { return *this; }
#endif
- protected:
- Int_t fItr; // track index
- Int_t fFirstRow; // first row index
- Int_t fLastRow; // last row index
- Int_t fStartRow; // first row index
- Int_t fEndRow; // first row index
- Int_t fCurrIH; // indef of the current hit
- Bool_t fIsMemThread; // is the thread used for memory taken
- Bool_t fGo; // do fit/searching flag
- Bool_t fSave; // save flag
- Bool_t fCurrentData; // index of the current memory array
- Int_t fStage; // reco stage
- Int_t fNHits; // n track hits
- Int_t fNMissed; // n missed hits during search
- Float_t fLastY; // Y of the last fitted cluster
- Float_t fLastZ; // Z of the last fitted cluster
+
+ protected:
+ int fItr; // track index
+ int fFirstRow; // first row index
+ int fLastRow; // last row index
+ int fStartRow; // first row index
+ int fEndRow; // first row index
+ int fCurrIH; // indef of the current hit
+ bool fGo; // do fit/searching flag
+ bool fCurrentData; // index of the current memory array
+ int fStage; // reco stage
+ int fNHits; // n track hits
+ int fNMissed; // n missed hits during search
+ float fLastY; // Y of the last fitted cluster
+ float fLastZ; // Z of the last fitted cluster
};
- GPUd() static Int_t NThreadSyncPoints(){ return 4+159*2 +1+1; }
+ struct AliHLTTPCCAGPUTempMemory
+ {
+ AliHLTTPCCAThreadMemory fThreadMem;
+ AliHLTTPCCATrackParam fParam;
+ };
- GPUd() static void Thread( Int_t nBlocks, Int_t nThreads, Int_t iBlock, Int_t iThread,
- Int_t iSync, AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r,
- AliHLTTPCCATracker &tracker, AliHLTTPCCATrackParam &tParam );
-
- GPUd() static void Step0
- ( Int_t nBlocks, Int_t nThreads, Int_t iBlock, Int_t iThread,
- AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r, AliHLTTPCCATracker &tracker, AliHLTTPCCATrackParam &tParam );
- GPUd() static void Step1
- ( Int_t nBlocks, Int_t nThreads, Int_t iBlock, Int_t iThread,
- AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r, AliHLTTPCCATracker &tracker, AliHLTTPCCATrackParam &tParam );
- GPUd() static void Step2
- ( Int_t nBlocks, Int_t nThreads, Int_t iBlock, Int_t iThread,
- AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r, AliHLTTPCCATracker &tracker, AliHLTTPCCATrackParam &tParam );
+ GPUd() static void InitTracklet ( AliHLTTPCCATrackParam &tParam );
+
+ GPUd() static void ReadData( int iThread, AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r, AliHLTTPCCATracker &tracker, int iRow );
- GPUd() static void ReadData( Int_t iThread, AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r, AliHLTTPCCATracker &tracker, Int_t iRow );
+ GPUd() static void UpdateTracklet
+ ( int nBlocks, int nThreads, int iBlock, int iThread,
+ AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r, AliHLTTPCCATracker &tracker, AliHLTTPCCATrackParam &tParam, int iRow );
- GPUd() static void UpdateTracklet
- ( Int_t nBlocks, Int_t nThreads, Int_t iBlock, Int_t iThread,
- AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r, AliHLTTPCCATracker &tracker, AliHLTTPCCATrackParam &tParam, Int_t iRow );
+ GPUd() static void StoreTracklet
+ ( int nBlocks, int nThreads, int iBlock, int iThread,
+ AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r, AliHLTTPCCATracker &tracker, AliHLTTPCCATrackParam &tParam );
- GPUd() static void StoreTracklet
- ( Int_t nBlocks, Int_t nThreads, Int_t iBlock, Int_t iThread,
- AliHLTTPCCASharedMemory &s, AliHLTTPCCAThreadMemory &r, AliHLTTPCCATracker &tracker, AliHLTTPCCATrackParam &tParam);
+#ifdef HLTCA_GPUCODE
+ GPUd() static void AliHLTTPCCATrackletConstructorNewGPU(AliHLTTPCCATracker *pTracker);
+ GPUd() static int FetchTracklet(AliHLTTPCCATracker &tracker, AliHLTTPCCASharedMemory &sMem, int Reverse, int RowBlock, int &mustInit);
+ GPUd() static void AliHLTTPCCATrackletConstructorInit(int iTracklet, AliHLTTPCCATracker &tracke);
+ GPUd() static void CopyTrackletTempData( AliHLTTPCCAThreadMemory &rMemSrc, AliHLTTPCCAThreadMemory &rMemDst, AliHLTTPCCATrackParam &tParamSrc, AliHLTTPCCATrackParam &tParamDst);
+#else
+ GPUd() static void AliHLTTPCCATrackletConstructorNewCPU(AliHLTTPCCATracker &tracker);
+#endif
+
+ GPUd() static bool SAVE() { return 1; }
- GPUd() static Bool_t SAVE(){ return 1; }
-
#if defined(HLTCA_GPUCODE)
- GPUhd() static Int_t NMemThreads(){ return 128; }
+ //GPUhd() inline int NMemThreads() { return 128; }
+#define TRACKLET_CONSTRUCTOR_NMEMTHREDS HLTCA_GPU_TRACKLET_CONSTRUCTOR_NMEMTHREDS
#else
- GPUhd() static Int_t NMemThreads(){ return 1; }
+ //GPUhd() inline int NMemThreads() { return 1; }
+#define TRACKLET_CONSTRUCTOR_NMEMTHREDS 1
#endif
};
+
#endif