Skip to content

Commit 769fb06

Browse files
committed
use reflection for apply
This removes the need to declare the apply method with macros inside the skeletons
1 parent f9c6b91 commit 769fb06

7 files changed

Lines changed: 114 additions & 88 deletions

File tree

GPU/Common/MemLayout.h

Lines changed: 112 additions & 74 deletions
Large diffs are not rendered by default.

GPU/GPUTracking/Global/GPUChainTracking.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ struct ApplyRecursive {
575575

576576
template <template <template <class> class> class S>
577577
S<MemLayout::const_pointer> operator()(S<MemLayout::const_pointer>& soaIOPtr, S<GPUChainTracking::unique_ptr_array>& soaIOMem) const {
578-
return soaIOPtr.apply(soaIOMem, ApplyRecursive{f});
578+
return apply(soaIOPtr, soaIOMem, ApplyRecursive{f});
579579
}
580580
};
581581

GPU/GPUTracking/SectorTracker/GPUTPCBaseTrackParam.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ struct GPUTPCParameter
5454
template <template <class> class F>
5555
struct GPUTPCBaseTrackParamSkeleton
5656
{
57-
MEMLAYOUT_APPLY_UNARY(mX, mC, mZOffset, mP)
58-
MEMLAYOUT_APPLY_BINARY(GPUTPCBaseTrackParamSkeleton, MEMLAYOUT_EXPAND(mX), MEMLAYOUT_EXPAND(mC), MEMLAYOUT_EXPAND(mZOffset), MEMLAYOUT_EXPAND(mP))
59-
6057
GPUd() float X() const { return mX; }
6158
GPUd() float Y() const { return mP[0]; }
6259
GPUd() float Z() const { return mP[1]; }

GPU/GPUTracking/SectorTracker/GPUTPCTrack.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ template <template <class> class F>
3434
class GPUTPCTrackSkeleton
3535
{
3636
public:
37-
MEMLAYOUT_APPLY_UNARY(mFirstHitID, mNHits, mLocalTrackId, mParam)
38-
MEMLAYOUT_APPLY_BINARY(GPUTPCTrackSkeleton, MEMLAYOUT_EXPAND(mFirstHitID), MEMLAYOUT_EXPAND(mNHits), MEMLAYOUT_EXPAND(mLocalTrackId), MEMLAYOUT_EXPAND(mParam))
39-
4037
//#if !defined(GPUCA_GPUCODE)
4138
// GPUTPCTrack() : mFirstHitID(0), mNHits(0), mLocalTrackId(-1), mParam() {}
4239
// ~GPUTPCTrackSkeleton() = default;

GPU/GPUTracking/SectorTracker/GPUTPCTrackParam.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ template <template <class> class F>
4545
class GPUTPCTrackParamSkeleton
4646
{
4747
public:
48-
MEMLAYOUT_APPLY_UNARY(mParam, mSignCosPhi, mChi2, mNDF)
49-
MEMLAYOUT_APPLY_BINARY(GPUTPCTrackParamSkeleton, MEMLAYOUT_EXPAND(mParam), MEMLAYOUT_EXPAND(mSignCosPhi), MEMLAYOUT_EXPAND(mChi2), MEMLAYOUT_EXPAND(mNDF))
50-
5148
GPUd() MemLayout::wrapper<GPUTPCBaseTrackParamSkeleton, MemLayout::const_reference> GetParam() const { return mParam; }
5249
GPUd() void SetParam(MemLayout::wrapper<GPUTPCBaseTrackParamSkeleton, MemLayout::const_reference> v);
5350
GPUd() void InitParam();

GPU/GPUTracking/SectorTracker/GPUTPCTracker.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ struct ApplyRecursive {
133133
void operator()(T * & aos) const { f(aos); }
134134

135135
template <template <template <class> class> class S>
136-
void operator()(S<MemLayout::pointer>& soa) const { soa.apply(ApplyMemberwise<ApplyRecursive>{f}); }
136+
void operator()(S<MemLayout::pointer>& soa) const { apply(soa, ApplyMemberwise<ApplyRecursive>{f}); }
137137
};
138138

139139
}

GPU/GPUTracking/SectorTracker/GPUTPCTracklet.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ template <template <class> class F>
3333
class GPUTPCTrackletSkeleton
3434
{
3535
public:
36-
MEMLAYOUT_APPLY_UNARY(mFirstRow, mLastRow, mParam, mHitWeight, mFirstHit)
37-
MEMLAYOUT_APPLY_BINARY(GPUTPCTrackletSkeleton, MEMLAYOUT_EXPAND(mFirstRow), MEMLAYOUT_EXPAND(mLastRow), MEMLAYOUT_EXPAND(mParam), MEMLAYOUT_EXPAND(mHitWeight), MEMLAYOUT_EXPAND(mFirstHit))
38-
3936
//#if !defined(GPUCA_GPUCODE)
4037
//GPUTPCTrackletSkeleton() : mFirstRow(0), mLastRow(0), mParam(), mHitWeight(0), mFirstHit(0) {};
4138
//#endif //! GPUCA_GPUCODE

0 commit comments

Comments
 (0)