From e80dcf55b76e6de2bacdbcece36ebe681e061b42 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 7 Dec 2018 10:40:34 -0600 Subject: [PATCH] Require allocated type to have only a trivial constructor for make_device_unique and make_host_unique (#204) --- .../SiPixelCluster/interface/SiPixelClustersCUDA.h | 10 +++++----- .../SiPixelDigi/interface/SiPixelDigisCUDA.h | 8 ++++---- .../plugins/SiPixelRawToClusterGPUKernel.cu | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h b/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h index 22d9ff9d103ba..ca8a75d178b6c 100644 --- a/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h +++ b/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h @@ -49,11 +49,11 @@ class SiPixelClustersCUDA { friend SiPixelClustersCUDA; private: - uint32_t const *moduleStart_ = nullptr; - int32_t const *clus_ = nullptr; - uint32_t const *clusInModule_ = nullptr; - uint32_t const *moduleId_ = nullptr; - uint32_t const *clusModuleStart_ = nullptr; + uint32_t const *moduleStart_; + int32_t const *clus_; + uint32_t const *clusInModule_; + uint32_t const *moduleId_; + uint32_t const *clusModuleStart_; }; DeviceConstView *view() const { return view_d.get(); } diff --git a/CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h b/CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h index 25e8b54a743c2..66ca680effd19 100644 --- a/CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h +++ b/CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h @@ -46,10 +46,10 @@ class SiPixelDigisCUDA { friend class SiPixelDigisCUDA; private: - uint16_t const *xx_ = nullptr; - uint16_t const *yy_ = nullptr; - uint16_t const *adc_ = nullptr; - uint16_t const *moduleInd_ = nullptr; + uint16_t const *xx_; + uint16_t const *yy_; + uint16_t const *adc_; + uint16_t const *moduleInd_; }; const DeviceConstView *view() const { return view_d.get(); } diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.cu b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.cu index d39662f5ee955..c3f4292d4c4c4 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.cu +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.cu @@ -432,7 +432,7 @@ namespace pixelgpudetails { if (includeErrors and skipROC) { uint32_t rID = getErrRawID(fedId, ww, errorType, cablingMap, debug); - err->emplace_back(rID, ww, errorType, fedId); + err->push_back(pixelgpudetails::error_obj{rID, ww, errorType, fedId}); continue; } @@ -476,7 +476,7 @@ namespace pixelgpudetails { if (includeErrors) { if (not rocRowColIsValid(row, col)) { uint32_t error = conversionError(fedId, 3, debug); //use the device function and fill the arrays - err->emplace_back(rawId, ww, error, fedId); + err->push_back(pixelgpudetails::error_obj{rawId, ww, error, fedId}); if(debug) printf("BPIX1 Error status: %i\n", error); continue; } @@ -491,7 +491,7 @@ namespace pixelgpudetails { localPix.col = col; if (includeErrors and not dcolIsValid(dcol, pxid)) { uint32_t error = conversionError(fedId, 3, debug); - err->emplace_back(rawId, ww, error, fedId); + err->push_back(pixelgpudetails::error_obj{rawId, ww, error, fedId}); if(debug) printf("Error status: %i %d %d %d %d\n", error, dcol, pxid, fedId, roc); continue; } @@ -541,7 +541,7 @@ namespace pixelgpudetails { auto data_d = cs->make_device_unique(MAX_FED_WORDS, stream); cudaCheck(cudaMemsetAsync(data_d.get(), 0x00, MAX_ERROR_SIZE, stream.id())); auto error_h_tmp = cs->make_host_unique>(stream); - new (error_h_tmp.get()) GPU::SimpleVector(MAX_FED_WORDS, data_d.get()); // should make_host_unique() call the constructor as well? note that even if std::make_unique does that, we can't do that in make_device_unique + GPU::make_SimpleVector(error_h_tmp.get(), MAX_FED_WORDS, data_d.get()); assert(error_h_tmp->size() == 0); assert(error_h_tmp->capacity() == static_cast(MAX_FED_WORDS)); @@ -579,7 +579,7 @@ namespace pixelgpudetails { if (includeErrors) { digis_clusters_h.data = cs->make_host_unique(MAX_FED_WORDS, stream); digis_clusters_h.error = cs->make_host_unique>(stream); - new (digis_clusters_h.error.get()) GPU::SimpleVector(MAX_FED_WORDS, digis_clusters_h.data.get()); + GPU::make_SimpleVector(digis_clusters_h.error.get(), MAX_FED_WORDS, digis_clusters_h.data.get()); assert(digis_clusters_h.error->size() == 0); assert(digis_clusters_h.error->capacity() == static_cast(MAX_FED_WORDS));