diff --git a/CUDADataFormats/Common/BuildFile.xml b/CUDADataFormats/Common/BuildFile.xml
index e7a5ba74d80be..c524cada33060 100644
--- a/CUDADataFormats/Common/BuildFile.xml
+++ b/CUDADataFormats/Common/BuildFile.xml
@@ -1,7 +1,8 @@
-
-
-
-
+
+
+
+
+
-
+
diff --git a/CUDADataFormats/Common/src/classes.h b/CUDADataFormats/Common/src/classes.h
new file mode 100644
index 0000000000000..239e071d513a2
--- /dev/null
+++ b/CUDADataFormats/Common/src/classes.h
@@ -0,0 +1,7 @@
+#ifndef CUDADataFormats_Common_src_classes_h
+#define CUDADataFormats_Common_src_classes_h
+
+#include "CUDADataFormats/Common/interface/HostProduct.h"
+#include "DataFormats/Common/interface/Wrapper.h"
+
+#endif // CUDADataFormats_Common_src_classes_h
diff --git a/CUDADataFormats/Common/src/classes_def.xml b/CUDADataFormats/Common/src/classes_def.xml
new file mode 100644
index 0000000000000..024d927595914
--- /dev/null
+++ b/CUDADataFormats/Common/src/classes_def.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h b/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h
index dbfb5ff5e1761..d5d009aaffeb5 100644
--- a/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h
+++ b/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h
@@ -10,7 +10,7 @@
class SiPixelClustersCUDA {
public:
SiPixelClustersCUDA() = default;
- explicit SiPixelClustersCUDA(size_t maxClusters, cudaStream_t stream);
+ explicit SiPixelClustersCUDA(size_t maxModules, cudaStream_t stream);
~SiPixelClustersCUDA() = default;
SiPixelClustersCUDA(const SiPixelClustersCUDA &) = delete;
@@ -32,23 +32,13 @@ class SiPixelClustersCUDA {
uint32_t const *moduleId() const { return moduleId_d.get(); }
uint32_t const *clusModuleStart() const { return clusModuleStart_d.get(); }
- uint32_t const *c_moduleStart() const { return moduleStart_d.get(); }
- uint32_t const *c_clusInModule() const { return clusInModule_d.get(); }
- uint32_t const *c_moduleId() const { return moduleId_d.get(); }
- uint32_t const *c_clusModuleStart() const { return clusModuleStart_d.get(); }
-
class DeviceConstView {
public:
- // DeviceConstView() = default;
-
__device__ __forceinline__ uint32_t moduleStart(int i) const { return __ldg(moduleStart_ + i); }
__device__ __forceinline__ uint32_t clusInModule(int i) const { return __ldg(clusInModule_ + i); }
__device__ __forceinline__ uint32_t moduleId(int i) const { return __ldg(moduleId_ + i); }
__device__ __forceinline__ uint32_t clusModuleStart(int i) const { return __ldg(clusModuleStart_ + i); }
- friend SiPixelClustersCUDA;
-
- // private:
uint32_t const *moduleStart_;
uint32_t const *clusInModule_;
uint32_t const *moduleId_;
@@ -67,7 +57,7 @@ class SiPixelClustersCUDA {
cms::cuda::device::unique_ptr view_d; // "me" pointer
- uint32_t nClusters_h;
+ uint32_t nClusters_h = 0;
};
#endif
diff --git a/CUDADataFormats/SiPixelCluster/src/SiPixelClustersCUDA.cc b/CUDADataFormats/SiPixelCluster/src/SiPixelClustersCUDA.cc
index 7bef9d0d8a52f..5e53f49570bb4 100644
--- a/CUDADataFormats/SiPixelCluster/src/SiPixelClustersCUDA.cc
+++ b/CUDADataFormats/SiPixelCluster/src/SiPixelClustersCUDA.cc
@@ -4,12 +4,11 @@
#include "HeterogeneousCore/CUDAUtilities/interface/host_unique_ptr.h"
#include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h"
-SiPixelClustersCUDA::SiPixelClustersCUDA(size_t maxClusters, cudaStream_t stream) {
- moduleStart_d = cms::cuda::make_device_unique(maxClusters + 1, stream);
- clusInModule_d = cms::cuda::make_device_unique(maxClusters, stream);
- moduleId_d = cms::cuda::make_device_unique(maxClusters, stream);
- clusModuleStart_d = cms::cuda::make_device_unique(maxClusters + 1, stream);
-
+SiPixelClustersCUDA::SiPixelClustersCUDA(size_t maxModules, cudaStream_t stream)
+ : moduleStart_d(cms::cuda::make_device_unique(maxModules + 1, stream)),
+ clusInModule_d(cms::cuda::make_device_unique(maxModules, stream)),
+ moduleId_d(cms::cuda::make_device_unique(maxModules, stream)),
+ clusModuleStart_d(cms::cuda::make_device_unique(maxModules + 1, stream)) {
auto view = cms::cuda::make_host_unique(stream);
view->moduleStart_ = moduleStart_d.get();
view->clusInModule_ = clusInModule_d.get();
diff --git a/CUDADataFormats/SiPixelDigi/interface/SiPixelDigiErrorsCUDA.h b/CUDADataFormats/SiPixelDigi/interface/SiPixelDigiErrorsCUDA.h
index aa06e8dbbd57d..85e8883fa1bd4 100644
--- a/CUDADataFormats/SiPixelDigi/interface/SiPixelDigiErrorsCUDA.h
+++ b/CUDADataFormats/SiPixelDigi/interface/SiPixelDigiErrorsCUDA.h
@@ -1,7 +1,8 @@
#ifndef CUDADataFormats_SiPixelDigi_interface_SiPixelDigiErrorsCUDA_h
#define CUDADataFormats_SiPixelDigi_interface_SiPixelDigiErrorsCUDA_h
-#include "DataFormats/SiPixelDigi/interface/PixelErrors.h"
+#include "DataFormats/SiPixelRawData/interface/SiPixelErrorCompact.h"
+#include "DataFormats/SiPixelRawData/interface/SiPixelFormatterErrors.h"
#include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h"
#include "HeterogeneousCore/CUDAUtilities/interface/host_unique_ptr.h"
#include "HeterogeneousCore/CUDAUtilities/interface/SimpleVector.h"
@@ -10,8 +11,10 @@
class SiPixelDigiErrorsCUDA {
public:
+ using SiPixelErrorCompactVector = cms::cuda::SimpleVector;
+
SiPixelDigiErrorsCUDA() = default;
- explicit SiPixelDigiErrorsCUDA(size_t maxFedWords, PixelFormatterErrors errors, cudaStream_t stream);
+ explicit SiPixelDigiErrorsCUDA(size_t maxFedWords, SiPixelFormatterErrors errors, cudaStream_t stream);
~SiPixelDigiErrorsCUDA() = default;
SiPixelDigiErrorsCUDA(const SiPixelDigiErrorsCUDA&) = delete;
@@ -19,23 +22,21 @@ class SiPixelDigiErrorsCUDA {
SiPixelDigiErrorsCUDA(SiPixelDigiErrorsCUDA&&) = default;
SiPixelDigiErrorsCUDA& operator=(SiPixelDigiErrorsCUDA&&) = default;
- const PixelFormatterErrors& formatterErrors() const { return formatterErrors_h; }
+ const SiPixelFormatterErrors& formatterErrors() const { return formatterErrors_h; }
- cms::cuda::SimpleVector* error() { return error_d.get(); }
- cms::cuda::SimpleVector const* error() const { return error_d.get(); }
- cms::cuda::SimpleVector const* c_error() const { return error_d.get(); }
+ SiPixelErrorCompactVector* error() { return error_d.get(); }
+ SiPixelErrorCompactVector const* error() const { return error_d.get(); }
- using HostDataError =
- std::pair, cms::cuda::host::unique_ptr>;
+ using HostDataError = std::pair>;
HostDataError dataErrorToHostAsync(cudaStream_t stream) const;
void copyErrorToHostAsync(cudaStream_t stream);
private:
- cms::cuda::device::unique_ptr data_d;
- cms::cuda::device::unique_ptr> error_d;
- cms::cuda::host::unique_ptr> error_h;
- PixelFormatterErrors formatterErrors_h;
+ cms::cuda::device::unique_ptr data_d;
+ cms::cuda::device::unique_ptr error_d;
+ cms::cuda::host::unique_ptr error_h;
+ SiPixelFormatterErrors formatterErrors_h;
};
#endif
diff --git a/CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h b/CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h
index 04207f3e0b385..2dc1f628bf426 100644
--- a/CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h
+++ b/CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h
@@ -42,14 +42,6 @@ class SiPixelDigisCUDA {
uint32_t const *pdigi() const { return pdigi_d.get(); }
uint32_t const *rawIdArr() const { return rawIdArr_d.get(); }
- uint16_t const *c_xx() const { return xx_d.get(); }
- uint16_t const *c_yy() const { return yy_d.get(); }
- uint16_t const *c_adc() const { return adc_d.get(); }
- uint16_t const *c_moduleInd() const { return moduleInd_d.get(); }
- int32_t const *c_clus() const { return clus_d.get(); }
- uint32_t const *c_pdigi() const { return pdigi_d.get(); }
- uint32_t const *c_rawIdArr() const { return rawIdArr_d.get(); }
-
cms::cuda::host::unique_ptr adcToHostAsync(cudaStream_t stream) const;
cms::cuda::host::unique_ptr clusToHostAsync(cudaStream_t stream) const;
cms::cuda::host::unique_ptr pdigiToHostAsync(cudaStream_t stream) const;
@@ -57,17 +49,12 @@ class SiPixelDigisCUDA {
class DeviceConstView {
public:
- // DeviceConstView() = default;
-
__device__ __forceinline__ uint16_t xx(int i) const { return __ldg(xx_ + i); }
__device__ __forceinline__ uint16_t yy(int i) const { return __ldg(yy_ + i); }
__device__ __forceinline__ uint16_t adc(int i) const { return __ldg(adc_ + i); }
__device__ __forceinline__ uint16_t moduleInd(int i) const { return __ldg(moduleInd_ + i); }
__device__ __forceinline__ int32_t clus(int i) const { return __ldg(clus_ + i); }
- friend class SiPixelDigisCUDA;
-
- // private:
uint16_t const *xx_;
uint16_t const *yy_;
uint16_t const *adc_;
@@ -88,8 +75,8 @@ class SiPixelDigisCUDA {
// These are for CPU output; should we (eventually) place them to a
// separate product?
- cms::cuda::device::unique_ptr pdigi_d;
- cms::cuda::device::unique_ptr rawIdArr_d;
+ cms::cuda::device::unique_ptr pdigi_d; // packed digi (row, col, adc) of each pixel
+ cms::cuda::device::unique_ptr rawIdArr_d; // DetId of each pixel
uint32_t nModules_h = 0;
uint32_t nDigis_h = 0;
diff --git a/CUDADataFormats/SiPixelDigi/src/SiPixelDigiErrorsCUDA.cc b/CUDADataFormats/SiPixelDigi/src/SiPixelDigiErrorsCUDA.cc
index 075d408a6f6fc..70bf2e8aa19f5 100644
--- a/CUDADataFormats/SiPixelDigi/src/SiPixelDigiErrorsCUDA.cc
+++ b/CUDADataFormats/SiPixelDigi/src/SiPixelDigiErrorsCUDA.cc
@@ -7,14 +7,13 @@
#include
-SiPixelDigiErrorsCUDA::SiPixelDigiErrorsCUDA(size_t maxFedWords, PixelFormatterErrors errors, cudaStream_t stream)
- : formatterErrors_h(std::move(errors)) {
- error_d = cms::cuda::make_device_unique>(stream);
- data_d = cms::cuda::make_device_unique(maxFedWords, stream);
-
+SiPixelDigiErrorsCUDA::SiPixelDigiErrorsCUDA(size_t maxFedWords, SiPixelFormatterErrors errors, cudaStream_t stream)
+ : data_d(cms::cuda::make_device_unique(maxFedWords, stream)),
+ error_d(cms::cuda::make_device_unique(stream)),
+ error_h(cms::cuda::make_host_unique(stream)),
+ formatterErrors_h(std::move(errors)) {
cms::cuda::memsetAsync(data_d, 0x00, maxFedWords, stream);
- error_h = cms::cuda::make_host_unique>(stream);
cms::cuda::make_SimpleVector(error_h.get(), maxFedWords, data_d.get());
assert(error_h->empty());
assert(error_h->capacity() == static_cast(maxFedWords));
@@ -30,7 +29,7 @@ SiPixelDigiErrorsCUDA::HostDataError SiPixelDigiErrorsCUDA::dataErrorToHostAsync
// On one hand size() could be sufficient. On the other hand, if
// someone copies the SimpleVector<>, (s)he might expect the data
// buffer to actually have space for capacity() elements.
- auto data = cms::cuda::make_host_unique(error_h->capacity(), stream);
+ auto data = cms::cuda::make_host_unique(error_h->capacity(), stream);
// but transfer only the required amount
if (not error_h->empty()) {
diff --git a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h
index b0aa79cfe20b6..73a6daaa4e387 100644
--- a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h
+++ b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h
@@ -84,11 +84,7 @@ TrackingRecHit2DHeterogeneous::TrackingRecHit2DHeterogeneous(uint32_t nH
// if empy do not bother
if (0 == nHits) {
- if
-#ifndef __CUDACC__
- constexpr
-#endif
- (std::is_same::value) {
+ if constexpr (std::is_same::value) {
cms::cuda::copyAsync(m_view, view, stream);
} else {
m_view.reset(view.release()); // NOLINT: std::move() breaks CUDA version
diff --git a/CUDADataFormats/TrackingRecHit/src/classes.h b/CUDADataFormats/TrackingRecHit/src/classes.h
index d80226ec7a14b..3d40821493c5b 100644
--- a/CUDADataFormats/TrackingRecHit/src/classes.h
+++ b/CUDADataFormats/TrackingRecHit/src/classes.h
@@ -2,7 +2,6 @@
#define CUDADataFormats_SiPixelCluster_src_classes_h
#include "CUDADataFormats/Common/interface/Product.h"
-#include "CUDADataFormats/Common/interface/HostProduct.h"
#include "CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DCUDA.h"
#include "DataFormats/Common/interface/Wrapper.h"
diff --git a/CUDADataFormats/TrackingRecHit/src/classes_def.xml b/CUDADataFormats/TrackingRecHit/src/classes_def.xml
index 02b0eb37d157b..7e1919de510b3 100644
--- a/CUDADataFormats/TrackingRecHit/src/classes_def.xml
+++ b/CUDADataFormats/TrackingRecHit/src/classes_def.xml
@@ -5,6 +5,4 @@
-
-
diff --git a/DataFormats/SiPixelDigi/interface/SiPixelDigisSoA.h b/DataFormats/SiPixelDigi/interface/SiPixelDigisSoA.h
index 50e863f03ff02..6c016155b1cb0 100644
--- a/DataFormats/SiPixelDigi/interface/SiPixelDigisSoA.h
+++ b/DataFormats/SiPixelDigi/interface/SiPixelDigisSoA.h
@@ -4,6 +4,12 @@
#include
#include
+// The main purpose of this class is to deliver digi and cluster data
+// from an EDProducer that transfers the data from GPU to host to an
+// EDProducer that converts the SoA to legacy data products. The class
+// is independent of any GPU technology, and in prunciple could be
+// produced by host code, and be used for other purposes than
+// conversion-to-legacy as well.
class SiPixelDigisSoA {
public:
SiPixelDigisSoA() = default;
@@ -24,10 +30,10 @@ class SiPixelDigisSoA {
const std::vector& clusVector() const { return clus_; }
private:
- std::vector pdigi_;
- std::vector rawIdArr_;
- std::vector adc_;
- std::vector clus_;
+ std::vector pdigi_; // packed digi (row, col, adc) of each pixel
+ std::vector rawIdArr_; // DetId of each pixel
+ std::vector adc_; // ADC of each pixel
+ std::vector clus_; // cluster id of each pixel
};
#endif
diff --git a/DataFormats/SiPixelDigi/src/SiPixelDigisSoA.cc b/DataFormats/SiPixelDigi/src/SiPixelDigisSoA.cc
index 992c98f450616..b95c004a50a25 100644
--- a/DataFormats/SiPixelDigi/src/SiPixelDigisSoA.cc
+++ b/DataFormats/SiPixelDigi/src/SiPixelDigisSoA.cc
@@ -7,6 +7,4 @@ SiPixelDigisSoA::SiPixelDigisSoA(
: pdigi_(pdigi, pdigi + nDigis),
rawIdArr_(rawIdArr, rawIdArr + nDigis),
adc_(adc, adc + nDigis),
- clus_(clus, clus + nDigis) {
- assert(pdigi_.size() == nDigis);
-}
+ clus_(clus, clus + nDigis) {}
diff --git a/DataFormats/SiPixelDigi/src/classes.h b/DataFormats/SiPixelDigi/src/classes.h
index ba68d3289e8cd..1360ee6e469d9 100644
--- a/DataFormats/SiPixelDigi/src/classes.h
+++ b/DataFormats/SiPixelDigi/src/classes.h
@@ -6,7 +6,6 @@
#include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigi.h"
#include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigiError.h"
#include "DataFormats/SiPixelDigi/interface/SiPixelDigisSoA.h"
-#include "DataFormats/SiPixelDigi/interface/SiPixelDigiErrorsSoA.h"
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/Common/interface/DetSetVectorNew.h"
diff --git a/DataFormats/SiPixelDigi/src/classes_def.xml b/DataFormats/SiPixelDigi/src/classes_def.xml
index 8cabbd3f3f06e..e6bc08de161fa 100755
--- a/DataFormats/SiPixelDigi/src/classes_def.xml
+++ b/DataFormats/SiPixelDigi/src/classes_def.xml
@@ -52,7 +52,4 @@
-
-
-
diff --git a/DataFormats/SiPixelRawData/interface/SiPixelErrorCompact.h b/DataFormats/SiPixelRawData/interface/SiPixelErrorCompact.h
new file mode 100644
index 0000000000000..0b1a80868594f
--- /dev/null
+++ b/DataFormats/SiPixelRawData/interface/SiPixelErrorCompact.h
@@ -0,0 +1,13 @@
+#ifndef DataFormats_SiPixelRawData_interface_SiPixelErrorCompact_h
+#define DataFormats_SiPixelRawData_interface_SiPixelErrorCompact_h
+
+#include
+
+struct SiPixelErrorCompact {
+ uint32_t rawId;
+ uint32_t word;
+ uint8_t errorType;
+ uint8_t fedId;
+};
+
+#endif // DataFormats_SiPixelRawData_interface_SiPixelErrorCompact_h
diff --git a/DataFormats/SiPixelRawData/interface/SiPixelErrorsSoA.h b/DataFormats/SiPixelRawData/interface/SiPixelErrorsSoA.h
new file mode 100644
index 0000000000000..c72c19ce5fda4
--- /dev/null
+++ b/DataFormats/SiPixelRawData/interface/SiPixelErrorsSoA.h
@@ -0,0 +1,30 @@
+#ifndef DataFormats_SiPixelDigi_interface_SiPixelErrorsSoA_h
+#define DataFormats_SiPixelDigi_interface_SiPixelErrorsSoA_h
+
+#include "DataFormats/SiPixelRawData/interface/SiPixelErrorCompact.h"
+#include "DataFormats/SiPixelRawData/interface/SiPixelFormatterErrors.h"
+
+#include
+#include
+
+class SiPixelErrorsSoA {
+public:
+ SiPixelErrorsSoA() = default;
+ explicit SiPixelErrorsSoA(size_t nErrors, const SiPixelErrorCompact *error, const SiPixelFormatterErrors *err)
+ : error_(error, error + nErrors), formatterErrors_(err) {}
+ ~SiPixelErrorsSoA() = default;
+
+ auto size() const { return error_.size(); }
+
+ const SiPixelFormatterErrors *formatterErrors() const { return formatterErrors_; }
+
+ const SiPixelErrorCompact &error(size_t i) const { return error_[i]; }
+
+ const std::vector &errorVector() const { return error_; }
+
+private:
+ std::vector error_;
+ const SiPixelFormatterErrors *formatterErrors_ = nullptr;
+};
+
+#endif
diff --git a/DataFormats/SiPixelRawData/interface/SiPixelFormatterErrors.h b/DataFormats/SiPixelRawData/interface/SiPixelFormatterErrors.h
new file mode 100644
index 0000000000000..9d372737300d4
--- /dev/null
+++ b/DataFormats/SiPixelRawData/interface/SiPixelFormatterErrors.h
@@ -0,0 +1,12 @@
+#ifndef DataFormats_SiPixelRawData_interface_SiPixelFormatterErrors_h
+#define DataFormats_SiPixelRawData_interface_SiPixelFormatterErrors_h
+
+#include