// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include "ImagePreprocessorBuffer.h" #include "../indexing/CUDAMemHelpers.h" class ImagePreprocessorBufferGPU : public ImagePreprocessorBuffer { CudaDevicePtr gpu_image; CudaRegisteredVector buffer_reg; // Staging for Gather(). Its only caller is ImageSpotFinder::ExtractSpots, which gives up on a frame // with UINT16_MAX or more strong pixels (the connected-component search rejects it anyway), so that // is the largest gather that can be asked for. static constexpr size_t MAX_GATHER = UINT16_MAX; CudaDevicePtr gpu_gather_index; CudaDevicePtr gpu_gather_value; // Own stream: every analysis engine synchronises its own stream before it returns, so the device // image is final by the time a gather is asked for. The NULL stream would serialise all workers. CudaStream gather_stream; public: explicit ImagePreprocessorBufferGPU(size_t npixel); int32_t *getGPUBuffer() override; const int32_t *getGPUBuffer() const override; void Gather(const std::vector &npixel, std::vector &values) const override; };