Skip to content
Merged
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
7 changes: 4 additions & 3 deletions Detectors/Raw/include/DetectorsRaw/RDHUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "GPUCommonRtypes.h"
#include "Headers/RAWDataHeader.h"
#include "Headers/RDHAny.h"

#include "GPUCommonTypeTraits.h"
#if !defined(GPUCA_GPUCODE)
#include "CommonDataFormat/InteractionRecord.h"
#endif
Expand All @@ -35,7 +35,7 @@ using LinkSubSpec_t = uint32_t;
struct RDHUtils {

// disable is the type is a pointer
#define NOTPTR(T) typename std::enable_if<!std::is_pointer<T>::value>::type* = 0
#define NOTPTR(T) typename std::enable_if<!std::is_pointer<GPUgeneric() T>::value>::type* = 0
// dereference SRC pointer as DST type reference
#define TOREF(DST, SRC) *reinterpret_cast<DST*>(SRC)
// dereference SRC pointer as DST type const reference
Expand Down Expand Up @@ -692,7 +692,8 @@ struct RDHUtils {
private:
static uint32_t fletcher32(const uint16_t* data, int len);
#if defined(GPUCA_GPUCODE_DEVICE) || defined(GPUCA_STANDALONE)
GPUhdi() static void processError(int v, const char* field)
template <typename T>
GPUhdi() static void processError(int v, const T* field)
{
}
#else
Expand Down
4 changes: 2 additions & 2 deletions Detectors/TPC/workflow/src/ZSSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <unistd.h>
#include "GPUParam.h"
#include "GPUReconstructionConvert.h"
#include "GPURawData.h"
#include "DetectorsRaw/RawFileWriter.h"
#include "DetectorsRaw/HBFUtils.h"
#include "DetectorsRaw/RDHUtils.h"
Expand All @@ -44,6 +43,7 @@
#include "DataFormatsParameters/GRPObject.h"
#include "DetectorsCommonDataFormats/NameConf.h"
#include "DataFormatsTPC/WorkflowHelper.h"
#include "DetectorsRaw/RDHUtils.h"

using namespace o2::framework;
using namespace o2::header;
Expand Down Expand Up @@ -124,7 +124,7 @@ DataProcessorSpec getZSEncoderSpec(std::vector<int> const& tpcSectors, bool outR
const auto grp = o2::parameters::GRPObject::loadFrom(inputGRP);
o2::raw::RawFileWriter writer{"TPC"}; // to set the RDHv6.sourceID if V6 is used
writer.setContinuousReadout(grp->isDetContinuousReadOut(o2::detectors::DetID::TPC)); // must be set explicitly
uint32_t rdhV = o2::raw::RDHUtils::getVersion<o2::gpu::RAWDataHeaderGPU>();
uint32_t rdhV = o2::raw::RDHUtils::getVersion<o2::header::RAWDataHeader>();
writer.useRDHVersion(rdhV);
std::string outDir = "./";
const unsigned int defaultLink = rdh_utils::UserLogicLinkID;
Expand Down
4 changes: 2 additions & 2 deletions Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "GPUReconstructionConvert.h"
#include "GPUHostDataTypes.h"
#include "GPUParam.h"
#include "GPURawData.h"

#include "Framework/Logger.h"
#include "DetectorsRaw/RawFileWriter.h"
Expand All @@ -43,6 +42,7 @@
#include "CommonUtils/ConfigurableParam.h"
#include "DataFormatsParameters/GRPObject.h"
#include "DetectorsCommonDataFormats/NameConf.h"
#include "DetectorsRaw/RDHUtils.h"

namespace bpo = boost::program_options;

Expand Down Expand Up @@ -226,7 +226,7 @@ int main(int argc, char** argv)
add_option("file-for,f", bpo::value<std::string>()->default_value("sector"), "single file per: link,sector,all");
add_option("stop-page,p", bpo::value<bool>()->default_value(false)->implicit_value(true), "HBF stop on separate CRU page");
add_option("no-padding", bpo::value<bool>()->default_value(false)->implicit_value(true), "Don't pad pages to 8kb");
uint32_t defRDH = o2::raw::RDHUtils::getVersion<o2::gpu::RAWDataHeaderGPU>();
uint32_t defRDH = o2::raw::RDHUtils::getVersion<o2::header::RAWDataHeader>();
add_option("hbfutils-config,u", bpo::value<std::string>()->default_value(std::string(o2::base::NameConf::DIGITIZATIONCONFIGFILE)), "config file for HBFUtils (or none)");
add_option("rdh-version,r", bpo::value<uint32_t>()->default_value(defRDH), "RDH version to use");
add_option("configKeyValues", bpo::value<std::string>()->default_value(""), "comma-separated configKeyValues");
Expand Down
50 changes: 50 additions & 0 deletions GPU/Common/GPUCommonTypeTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,56 @@ struct is_same<T, T> {
};
template <class T, class U>
static constexpr bool is_same_v = is_same<T, U>::value;
template <bool B, class T = void>
struct enable_if {
};
template <class T>
struct enable_if<true, T> {
typedef T type;
};
template <class T>
struct remove_cv {
typedef T type;
};
template <class T>
struct remove_cv<const T> {
typedef T type;
};
template <class T>
struct remove_cv<volatile T> {
typedef T type;
};
template <class T>
struct remove_cv<const volatile T> {
typedef T type;
};
template <class T>
struct remove_const {
typedef T type;
};
template <class T>
struct remove_const<const T> {
typedef T type;
};
template <class T>
struct remove_volatile {
typedef T type;
};
template <class T>
struct remove_volatile<volatile T> {
typedef T type;
};
template <class T>
struct is_pointer_t {
static constexpr bool value = false;
};
template <class T>
struct is_pointer_t<T*> {
static constexpr bool value = true;
};
template <class T>
struct is_pointer : is_pointer_t<typename std::remove_cv<T>::type> {
};
} // namespace std
#endif

Expand Down
30 changes: 15 additions & 15 deletions GPU/GPUTracking/Base/GPUReconstructionConvert.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
#include "clusterFinderDefs.h"
#include "DataFormatsTPC/ZeroSuppression.h"
#include "DataFormatsTPC/Constants.h"
#include "GPURawData.h"
#include "CommonConstants/LHCConstants.h"
#include "DataFormatsTPC/Digit.h"
#include "TPCBase/RDHUtils.h"
#include "DetectorsRaw/RDHUtils.h"
#endif

using namespace GPUCA_NAMESPACE::gpu;
Expand Down Expand Up @@ -153,13 +153,13 @@ int GPUReconstructionConvert::GetMaxTimeBin(const GPUTrackingInOutZS& zspages)
#ifdef HAVE_O2HEADERS
float retVal = 0;
for (unsigned int i = 0; i < NSLICES; i++) {
int firstHBF = zspages.slice[i].count[0] ? o2::raw::RDHUtils::getHeartBeatOrbit(*(const RAWDataHeaderGPU*)zspages.slice[i].zsPtr[0][0]) : 0;
int firstHBF = zspages.slice[i].count[0] ? o2::raw::RDHUtils::getHeartBeatOrbit(*(const o2::header::RAWDataHeader*)zspages.slice[i].zsPtr[0][0]) : 0;
for (unsigned int j = 0; j < GPUTrackingInOutZS::NENDPOINTS; j++) {
for (unsigned int k = 0; k < zspages.slice[i].count[j]; k++) {
const char* page = (const char*)zspages.slice[i].zsPtr[j][k];
for (unsigned int l = 0; l < zspages.slice[i].nZSPtr[j][k]; l++) {
RAWDataHeaderGPU* rdh = (RAWDataHeaderGPU*)(page + l * TPCZSHDR::TPC_ZS_PAGE_SIZE);
TPCZSHDR* hdr = (TPCZSHDR*)(page + l * TPCZSHDR::TPC_ZS_PAGE_SIZE + sizeof(RAWDataHeaderGPU));
o2::header::RAWDataHeader* rdh = (o2::header::RAWDataHeader*)(page + l * TPCZSHDR::TPC_ZS_PAGE_SIZE);
TPCZSHDR* hdr = (TPCZSHDR*)(page + l * TPCZSHDR::TPC_ZS_PAGE_SIZE + sizeof(o2::header::RAWDataHeader));
unsigned int timeBin = (hdr->timeOffset + (o2::raw::RDHUtils::getHeartBeatOrbit(*rdh) - firstHBF) * o2::constants::lhc::LHCMaxBunches) / LHCBCPERTIMEBIN + hdr->nTimeBins;
if (timeBin > retVal) {
retVal = timeBin;
Expand Down Expand Up @@ -196,11 +196,11 @@ void GPUReconstructionConvert::ZSstreamOut(unsigned short* bufIn, unsigned int&
#ifdef HAVE_O2HEADERS
void GPUReconstructionConvert::ZSfillEmpty(void* ptr, int shift, unsigned int feeId, int orbit)
{
RAWDataHeaderGPU* rdh = (RAWDataHeaderGPU*)ptr;
o2::header::RAWDataHeader* rdh = (o2::header::RAWDataHeader*)ptr;
o2::raw::RDHUtils::setHeartBeatOrbit(*rdh, orbit);
o2::raw::RDHUtils::setHeartBeatBC(*rdh, shift);
o2::raw::RDHUtils::setMemorySize(*rdh, sizeof(RAWDataHeaderGPU));
o2::raw::RDHUtils::setVersion(*rdh, o2::raw::RDHUtils::getVersion<o2::gpu::RAWDataHeaderGPU>());
o2::raw::RDHUtils::setMemorySize(*rdh, sizeof(o2::header::RAWDataHeader));
o2::raw::RDHUtils::setVersion(*rdh, o2::raw::RDHUtils::getVersion<o2::header::RAWDataHeader>());
o2::raw::RDHUtils::setFEEID(*rdh, feeId);
}

Expand Down Expand Up @@ -355,15 +355,15 @@ void GPUReconstructionConvert::RunZSEncoder(const S& in, std::unique_ptr<unsigne
if (raw) {
size_t size = (padding || lastEndpoint == -1) ? TPCZSHDR::TPC_ZS_PAGE_SIZE : (pagePtr - (unsigned char*)page);
size = CAMath::nextMultipleOf<o2::raw::RDHUtils::GBTWord>(size);
raw->addData(rawfeeid, rawcru, rawlnk, rawendpoint, *ir + (hbf - orbitShift) * o2::constants::lhc::LHCMaxBunches, gsl::span<char>((char*)page + sizeof(RAWDataHeaderGPU), (char*)page + size), true);
raw->addData(rawfeeid, rawcru, rawlnk, rawendpoint, *ir + (hbf - orbitShift) * o2::constants::lhc::LHCMaxBunches, gsl::span<char>((char*)page + sizeof(o2::header::RAWDataHeader), (char*)page + size), true);
} else
#endif
{
RAWDataHeaderGPU* rdh = (RAWDataHeaderGPU*)page;
o2::header::RAWDataHeader* rdh = (o2::header::RAWDataHeader*)page;
o2::raw::RDHUtils::setHeartBeatOrbit(*rdh, hbf);
o2::raw::RDHUtils::setHeartBeatBC(*rdh, bcShiftInFirstHBF);
o2::raw::RDHUtils::setMemorySize(*rdh, TPCZSHDR::TPC_ZS_PAGE_SIZE);
o2::raw::RDHUtils::setVersion(*rdh, o2::raw::RDHUtils::getVersion<o2::gpu::RAWDataHeaderGPU>());
o2::raw::RDHUtils::setVersion(*rdh, o2::raw::RDHUtils::getVersion<o2::header::RAWDataHeader>());
o2::raw::RDHUtils::setFEEID(*rdh, rawfeeid);
}
}
Expand All @@ -387,7 +387,7 @@ void GPUReconstructionConvert::RunZSEncoder(const S& in, std::unique_ptr<unsigne
hbf = nexthbf;
pagePtr = reinterpret_cast<unsigned char*>(page);
std::fill(page->begin(), page->end(), 0);
pagePtr += sizeof(RAWDataHeaderGPU);
pagePtr += sizeof(o2::header::RAWDataHeader);
hdr = reinterpret_cast<TPCZSHDR*>(pagePtr);
pagePtr += sizeof(*hdr);
hdr->version = zs12bit ? 2 : 1;
Expand Down Expand Up @@ -450,15 +450,15 @@ void GPUReconstructionConvert::RunZSEncoder(const S& in, std::unique_ptr<unsigne
std::vector<o2::tpc::Digit> compareBuffer;
compareBuffer.reserve(tmpBuffer.size());
for (unsigned int j = 0; j < GPUTrackingInOutZS::NENDPOINTS; j++) {
unsigned int firstOrbit = o2::raw::RDHUtils::getHeartBeatOrbit(*(const RAWDataHeaderGPU*)buffer[i][j].data());
unsigned int firstOrbit = o2::raw::RDHUtils::getHeartBeatOrbit(*(const o2::header::RAWDataHeader*)buffer[i][j].data());
for (unsigned int k = 0; k < buffer[i][j].size(); k++) {
page = &buffer[i][j][k];
pagePtr = reinterpret_cast<unsigned char*>(page);
const RAWDataHeaderGPU* rdh = (const RAWDataHeaderGPU*)pagePtr;
if (o2::raw::RDHUtils::getMemorySize(*rdh) == sizeof(RAWDataHeaderGPU)) {
const o2::header::RAWDataHeader* rdh = (const o2::header::RAWDataHeader*)pagePtr;
if (o2::raw::RDHUtils::getMemorySize(*rdh) == sizeof(o2::header::RAWDataHeader)) {
continue;
}
pagePtr += sizeof(RAWDataHeaderGPU);
pagePtr += sizeof(o2::header::RAWDataHeader);
hdr = reinterpret_cast<TPCZSHDR*>(pagePtr);
pagePtr += sizeof(*hdr);
if (hdr->version != 1 && hdr->version != 2) {
Expand Down
7 changes: 4 additions & 3 deletions GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
#pragma OPENCL EXTENSION cl_khr_fp64 : enable // Allow double precision variables
#pragma OPENCL EXTENSION cl_khr_fp16 : enable // Allow half precision
#ifdef __clang__
#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable //
#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable // Allow function pointers
#pragma OPENCL EXTENSION __cl_clang_allow_unsafe_kernel_parameters : enable // Allow pointers to non-standard types as kernel arguments
#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable //
#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable // Allow function pointers
#pragma OPENCL EXTENSION __cl_clang_non_portable_kernel_param_types : enable // Allow pointers to non-standard types as kernel arguments
#pragma OPENCL EXTENSION __cl_clang_bitfields : enable // Allow usage of bitfields
#define global __global
#define local __local
#define constant __constant
Expand Down
4 changes: 2 additions & 2 deletions GPU/GPUTracking/Base/opencl2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endif()
set(CL_SRC ${GPUDIR}/Base/opencl-common/GPUReconstructionOCL.cl)
set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCL2Code)

set(OCL_FLAGS -Xclang -fdenormal-fp-math-f32=ieee -cl-mad-enable -cl-no-signed-zeros -ferror-limit=1000 -Xclang -finclude-default-header -Dcl_clang_storage_class_specifiers -Wno-invalid-constexpr -Wno-unused-command-line-argument -cl-std=clc++)
set(OCL_FLAGS -Xclang -fdenormal-fp-math-f32=ieee -cl-mad-enable -cl-no-signed-zeros -ferror-limit=1000 -Dcl_clang_storage_class_specifiers -Wno-invalid-constexpr -Wno-unused-command-line-argument -cl-std=clc++)
set(OCL_DEFINECL "-D$<JOIN:$<TARGET_PROPERTY:O2::GPUTracking,COMPILE_DEFINITIONS>,$<SEMICOLON>-D>"
"-I$<JOIN:$<FILTER:$<TARGET_PROPERTY:O2::GPUTracking,INCLUDE_DIRECTORIES>,EXCLUDE,^/usr/include/?>,$<SEMICOLON>-I>"
-I${CMAKE_SOURCE_DIR}/Detectors/TRD/base/src
Expand Down Expand Up @@ -124,7 +124,7 @@ if(OPENCL2_ENABLED) # BUILD OpenCL2 source code for runtime compilation target
add_custom_command(
OUTPUT ${CL_BIN}.src
COMMAND clang
${OCL_DEFINECL}
${OCL_DEFINECL} -cl-no-stdinc
-E ${CL_SRC} > ${CL_BIN}.src
MAIN_DEPENDENCY ${CL_SRC}
IMPLICIT_DEPENDS CXX ${CL_SRC}
Expand Down
1 change: 0 additions & 1 deletion GPU/GPUTracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ set(HDRS_INSTALL
DataTypes/GPUOutputControl.h
DataTypes/GPUO2DataTypes.h
DataTypes/GPUHostDataTypes.h
DataTypes/GPURawData.h
DataTypes/GPUdEdxInfo.h
DataTypes/GPUTRDInterfaceO2Track.h
Base/GPUParam.inc
Expand Down
82 changes: 0 additions & 82 deletions GPU/GPUTracking/DataTypes/GPURawData.h

This file was deleted.

Loading