Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0bef517
GPU: Add compressed clusters to O2 track count print
davidrohr Nov 23, 2026
a8aaeac
GPU: Improve ROCm version check, detection of ROCM_PATH, bump minimum…
davidrohr Nov 23, 2026
d43fffb
GPU: Remove duplicate math constant
davidrohr Nov 23, 2026
6fad6e2
GPU: Remove obsolete TODO on HIP address spaces
davidrohr Nov 23, 2026
80b8d74
GPU: Remove obsolete function
davidrohr Nov 23, 2026
59d0354
GPU: Remove obsolete workaround for CUDA bug
davidrohr Nov 23, 2026
cbe6a1d
GPU: Can use builtins for OpenCL SPIR-V now
davidrohr Nov 23, 2026
dd4fb7c
GPU: Fix namespace for gGPUConstantMemBuffer
davidrohr Nov 23, 2026
7120450
GPU: Move some tracking-related code from GPUReconstruction to GPUCha…
davidrohr Nov 23, 2026
3156bd6
GPU: Add overflow check for GPU direct memory
davidrohr Nov 23, 2026
9753fac
GPU: Ensure alignment and ordering of GPUParam occupancy struct
davidrohr Nov 23, 2026
4e6115a
GPU: Get rid of gpu_reconstruction_kernels namespace
davidrohr Nov 23, 2026
4648e2a
GPU: Clean up leftovers from hipify conversion
davidrohr Nov 23, 2026
d1823ee
GPU CUDA: Remove pragmas from CUDA warning suppressions, which were f…
davidrohr Nov 23, 2026
d63e1ed
GPU: Replace workarounds by [[maybe_unused]]
davidrohr Nov 23, 2026
cd3b5bd
GPU: No need that TPCCompression knows about the merger or constant m…
davidrohr Nov 23, 2026
a6ac4a6
GPU TPC: Deduplicate clusterNative state enums
davidrohr Nov 23, 2026
92aaa31
GPU HIP: Remove obsolete performance workarounds for compiler issues
davidrohr Nov 23, 2026
5dc5d30
GPU Standalone: Add testAsync option
davidrohr Nov 24, 2026
60a481d
GPU Standalone: add missing options to setO2Settings
davidrohr Nov 24, 2026
d73c004
GPU: Remove obsolete TODOs
davidrohr Nov 24, 2026
e2dbe77
GPU: Can clear unused output buffers also with double pipeline
davidrohr Nov 24, 2026
e050540
GPU: Guarantee memory alignment for tpcZSpagesChar and tpcCompressedC…
davidrohr Nov 24, 2026
9132a0e
GPU: Fix race condition at cleanup of double pipeline
davidrohr Nov 24, 2026
b409dec
GPU: Move some static_asserts from headers to cxx files
davidrohr Nov 24, 2026
722e41a
GPT TRD: Have track default values C++11-in-class
davidrohr Nov 24, 2026
210980f
GPU TRD: Remove Run2 leftovers
davidrohr Nov 24, 2026
f59368a
GPU: Use AddOptionArrayRTC via GPUConstexpr()
davidrohr Nov 24, 2026
0286095
GPU TPC: Add option to disable marking history clusters as adjacent
davidrohr Nov 24, 2026
269f4b3
GPU: Automatically sort entries of GPU Settings structures by datatyp…
davidrohr Nov 24, 2026
deab00e
GPU TPC: Don't iterate over all rows in FollowLoopers
davidrohr Nov 24, 2026
cd31bbe
GPU TPC: Run Sector Refit and Unpacking of Extrapolated Tracks in par…
davidrohr Nov 24, 2026
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 @@ -53,7 +53,7 @@ namespace tpc
* Not for permanent storage.
*/
struct ClusterNative {
// NOTE: These states must match those from GPUTPCGMMergedTrackHit!
// NOTE: GPUTPCGMMergedTrackHit uses these states, we must not add a state beyond 0x8, since it uses 0x10 and above for its own flags
enum clusterState { flagSplitPad = 0x1, // Split in pad direction
flagSplitTime = 0x2, // Split in time direction
flagEdge = 0x4, // At edge of TPC sector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ void TrackInterpolation::interpolateTrack(int iSeed)
mCacheDEDX[row].first = std::min<uint16_t>(clTPC.getQtot(), UINT16_MAX);
mCacheDEDX[row].second = clTPC.getQmax();
int imb = int(clTPC.getTime() * mNTPCOccBinLengthInv);
if (imb < mTPCParam->occupancyMapSize) {
if (imb < mTPCParam->occupancy.mapSize) {
multBins[row] = 1 + std::max(0, imb);
}
}
Expand Down Expand Up @@ -799,7 +799,7 @@ void TrackInterpolation::interpolateTrack(int iSeed)
if (--mltBinMin >= 0) { // we were offsetting bin IDs by 1!
float avMlt = 0;
for (int ib = mltBinMin; ib < mltBinMax; ib++) {
avMlt += mTPCParam->occupancyMap[ib];
avMlt += mTPCParam->occupancy.map[ib];
}
avMlt /= (mltBinMax - mltBinMin);
trackData.setMultStack(avMlt, ist);
Expand Down Expand Up @@ -1087,7 +1087,7 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
rowPrev = row;
}
int imb = int(cl.getTime() * mNTPCOccBinLengthInv);
if (imb < mTPCParam->occupancyMapSize) {
if (imb < mTPCParam->occupancy.mapSize) {
multBins[row] = 1 + std::max(0, imb);
}
++nMeasurements;
Expand Down Expand Up @@ -1182,7 +1182,7 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
if (--mltBinMin >= 0) { // we were offsetting bin IDs by 1!
float avMlt = 0;
for (int ib = mltBinMin; ib < mltBinMax; ib++) {
avMlt += mTPCParam->occupancyMap[ib];
avMlt += mTPCParam->occupancy.map[ib];
}
avMlt /= (mltBinMax - mltBinMin);
trackData.setMultStack(avMlt, ist);
Expand Down
2 changes: 1 addition & 1 deletion Detectors/TPC/qc/include/TPCQC/Tracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct ClusterNativeAccess;
namespace qc
{
// Class for tracking QA (efficiency / resolution)
// Some settings can be steered via --configKeyValues: (See GPUSettingsList.h for actual definitions). Relevant QA parameters are:
// Some settings can be steered via --configKeyValues: (See GPUSettingsList.template for actual definitions). Relevant QA parameters are:
// "GPU_QA.strict=[bool]" Strict QA mode: Only consider resolution of tracks where the fit ended within 5 cm of the reference, and remove outliers. (Default: true)
// "GPU_QA.qpt=[float]" Set cut for Q/Pt. (Default: 10.0)
// "GPU_QA.recThreshold=[float]" Compute the efficiency including impure tracks with fake contamination. (Default 0.9)
Expand Down
2 changes: 1 addition & 1 deletion Detectors/TRD/workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ We have the following binaries which can be used to assemble a global workflow:

Run any of the workflows with `--help` or `--help full` to see the available options and their explanations.

The available `--configKeyValues` for the global tracking workflow are mostly listed in [GPUSettingsList.h](../../../../dev/GPU/GPUTracking/Definitions/GPUSettingsList.h). Search for GPUSettingsRecTRD to find options as for example the minimum number of TRD tracklets required for a TRD track to not be discarded.
The available `--configKeyValues` for the global tracking workflow are mostly listed in [GPUSettingsList.template](../../../../dev/GPU/GPUTracking/Definitions/GPUSettingsList.template). Search for GPUSettingsRecTRD to find options as for example the minimum number of TRD tracklets required for a TRD track to not be discarded.



Expand Down
3 changes: 2 additions & 1 deletion GPU/Common/GPUCommonAlignedAlloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ namespace o2::gpu

template <typename T, std::size_t MIN_ALIGN = 0>
struct alignedDeleter {
void operator()(void* ptr) { ::operator delete(ptr, std::align_val_t(std::max(MIN_ALIGN, alignof(T)))); }; // TODO: Make this static once we go to C++ 23
static constexpr std::size_t alignment = std::max(MIN_ALIGN, alignof(T));
void operator()(void* ptr) { ::operator delete(ptr, std::align_val_t(alignment)); }; // TODO: Make this static once we go to C++ 23
};

template <typename T, std::size_t MIN_ALIGN = 0>
Expand Down
3 changes: 2 additions & 1 deletion GPU/Common/GPUCommonConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
#define GPUCOMMONCONSTANTS_H

#include "GPUCommonDef.h"
#include "CommonConstants/MathConstants.h"

namespace o2::gpu::gpu_common_constants
{
static GPUglobalconstexpr() const float kCLight = 0.000299792458f; // TODO: Duplicate of MathConstants, fix this now that we use only OpenCL CPP
static GPUglobalconstexpr() const float kCLight = -o2::constants::math::B2C;
static GPUglobalconstexpr() const float kZeroFieldCut = 0.013f;
} // namespace o2::gpu::gpu_common_constants

Expand Down
10 changes: 1 addition & 9 deletions GPU/Common/GPUCommonDefAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,7 @@
#define GPUhdni() __host__ __device__
#define GPUg() __global__
#define GPUshared() __shared__
#if defined(GPUCA_GPUCODE_DEVICE) && 0 // TODO: Fix for HIP
#define GPUCA_USE_TEMPLATE_ADDRESS_SPACES
#define GPUglobal() __attribute__((address_space(1)))
#define GPUglobalref() GPUglobal()
#define GPUconstantref() __attribute__((address_space(4)))
#define GPUsharedref() __attribute__((address_space(3)))
#else
#define GPUglobal()
#endif
#define GPUglobal()
#define GPUconstant() __constant__
#define GPUconstexpr() constexpr __constant__
#define GPUprivate()
Expand Down
17 changes: 2 additions & 15 deletions GPU/Common/GPUCommonMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ class GPUCommonMath
using half_t = _Float16;
#endif

GPUd() static float2 MakeFloat2(float x, float y); // TODO: Find better appraoch that is constexpr

template <class T>
GPUhd() constexpr static T Min(const T x, const T y)
{
Expand Down Expand Up @@ -289,17 +287,6 @@ GPUdi() constexpr T GPUCommonMath::nextMultipleOf(T val)
} else {
return (val + I - 1) & ~(T)(I - 1);
}
return 0; // BUG: Cuda complains about missing return value with constexpr if
}

GPUdi() float2 GPUCommonMath::MakeFloat2(float x, float y)
{
#if !defined(GPUCA_GPUCODE) || defined(__OPENCL__) || defined(__OPENCL_HOST__) || defined(__METAL__) || defined(__METAL_HOST__) || defined(__CPUDEVICE__)
float2 ret = {x, y};
return ret;
#else
return make_float2(x, y);
#endif // GPUCA_GPUCODE
}

GPUdi() constexpr float GPUCommonMath::Modf(float x, float y) { return GPUCA_CHOICE(fmodf(x, y), fmodf(x, y), fmod(x, y)); }
Expand Down Expand Up @@ -442,7 +429,7 @@ GPUdi() constexpr uint32_t GPUCommonMath::Ctz(uint32_t x)

GPUdi() constexpr uint32_t GPUCommonMath::Popcount(uint32_t x)
{
#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__)) && !defined(__OPENCL__) // TODO: remove OPENCL when reported SPIR-V bug is fixed
#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__))
// use builtin if available
return GPUCA_CHOICE(__builtin_popcount(x), __popc(x), __builtin_popcount(x));
#else
Expand Down Expand Up @@ -482,7 +469,7 @@ GPUdi() constexpr uint32_t GPUCommonMath::Ctz64(uint64_t x)

GPUdi() constexpr uint32_t GPUCommonMath::Popcount64(uint64_t x)
{
#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__)) && !defined(__OPENCL__) // TODO: remove OPENCL when reported SPIR-V bug is fixed
#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__))
// use builtin if available
return GPUCA_CHOICE(__builtin_popcountll(x), __popcll(x), __builtin_popcountll(x));
#else
Expand Down
10 changes: 5 additions & 5 deletions GPU/GPUTracking/Base/GPUConstantMem.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ union GPUConstantMemCopyable {
#if defined(GPUCA_GPUCODE)
static GPUglobalconstexpr() size_t gGPUConstantMemBufferSize = (sizeof(GPUConstantMem) + sizeof(uint4) - 1);
#endif
} // namespace o2::gpu

#if defined(GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM)
GPUconstant() o2::gpu::GPUConstantMemCopyable gGPUConstantMemBuffer; // TODO: This should go into o2::gpu namespace, but then CUDA or HIP would not find the symbol
#endif // GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM
namespace o2::gpu
{
extern "C" { // C linkage for the unmangled symbol name that the RTC looks up, the braces make it a definition, not a declaration
GPUconstant() GPUConstantMemCopyable gGPUConstantMemBuffer;
}
#endif

// Must be placed here, to avoid circular header dependency
GPUdi() GPUconstantref() const GPUConstantMem* GPUProcessor::GetConstantMem() const
Expand Down
12 changes: 6 additions & 6 deletions GPU/GPUTracking/Base/GPUParam.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ void GPUParam::SetDefaults(float solenoidBz, bool assumeConstantBz)
{
memset((void*)this, 0, sizeof(*this));
new (&rec) GPUSettingsRec;
occupancyMap = nullptr;
occupancyMapSize = 0;
occupancyTotal = 0;
occupancy.map = nullptr;
occupancy.mapSize = 0;
occupancy.total = 0;

#ifndef GPUCA_RUN2
const float kErrorsY[4] = {0.06, 0.24, 0.12, 0.1};
Expand Down Expand Up @@ -107,7 +107,7 @@ void GPUParam::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessi
if (w) {
par.dodEdx = dodEdxEnabled = w->steps.isSet(gpudatatypes::RecoStep::TPCdEdx);
if (dodEdxEnabled && p && p->tpcDownscaledEdx != 0) {
dodEdxEnabled = (rand() % 100) < p->tpcDownscaledEdx;
dodEdxEnabled = p->tpcDownscaledEdx <= 100 && (rand() % 100) < p->tpcDownscaledEdx;
}
}
if (d) {
Expand Down Expand Up @@ -159,14 +159,14 @@ void GPUParamRTC::setFrom(const GPUParam& param)
memcpy((void*)this, (void*)&param, sizeof(param));
}

std::string GPUParamRTC::generateRTCCode(const GPUParam& param, bool useConstexpr)
std::string GPUParamRTC::generateRTCCode(const GPUParam& param, bool useConstexpr, bool gpuConstexprArrayInConstantMem)
{
return "#include <string>\n"
"#include <vector>\n"
"#include <cstdint>\n"
"#include <cstddef>\n"
"namespace o2::gpu { class GPUDisplayFrontendInterface; }\n" +
qConfigPrintRtc(std::make_tuple(&param.rec.tpc, &param.rec.trd, &param.rec, &param.par), useConstexpr);
qConfigPrintRtc(std::make_tuple(&param.rec.tpc, &param.rec.trd, &param.rec, &param.par), useConstexpr, gpuConstexprArrayInConstantMem);
}

static_assert(sizeof(o2::gpu::GPUParam) == sizeof(o2::gpu::GPUParamRTC), "RTC param size mismatch");
9 changes: 6 additions & 3 deletions GPU/GPUTracking/Base/GPUParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ struct GPUParam_t {
int32_t tpcCutTimeBin;

GPUTPCGMPolynomialField polynomialField; // Polynomial approx. of magnetic field for TPC GM
const uint32_t* occupancyMap; // Ptr to TPC occupancy map
uint32_t occupancyTotal; // Total occupancy in the TPC (nCl / nHbf)
uint32_t occupancyMapSize; // Size of occupancy map

struct occupancyStruct {
const uint32_t* map; // Ptr to TPC occupancy map
uint32_t total; // Total occupancy in the TPC (nCl / nHbf)
uint32_t mapSize; // Size of occupancy map
} occupancy;

protected:
#ifndef GPUCA_RUN2
Expand Down
10 changes: 5 additions & 5 deletions GPU/GPUTracking/Base/GPUParam.inc
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ GPUdi() float GPUParam::GetSystematicClusterErrorIFC2(float x, float y, float z,
GPUdi() float GPUParam::GetSystematicClusterErrorC122(float x, float y, uint8_t sector) const
{
const float dx = x - 83.f;
if (dx > occupancyTotal * rec.tpc.sysClusErrorC12Box) {
if (dx > occupancy.total * rec.tpc.sysClusErrorC12Box) {
return 0.f;
}
constexpr float dEdgeInv = 18.f / CAMath::Pi();
const float dy = (sector == (GPUTPCGeometry::NSECTORS / 2 + 1) ? 0.5f : -0.5f) * (y / x) * dEdgeInv + 0.5f;
const float errC12 = rec.tpc.sysClusErrorC12Norm * occupancyTotal * dy;
const float errC12 = rec.tpc.sysClusErrorC12Norm * occupancy.total * dy;
return errC12 * errC12;
}

Expand Down Expand Up @@ -210,11 +210,11 @@ GPUdi() void GPUParam::UpdateClusterError2ByState(int16_t clusterState, float& E

GPUdi() float GPUParam::GetUnscaledMult(float time) const
{
if (!occupancyMap) {
if (!occupancy.map) {
return 0.f;
}
const uint32_t bin = CAMath::Min<uint32_t>(occupancyMapSize - 1, CAMath::Max(0.f, time / rec.tpc.occupancyMapTimeBins));
return occupancyMap[bin];
const uint32_t bin = CAMath::Min<uint32_t>(occupancy.mapSize - 1, CAMath::Max(0.f, time / rec.tpc.occupancyMapTimeBins));
return occupancy.map[bin];
}

GPUdi() bool GPUParam::rejectEdgeClusterByY(float uncorrectedY, int32_t iRow, float trackSigmaY) const
Expand Down
8 changes: 4 additions & 4 deletions GPU/GPUTracking/Base/GPUParamRTC.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace o2::gpu
{
namespace gpu_rtc
namespace internal::rtc
{
#define QCONFIG_GENRTC
#define BeginNamespace(...)
Expand All @@ -31,11 +31,11 @@ namespace gpu_rtc
#undef QCONFIG_GENRTC
#undef BeginNamespace
#undef EndNamespace
} // namespace gpu_rtc
} // namespace internal::rtc

struct GPUParamRTC : public internal::GPUParam_t<gpu_rtc::GPUSettingsRec, gpu_rtc::GPUSettingsParam> {
struct GPUParamRTC : public internal::GPUParam_t<internal::rtc::GPUSettingsRec, internal::rtc::GPUSettingsParam> {
void setFrom(const GPUParam& param);
static std::string generateRTCCode(const GPUParam& param, bool useConstexpr);
static std::string generateRTCCode(const GPUParam& param, bool useConstexpr, bool gpuConstexprArrayInConstantMem);
};

} // namespace o2::gpu
Expand Down
29 changes: 14 additions & 15 deletions GPU/GPUTracking/Base/GPUReconstruction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ GPUReconstruction::GPUReconstruction(const GPUSettingsDeviceBackend& cfg) : mHos
}
param().SetDefaults(mGRPSettings.get());
mMemoryScalers.reset(new GPUMemorySizeScalers);
for (uint32_t i = 0; i < NSECTORS; i++) {
processors()->tpcTrackers[i].SetSector(i); // TODO: Move to a better place
processors()->tpcClusterer[i].mISector = i;
#ifdef GPUCA_HAS_ONNX
processors()->tpcNNClusterer[i].mISector = i;
#endif
}
}

GPUReconstruction::~GPUReconstruction()
Expand Down Expand Up @@ -438,7 +431,7 @@ int32_t GPUReconstruction::InitPhaseAfterDevice()
void GPUReconstruction::WriteConstantParams(int32_t stream)
{
if (IsGPU()) {
const auto threadContext = GetThreadContext();
const auto holdContext = GetThreadContext();
WriteToConstantMemory(ptrDiff(&processors()->param, processors()), &param(), sizeof(param()), stream);
}
}
Expand Down Expand Up @@ -753,20 +746,23 @@ void* GPUReconstruction::AllocateDirectMemory(size_t size, int32_t type)
void*& pool = (type & GPUMemoryResource::MEMORY_GPU) ? mDeviceMemoryPool : mHostMemoryPool;
void*& poolend = (type & GPUMemoryResource::MEMORY_GPU) ? mDeviceMemoryPoolEnd : mHostMemoryPoolEnd;
char* retVal;
if ((type & GPUMemoryResource::MEMORY_STACK)) {
poolend = (char*)poolend - size; // TODO: Implement overflow check
if (size > (size_t)((char*)poolend - (char*)pool)) {
GPUError("Insufficient direct memory: requested %zu, available %td bytes", size, ptrDiff(poolend, pool));
throw std::bad_alloc();
} else if ((type & GPUMemoryResource::MEMORY_STACK)) {
poolend = (char*)poolend - size;
poolend = (char*)poolend - GPUProcessor::getAlignmentMod<constants::GPU_MEMALIGN>(poolend);
retVal = (char*)poolend;
} else {
GPUProcessor::computePointerWithAlignment(pool, retVal, size);
}
if (pool > poolend) {
GPUError("Insufficient unmanaged memory: missing %ld bytes", ptrDiff(pool, poolend));
GPUError("Insufficient direct memory: missing %td bytes", ptrDiff(pool, poolend));
throw std::bad_alloc();
}
UpdateMaxMemoryUsed();
if (GetProcessingSettings().allocDebugLevel >= 2) {
std::cout << "Allocated (unmanaged " << ((type & GPUMemoryResource::MEMORY_GPU) ? "gpu" : "host") << "): " << size << " - available: " << ptrDiff(poolend, pool) << "\n";
std::cout << "Allocated (direct " << ((type & GPUMemoryResource::MEMORY_GPU) ? "gpu" : "host") << "): " << size << " - available: " << ptrDiff(poolend, pool) << "\n";
}
return retVal;
}
Expand Down Expand Up @@ -1145,10 +1141,13 @@ void GPUReconstruction::RunPipelineWorker()
{
std::lock_guard<std::mutex> lk(q->m);
q->done = true;
q->c.notify_one();
}
{
std::lock_guard<std::mutex> lk(mPipelineContext->mutex);
mPipelineContext->workerRunning = false;
mPipelineContext->cond.notify_one();
}
q->c.notify_one();
mPipelineContext->workerRunning = false;
mPipelineContext->cond.notify_one();
}
if (GetProcessingSettings().debugLevel >= 3) {
GPUInfo("Pipeline worker ended");
Expand Down
21 changes: 9 additions & 12 deletions GPU/GPUTracking/Base/GPUReconstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ struct GPUSettingsRec;
struct GPUSettingsRecDynamic;
struct GPUMemoryReuse;

namespace gpu_reconstruction_kernels
{
struct deviceEvent;
class threadContext;
} // namespace gpu_reconstruction_kernels

class GPUReconstruction
{
protected:
Expand Down Expand Up @@ -140,6 +134,9 @@ class GPUReconstruction
Device = 1,
Auto = -1 };

struct deviceEvent;
struct threadContext;

// Global steering functions
template <class T, typename... Args>
T* AddChain(Args... args);
Expand Down Expand Up @@ -278,7 +275,7 @@ class GPUReconstruction
int32_t InitPhaseAfterDevice();
void WriteConstantParams(int32_t stream = -1);
virtual int32_t ExitDevice() = 0;
virtual size_t WriteToConstantMemory(size_t offset, const void* src, size_t size, int32_t stream = -1, gpu_reconstruction_kernels::deviceEvent* ev = nullptr) = 0;
virtual size_t WriteToConstantMemory(size_t offset, const void* src, size_t size, int32_t stream = -1, deviceEvent* ev = nullptr) = 0;
void UpdateMaxMemoryUsed();
int32_t EnqueuePipeline(bool terminate = false);
GPUChain* GetNextChainInQueue();
Expand All @@ -288,7 +285,7 @@ class GPUReconstruction
virtual int32_t unregisterMemoryForGPU_internal(const void* ptr) = 0;

// Management for GPU thread contexts
virtual std::unique_ptr<gpu_reconstruction_kernels::threadContext> GetThreadContext() = 0;
virtual std::unique_ptr<threadContext> GetThreadContext() = 0;

// Private helpers for library loading
static std::shared_ptr<LibraryLoader>* GetLibraryInstance(DeviceType type, bool verbose);
Expand All @@ -301,10 +298,10 @@ class GPUReconstruction
// Private helper functions for reading / writing / allocating IO buffer from/to file
template <class T, class S>
uint32_t DumpData(FILE* fp, const T* const* entries, const S* num, InOutPointerType type);
template <class T, class S>
size_t ReadData(FILE* fp, const T** entries, S* num, std::unique_ptr<T[]>* mem, InOutPointerType type, T** nonConstPtrs = nullptr);
template <class T>
T* AllocateIOMemoryHelper(size_t n, const T*& ptr, std::unique_ptr<T[]>& u);
template <class T, class S, class D>
size_t ReadData(FILE* fp, const T** entries, S* num, std::unique_ptr<T[], D>* mem, InOutPointerType type, T** nonConstPtrs = nullptr);
template <class T, class D>
T* AllocateIOMemoryHelper(size_t n, const T*& ptr, std::unique_ptr<T[], D>& u);
int16_t RegisterMemoryAllocationHelper(GPUProcessor* proc, void* (GPUProcessor::*setPtr)(void*), int32_t type, const char* name, const GPUMemoryReuse& re);

// Private helper functions to dump / load flat objects
Expand Down
Loading