Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
#ifndef O2_TRACKINGITS_TIMEESTBC_H_
#define O2_TRACKINGITS_TIMEESTBC_H_

#ifndef __METAL__
#include <limits>
#include <cstdint>
#endif
#include "CommonDataFormat/TimeStamp.h"
#include "GPUCommonTypeTraits.h"
#include "GPUCommonRtypes.h"
#include "GPUCommonDef.h"
#include "GPUCommonMath.h"
Expand All @@ -40,8 +43,8 @@ class TimeEstBC : public o2::dataformats::TimeStampWithError<TimeStampType, Time
GPUhdi() its::TimeStamp makeSymmetrical() const noexcept
{
const auto start = static_cast<float>(this->getTimeStamp());
const float half = (float)this->getTimeStampError() / 2.f;
return {start + half, half};
const float halfError = (float)this->getTimeStampError() / 2.f;
return {start + halfError, halfError};
}

// check if timestamps overlap within their interval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@
#include <type_traits>
#endif
#include "ReconstructionDataFormats/Vertex.h"
#ifndef __METAL__
#include "SimulationDataFormat/MCCompLabel.h"
#endif
#include "DataFormatsITS/TimeEstBC.h"

namespace o2::its
{
// NOTE: this uses the internal asymmetrical time reprenstation!
using Vertex = o2::dataformats::Vertex<o2::its::TimeEstBC>;
#ifndef __METAL__
using VertexLabel = std::pair<o2::MCCompLabel, float>;
#endif
} // namespace o2::its

#ifndef GPUCA_GPUCODE_DEVICE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef TRACKINGITSU_INCLUDE_CACLUSTER_H_
#define TRACKINGITSU_INCLUDE_CACLUSTER_H_

#include <array>
#include "GPUCommonArray.h"
#include "ITSMFTTracking/Constants.h"
#include "ITSMFTTracking/MathUtils.h"
#include "GPUCommonRtypes.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef TRACKINGITSU_INCLUDE_INDEXTABLEUTILS_H_
#define TRACKINGITSU_INCLUDE_INDEXTABLEUTILS_H_

#include <array>
#include "GPUCommonArray.h"

#include "ITStracking/Cluster.h"
#include "ITSMFTTracking/MathUtils.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
#ifndef TRACKINGITSU_INCLUDE_LAYERMASK_H_
#define TRACKINGITSU_INCLUDE_LAYERMASK_H_

#ifndef __METAL__
#include <cstdint>
#include <type_traits>
#endif
#include "GPUCommonTypeTraits.h"

#ifndef GPUCA_GPUCODE
#include <fmt/format.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
#ifndef TRACKINGITSU_INCLUDE_TRACKINGTOPOLOGY_H_
#define TRACKINGITSU_INCLUDE_TRACKINGTOPOLOGY_H_

#include <array>
#ifndef __METAL__
#include <cstdint>
#include <limits>
#include <type_traits>
#endif
#include "GPUCommonArray.h"
#include "GPUCommonTypeTraits.h"

#ifndef GPUCA_GPUCODE
#include <fmt/format.h>
Expand All @@ -35,8 +38,8 @@ template <int NLayers>
class TrackingTopology
{
public:
static constexpr int MaxLinks = (NLayers * (NLayers - 1)) / 2;
static constexpr int MaxCells = (NLayers * (NLayers - 1) * (NLayers - 2)) / 6;
static GPUglobalconstexpr() int MaxLinks = (NLayers * (NLayers - 1)) / 2;
static GPUglobalconstexpr() int MaxCells = (NLayers * (NLayers - 1) * (NLayers - 2)) / 6;
using Id = std::conditional_t<MaxCells <= std::numeric_limits<uint8_t>::max(), uint8_t, uint16_t>;
using Mask = LayerMask;
using Range = o2::dataformats::RangeReference<Id, Id>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,40 @@
#ifndef TRACKINGITSU_INCLUDE_CONSTANTS_H_
#define TRACKINGITSU_INCLUDE_CONSTANTS_H_

#include "GPUCommonDef.h"
#ifndef __METAL__
#include <array>
#include <utility>
#endif

namespace o2::its::constants
{

constexpr float KB = 1024.f;
constexpr float MB = KB * KB;
constexpr float GB = MB * KB;
constexpr bool DoTimeBenchmarks = true;
constexpr bool SaveTimeBenchmarks = false;
constexpr float Tolerance = 1e-12; // numerical tolerance
constexpr int ClustersPerCell = 3; // number of clusters for a cell
constexpr int UnusedIndex = -1; // global unused flag
constexpr float UnsetValue = -999.f; // global unset value
constexpr float Radl = 9.36f; // Radiation length of Si [cm]
constexpr float Rho = 2.33f; // Density of Si [g/cm^3]
constexpr int MaxIter = 4; // Max. supported iterations
constexpr int MaxSeedingPasses = 2; // seeding + UPC passes optionally appended after the tracking iterations
constexpr int MaxSelectedTrackletsPerCluster = 100; // vertexer: max lines per cluster
constexpr int NumberOfConcurrentSeeds = 16; // default split per worker for the final track fit/extraploation step
constexpr int MinNumberOfConcurrentSeeds = (1 << 8); // minimum chunk size for a worker for the final track fit/extraploation step
constexpr int MaxNumberOfConcurrentSeeds = (1 << 12); // maximum chunk size for a worker for the final track fit/extraploation step
constexpr float MaxTrackSeedQ2Pt = 1.e3f; // maximum q/pt for track seeds

constexpr int MaxBootstrapPasses = 5; // beam bootstrap: cap on the re-trackleting passes
constexpr float BeamConvergence2 = 5.e-3f * 5.e-3f; // beam bootstrap: stop below a (50 um)^2 beam shift
constexpr float VtxMinGoodThreshold = 2.f; // seeding emit: floor of the k*sqrt(ROF load) debris threshold (bounds included)
constexpr float VtxOverpopulatedRofTrimFraction = 0.02f; // overpopulated-ROF pruning: busiest fraction of ROFs left out of the per-ROF mean
GPUglobalconstexpr() float KB = 1024.f;
GPUglobalconstexpr() float MB = KB * KB;
GPUglobalconstexpr() float GB = MB * KB;
GPUglobalconstexpr() bool DoTimeBenchmarks = true;
GPUglobalconstexpr() bool SaveTimeBenchmarks = false;
GPUglobalconstexpr() float Tolerance = 1e-12; // numerical tolerance
GPUglobalconstexpr() int ClustersPerCell = 3; // number of clusters for a cell
GPUglobalconstexpr() int UnusedIndex = -1; // global unused flag
GPUglobalconstexpr() float UnsetValue = -999.f; // global unset value
GPUglobalconstexpr() float Radl = 9.36f; // Radiation length of Si [cm]
GPUglobalconstexpr() float Rho = 2.33f; // Density of Si [g/cm^3]
GPUglobalconstexpr() int MaxIter = 4; // Max. supported iterations
GPUglobalconstexpr() int MaxSeedingPasses = 2; // seeding + UPC passes optionally appended after the tracking iterations
GPUglobalconstexpr() int MaxSelectedTrackletsPerCluster = 100; // vertexer: max lines per cluster
GPUglobalconstexpr() int NumberOfConcurrentSeeds = 16; // default split per worker for the final track fit/extraploation step
GPUglobalconstexpr() int MinNumberOfConcurrentSeeds = (1 << 8); // minimum chunk size for a worker for the final track fit/extraploation step
GPUglobalconstexpr() int MaxNumberOfConcurrentSeeds = (1 << 12); // maximum chunk size for a worker for the final track fit/extraploation step
GPUglobalconstexpr() float MaxTrackSeedQ2Pt = 1.e3f; // maximum q/pt for track seeds

GPUglobalconstexpr() int MaxBootstrapPasses = 5; // beam bootstrap: cap on the re-trackleting passes
GPUglobalconstexpr() float BeamConvergence2 = 5.e-3f * 5.e-3f; // beam bootstrap: stop below a (50 um)^2 beam shift
GPUglobalconstexpr() float VtxMinGoodThreshold = 2.f; // seeding emit: floor of the k*sqrt(ROF load) debris threshold (bounds included)
GPUglobalconstexpr() float VtxOverpopulatedRofTrimFraction = 0.02f; // overpopulated-ROF pruning: busiest fraction of ROFs left out of the per-ROF mean

#ifndef __METAL__
namespace helpers
{

Expand All @@ -57,6 +61,7 @@ constexpr std::array<T, N> initArray()
}

} // namespace helpers
#endif
} // namespace o2::its::constants

#endif /* TRACKINGITSU_INCLUDE_CONSTANTS_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef TRACKINGITSU_INCLUDE_ROFOVERLAPTABLE_H_
#define TRACKINGITSU_INCLUDE_ROFOVERLAPTABLE_H_

#ifndef __METAL__
#include <cstddef>
#include <cstdint>
#include <limits>
Expand All @@ -21,6 +22,7 @@
#include <cassert>
#include <utility>
#include <vector>
#endif

#ifndef GPUCA_GPUCODE
#include <format>
Expand All @@ -40,6 +42,28 @@ namespace o2::itsmft::tracking

using LayerTiming = ROFTimingLayer;

#ifdef __METAL__
// Device code only needs the views of the tables, which are built on the host
using ROFTableRange = dataformats::RangeReference<LayerTiming::BCType, LayerTiming::BCType>;
} // namespace o2::itsmft::tracking

namespace o2::its
{
template <int32_t NLayers>
struct ROFOverlapTable {
using View = o2::itsmft::tracking::ROFOverlapView<o2::itsmft::tracking::ROFTableRange, o2::itsmft::tracking::ROFTableRange>;
};
template <int32_t NLayers>
struct ROFVertexLookupTable {
using View = o2::itsmft::tracking::ROFVertexLookupView<o2::itsmft::tracking::ROFTableRange, o2::itsmft::tracking::ROFTableRange>;
};
template <int32_t NLayers>
struct ROFMaskTable {
using View = o2::itsmft::tracking::ROFMaskView<uint8_t, uint32_t>;
};
} // namespace o2::its
#else

// Base class for lookup to define layers
class LayerTimingBase
{
Expand Down Expand Up @@ -542,4 +566,6 @@ class ROFMaskTable : public o2::itsmft::tracking::ROFMaskTable
};
} // namespace o2::its

#endif // __METAL__

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
#ifndef ALICEO2_ITSMFT_TRACKING_ROFVIEWS_H_
#define ALICEO2_ITSMFT_TRACKING_ROFVIEWS_H_

#ifndef __METAL__
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <string>
#endif

#ifndef GPUCA_GPUCODE
#include <format>
Expand Down Expand Up @@ -288,14 +290,14 @@ struct ROFVertexLookupView {
return maxCount;
}

GPUhdi() bool isVertexCompatible(int32_t layer, size_t rofIdx, const o2::its::Vertex& vertex) const noexcept
GPUhdi() bool isVertexCompatible(int32_t layer, size_t rofIdx, const o2::its::Vertex& vtx) const noexcept
{
assert(layer >= 0 && layer < mLayerCount);
const auto& layerDef = mLayers[layer];
int64_t rofLower = o2::gpu::CAMath::Max(static_cast<int64_t>(layerDef.getROFStartInBC(rofIdx)) - static_cast<int64_t>(layerDef.mROFAddTimeErr), int64_t(0));
int64_t rofUpper = static_cast<int64_t>(layerDef.getROFEndInBC(rofIdx)) + layerDef.mROFAddTimeErr;
auto vLower = static_cast<int64_t>(vertex.getTimeStamp().lower());
auto vUpper = static_cast<int64_t>(vertex.getTimeStamp().upper());
auto vLower = static_cast<int64_t>(vtx.getTimeStamp().lower());
auto vUpper = static_cast<int64_t>(vtx.getTimeStamp().upper());
return vUpper >= rofLower && vLower < rofUpper;
}

Expand Down
7 changes: 7 additions & 0 deletions GPU/Common/GPUCommonTypeTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
#endif
namespace std
{
#ifdef __METAL__
using metal::numeric_limits;
template <class T>
constant constexpr bool is_standard_layout_v = __is_standard_layout(T);
template <class T>
constant constexpr bool is_trivially_copyable_v = __is_trivially_copyable(T);
#endif
template <bool B, class T, class F>
struct conditional {
typedef T type;
Expand Down
Loading