CMS 3D CMS Logo

SoACommon.h
Go to the documentation of this file.
1 #ifndef DataFormats_SoATemplate_interface_SoACommon_h
2 #define DataFormats_SoATemplate_interface_SoACommon_h
3 
4 /*
5  * Definitions of SoA common parameters for SoA class generators
6  */
7 
8 #include <cstdint>
9 #include <cassert>
10 #include <ostream>
11 #include <tuple>
12 #include <type_traits>
13 
14 #include <boost/preprocessor.hpp>
15 
17 
18 // CUDA attributes
19 #if defined(__CUDACC__) || defined(__HIPCC__)
20 #define SOA_HOST_ONLY __host__
21 #define SOA_DEVICE_ONLY __device__
22 #define SOA_HOST_DEVICE __host__ __device__
23 #define SOA_INLINE __forceinline__
24 #else
25 #define SOA_HOST_ONLY
26 #define SOA_DEVICE_ONLY
27 #define SOA_HOST_DEVICE
28 #define SOA_INLINE inline __attribute__((always_inline))
29 #endif
30 
31 // Exception throwing (or willful crash in kernels)
32 #if defined(__CUDACC__) && defined(__CUDA_ARCH__)
33 #define SOA_THROW_OUT_OF_RANGE(A) \
34  { \
35  printf("%s\n", (A)); \
36  __trap(); \
37  }
38 #elif defined(__HIPCC__) && defined(__HIP_DEVICE_COMPILE__)
39 #define SOA_THROW_OUT_OF_RANGE(A) \
40  { \
41  printf("%s\n", (A)); \
42  abort(); \
43  }
44 #else
45 #define SOA_THROW_OUT_OF_RANGE(A) \
46  { throw std::out_of_range(A); }
47 #endif
48 
49 /* declare "scalars" (one value shared across the whole SoA) and "columns" (one value per element) */
50 #define _VALUE_TYPE_SCALAR 0
51 #define _VALUE_TYPE_COLUMN 1
52 #define _VALUE_TYPE_EIGEN_COLUMN 2
53 
54 /* The size type need to be "hardcoded" in the template parameters for classes serialized by ROOT */
55 /* In practice, using a typedef as a template parameter to the Layout or its ViewTemplateFreeParams member
56  * declaration fails ROOT dictionary generation. */
57 #define CMS_SOA_BYTE_SIZE_TYPE std::size_t
58 
59 namespace cms::soa {
60 
61  // size_type for indices. Compatible with ROOT Int_t, but limited to 2G entries
63  // byte_size_type for byte counts. Not creating an artificial limit (and not ROOT serialized).
65 
66  enum class SoAColumnType {
70  };
71 
72  namespace RestrictQualify {
73  constexpr bool enabled = true;
74  constexpr bool disabled = false;
76  } // namespace RestrictQualify
77 
78  namespace RangeChecking {
79  constexpr bool enabled = true;
80  constexpr bool disabled = false;
82  } // namespace RangeChecking
83 
84  template <typename T, bool RESTRICT_QUALIFY>
85  struct add_restrict {};
86 
87  template <typename T>
88  struct add_restrict<T, RestrictQualify::enabled> {
89  using Value = T;
90  using Pointer = T* __restrict__;
91  using Reference = T& __restrict__;
92  using ConstValue = const T;
93  using PointerToConst = const T* __restrict__;
94  using ReferenceToConst = const T& __restrict__;
95  };
96 
97  template <typename T>
98  struct add_restrict<T, RestrictQualify::disabled> {
99  using Value = T;
100  using Pointer = T*;
101  using Reference = T&;
102  using ConstValue = const T;
103  using PointerToConst = const T*;
104  using ReferenceToConst = const T&;
105  };
106 
107  // Forward declarations
108  template <SoAColumnType COLUMN_TYPE, typename T>
110 
111  template <SoAColumnType COLUMN_TYPE, typename T>
113 
114  // Templated const parameter sets for scalars, columns and Eigen columns
115  template <SoAColumnType COLUMN_TYPE, typename T>
116  struct SoAConstParametersImpl {
117  static constexpr SoAColumnType columnType = COLUMN_TYPE;
118 
119  using ValueType = T;
120  using ScalarType = T;
122 
123  // default constructor
124  SoAConstParametersImpl() = default;
125 
126  // constructor from an address
128 
129  // constructor from a non-const parameter set
131  : addr_{o.addr_} {}
132 
133  static constexpr bool checkAlignment(ValueType* addr, byte_size_type alignment) {
134  return reinterpret_cast<intptr_t>(addr) % alignment;
135  }
136 
138 
139  public:
140  // scalar or column
141  ValueType const* addr_ = nullptr;
142  };
143 
144  // Templated const parameter specialisation for Eigen columns
145  template <typename T>
148 
149  using ValueType = T;
150  using ScalarType = typename T::Scalar;
151  using TupleOrPointerType = std::tuple<ScalarType*, byte_size_type>;
152 
153  // default constructor
154  SoAConstParametersImpl() = default;
155 
156  // constructor from individual address and stride
158  : addr_(addr), stride_(stride) {}
159 
160  // constructor from address and stride packed in a tuple
162  : addr_(std::get<0>(tuple)), stride_(std::get<1>(tuple)) {}
163 
164  // constructor from a non-const parameter set
166  : addr_{o.addr_}, stride_{o.stride_} {}
167 
168  static constexpr bool checkAlignment(TupleOrPointerType const& tuple, byte_size_type alignment) {
169  const auto& [addr, stride] = tuple;
170  return reinterpret_cast<intptr_t>(addr) % alignment;
171  }
172 
173  TupleOrPointerType tupleOrPointer() { return {addr_, stride_}; }
174 
175  public:
176  // address and stride
177  ScalarType const* addr_ = nullptr;
178  byte_size_type stride_ = 0;
179  };
180 
181  // Matryoshka template to avoid commas inside macros
182  template <SoAColumnType COLUMN_TYPE>
184  template <typename T>
186  };
187 
188  // Templated parameter sets for scalars, columns and Eigen columns
189  template <SoAColumnType COLUMN_TYPE, typename T>
190  struct SoAParametersImpl {
191  static constexpr SoAColumnType columnType = COLUMN_TYPE;
192 
193  using ValueType = T;
194  using ScalarType = T;
196 
198  friend ConstType;
199 
200  // default constructor
201  SoAParametersImpl() = default;
202 
203  // constructor from an address
205 
207  return reinterpret_cast<intptr_t>(addr) % alignment;
208  }
209 
211 
212  public:
213  // scalar or column
214  ValueType* addr_ = nullptr;
215  };
216 
217  // Templated parameter specialisation for Eigen columns
218  template <typename T>
221 
222  using ValueType = T;
223  using ScalarType = typename T::Scalar;
224  using TupleOrPointerType = std::tuple<ScalarType*, byte_size_type>;
225 
227  friend ConstType;
228 
229  // default constructor
230  SoAParametersImpl() = default;
231 
232  // constructor from individual address and stride
234  : addr_(addr), stride_(stride) {}
235 
236  // constructor from address and stride packed in a tuple
238  : addr_(std::get<0>(tuple)), stride_(std::get<1>(tuple)) {}
239 
241  const auto& [addr, stride] = tuple;
242  return reinterpret_cast<intptr_t>(addr) % alignment;
243  }
244 
245  TupleOrPointerType tupleOrPointer() { return {addr_, stride_}; }
246 
247  public:
248  // address and stride
249  ScalarType* addr_ = nullptr;
250  byte_size_type stride_ = 0;
251  };
252 
253  // Matryoshka template to avoid commas inside macros
254  template <SoAColumnType COLUMN_TYPE>
256  template <typename T>
258  };
259 
260  // Helper converting a const parameter set to a non-const parameter set, to be used only in the constructor of non-const "element"
261  namespace {
262  template <typename T>
263  constexpr inline std::remove_const_t<T>* non_const_ptr(T* p) {
264  return const_cast<std::remove_const_t<T>*>(p);
265  }
266  } // namespace
267 
268  template <SoAColumnType COLUMN_TYPE, typename T>
271  return SoAParametersImpl<COLUMN_TYPE, T>{non_const_ptr(o.addr_)};
272  }
273 
274  template <typename T>
277  return SoAParametersImpl<SoAColumnType::eigen, T>{non_const_ptr(o.addr_), o.stride_};
278  }
279 
280  // Helper template managing the value at index idx within a column.
281  // The optional compile time alignment parameter enables informing the
282  // compiler of alignment (enforced by caller).
283  template <SoAColumnType COLUMN_TYPE,
284  typename T,
285  byte_size_type ALIGNMENT,
286  bool RESTRICT_QUALIFY = RestrictQualify::disabled>
287  class SoAValue {
288  // Eigen is implemented in a specialization
289  static_assert(COLUMN_TYPE != SoAColumnType::eigen);
290 
291  public:
293  using Val = typename Restr::Value;
294  using Ptr = typename Restr::Pointer;
295  using Ref = typename Restr::Reference;
296  using PtrToConst = typename Restr::PointerToConst;
297  using RefToConst = typename Restr::ReferenceToConst;
298 
300 
302  : idx_(i), col_(params.addr_) {}
303 
305  // Ptr type will add the restrict qualifyer if needed
306  Ptr col = col_;
307  return col[idx_];
308  }
309 
310  SOA_HOST_DEVICE SOA_INLINE RefToConst operator()() const {
311  // PtrToConst type will add the restrict qualifyer if needed
312  PtrToConst col = col_;
313  return col[idx_];
314  }
315 
317 
319 
320  /* This was an attempt to implement the syntax
321  *
322  * old_value = view.x
323  * view.x = new_value
324  *
325  * instead of
326  *
327  * old_value = view.x()
328  * view.x() = new_value
329  *
330  * but it was found to break in some corner cases.
331  * We keep them commented out for the time being.
332 
333  SOA_HOST_DEVICE SOA_INLINE operator T&() { return col_[idx_]; }
334 
335  template <typename T2>
336  SOA_HOST_DEVICE SOA_INLINE Ref operator=(const T2& v) {
337  return col_[idx_] = v;
338  }
339  */
340 
341  using valueType = Val;
342 
343  static constexpr auto valueSize = sizeof(T);
344 
345  private:
347  T* col_;
348  };
349 
350  // Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.
351 #ifdef EIGEN_WORLD_VERSION
352  // Helper template managing an Eigen-type value at index idx within a column.
353  template <class C, byte_size_type ALIGNMENT, bool RESTRICT_QUALIFY>
354  class SoAValue<SoAColumnType::eigen, C, ALIGNMENT, RESTRICT_QUALIFY> {
355  public:
356  using Type = C;
357  using MapType = Eigen::Map<C, 0, Eigen::InnerStride<Eigen::Dynamic>>;
358  using CMapType = const Eigen::Map<const C, 0, Eigen::InnerStride<Eigen::Dynamic>>;
360  using Val = typename Restr::Value;
361  using Ptr = typename Restr::Pointer;
362  using Ref = typename Restr::Reference;
363  using PtrToConst = typename Restr::PointerToConst;
364  using RefToConst = typename Restr::ReferenceToConst;
365 
367  : val_(col + i, C::RowsAtCompileTime, C::ColsAtCompileTime, Eigen::InnerStride<Eigen::Dynamic>(stride)),
368  crCol_(col),
369  cVal_(crCol_ + i, C::RowsAtCompileTime, C::ColsAtCompileTime, Eigen::InnerStride<Eigen::Dynamic>(stride)),
370  stride_(stride) {}
371 
372  SOA_HOST_DEVICE SOA_INLINE SoAValue(size_type i, SoAParametersImpl<SoAColumnType::eigen, C> params)
373  : val_(params.addr_ + i,
374  C::RowsAtCompileTime,
375  C::ColsAtCompileTime,
376  Eigen::InnerStride<Eigen::Dynamic>(params.stride_)),
377  crCol_(params.addr_),
378  cVal_(crCol_ + i,
379  C::RowsAtCompileTime,
380  C::ColsAtCompileTime,
381  Eigen::InnerStride<Eigen::Dynamic>(params.stride_)),
382  stride_(params.stride_) {}
383 
384  SOA_HOST_DEVICE SOA_INLINE MapType& operator()() { return val_; }
385 
386  SOA_HOST_DEVICE SOA_INLINE const CMapType& operator()() const { return cVal_; }
387 
388  SOA_HOST_DEVICE SOA_INLINE operator C() { return val_; }
389 
390  SOA_HOST_DEVICE SOA_INLINE operator const C() const { return cVal_; }
391 
392  SOA_HOST_DEVICE SOA_INLINE C* operator&() { return &val_; }
393 
394  SOA_HOST_DEVICE SOA_INLINE const C* operator&() const { return &cVal_; }
395 
396  template <class C2>
397  SOA_HOST_DEVICE SOA_INLINE MapType& operator=(const C2& v) {
398  return val_ = v;
399  }
400 
401  using ValueType = typename C::Scalar;
402  static constexpr auto valueSize = sizeof(typename C::Scalar);
403  SOA_HOST_DEVICE SOA_INLINE byte_size_type stride() const { return stride_; }
404 
405  private:
406  MapType val_;
407  const Ptr crCol_;
408  CMapType cVal_;
409  byte_size_type stride_;
410  };
411 #else
412  // Raise a compile-time error
413  template <class C, byte_size_type ALIGNMENT, bool RESTRICT_QUALIFY>
414  class SoAValue<SoAColumnType::eigen, C, ALIGNMENT, RESTRICT_QUALIFY> {
415  static_assert(!sizeof(C),
416  "Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.");
417  };
418 #endif
419 
420  // Helper template managing a const value at index idx within a column.
421  template <SoAColumnType COLUMN_TYPE,
422  typename T,
423  byte_size_type ALIGNMENT,
424  bool RESTRICT_QUALIFY = RestrictQualify::disabled>
426  // Eigen is implemented in a specialization
427  static_assert(COLUMN_TYPE != SoAColumnType::eigen);
428 
429  public:
431  using Val = typename Restr::Value;
432  using Ptr = typename Restr::Pointer;
433  using Ref = typename Restr::Reference;
434  using PtrToConst = typename Restr::PointerToConst;
435  using RefToConst = typename Restr::ReferenceToConst;
438 
440 
442  : idx_(i), col_(params.addr_) {}
443 
445  : idx_(i), col_(params.addr_) {}
446 
447  SOA_HOST_DEVICE SOA_INLINE RefToConst operator()() const {
448  // Ptr type will add the restrict qualifyer if needed
449  PtrToConst col = col_;
450  return col[idx_];
451  }
452 
453  SOA_HOST_DEVICE SOA_INLINE const T* operator&() const { return &col_[idx_]; }
454 
455  /* This was an attempt to implement the syntax
456  *
457  * old_value = view.x
458  *
459  * instead of
460  *
461  * old_value = view.x()
462  *
463  * but it was found to break in some corner cases.
464  * We keep them commented out for the time being.
465 
466  SOA_HOST_DEVICE SOA_INLINE operator T&() { return col_[idx_]; }
467  */
468 
469  using valueType = T;
470  static constexpr auto valueSize = sizeof(T);
471 
472  private:
474  const T* col_;
475  };
476 
477  // Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.
478 #ifdef EIGEN_WORLD_VERSION
479  // Helper template managing a const Eigen-type value at index idx within a column.
480  template <class C, byte_size_type ALIGNMENT, bool RESTRICT_QUALIFY>
481  class SoAConstValue<SoAColumnType::eigen, C, ALIGNMENT, RESTRICT_QUALIFY> {
482  public:
483  using Type = C;
484  using CMapType = Eigen::Map<const C, 0, Eigen::InnerStride<Eigen::Dynamic>>;
485  using RefToConst = const CMapType&;
487 
489  : crCol_(col),
490  cVal_(crCol_ + i, C::RowsAtCompileTime, C::ColsAtCompileTime, Eigen::InnerStride<Eigen::Dynamic>(stride)),
491  stride_(stride) {}
492 
493  SOA_HOST_DEVICE SOA_INLINE SoAConstValue(size_type i, SoAConstParametersImpl<SoAColumnType::eigen, C> params)
494  : crCol_(params.addr_),
495  cVal_(crCol_ + i,
496  C::RowsAtCompileTime,
497  C::ColsAtCompileTime,
498  Eigen::InnerStride<Eigen::Dynamic>(params.stride_)),
499  stride_(params.stride_) {}
500 
501  SOA_HOST_DEVICE SOA_INLINE const CMapType& operator()() const { return cVal_; }
502 
503  SOA_HOST_DEVICE SOA_INLINE operator const C() const { return cVal_; }
504 
505  SOA_HOST_DEVICE SOA_INLINE const C* operator&() const { return &cVal_; }
506 
507  using ValueType = typename C::Scalar;
508  static constexpr auto valueSize = sizeof(typename C::Scalar);
509 
510  SOA_HOST_DEVICE SOA_INLINE byte_size_type stride() const { return stride_; }
511 
512  private:
513  const typename C::Scalar* __restrict__ crCol_;
514  CMapType cVal_;
515  byte_size_type stride_;
516  };
517 #else
518  // Raise a compile-time error
519  template <class C, byte_size_type ALIGNMENT, bool RESTRICT_QUALIFY>
520  class SoAConstValue<SoAColumnType::eigen, C, ALIGNMENT, RESTRICT_QUALIFY> {
521  static_assert(!sizeof(C),
522  "Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.");
523  };
524 #endif
525 
526  // Helper template to avoid commas inside macros
527 #ifdef EIGEN_WORLD_VERSION
528  template <class C>
529  struct EigenConstMapMaker {
530  using Type = Eigen::Map<const C, Eigen::AlignmentType::Unaligned, Eigen::InnerStride<Eigen::Dynamic>>;
531 
532  class DataHolder {
533  public:
534  DataHolder(const typename C::Scalar* data) : data_(data) {}
535 
538  data_, C::RowsAtCompileTime, C::ColsAtCompileTime, Eigen::InnerStride<Eigen::Dynamic>(stride));
539  }
540 
541  private:
542  const typename C::Scalar* const data_;
543  };
544 
545  static DataHolder withData(const typename C::Scalar* data) { return DataHolder(data); }
546  };
547 #else
548  template <class C>
550  // Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.
551  static_assert(!sizeof(C),
552  "Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.");
553  };
554 #endif
555 
556  // Helper function to compute aligned size
558  return ((size + alignment - 1) / alignment) * alignment;
559  }
560 
561 } // namespace cms::soa
562 
563 #define SOA_SCALAR(TYPE, NAME) (_VALUE_TYPE_SCALAR, TYPE, NAME)
564 #define SOA_COLUMN(TYPE, NAME) (_VALUE_TYPE_COLUMN, TYPE, NAME)
565 #define SOA_EIGEN_COLUMN(TYPE, NAME) (_VALUE_TYPE_EIGEN_COLUMN, TYPE, NAME)
566 
567 /* Iterate on the macro MACRO and return the result as a comma separated list */
568 #define _ITERATE_ON_ALL_COMMA(MACRO, DATA, ...) \
569  BOOST_PP_TUPLE_ENUM(BOOST_PP_SEQ_TO_TUPLE(_ITERATE_ON_ALL(MACRO, DATA, __VA_ARGS__)))
570 
571 /* Iterate MACRO on all elements */
572 #define _ITERATE_ON_ALL(MACRO, DATA, ...) BOOST_PP_SEQ_FOR_EACH(MACRO, DATA, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__))
573 
574 /* Switch on macros depending on scalar / column type */
575 #define _SWITCH_ON_TYPE(VALUE_TYPE, IF_SCALAR, IF_COLUMN, IF_EIGEN_COLUMN) \
576  BOOST_PP_IF( \
577  BOOST_PP_EQUAL(VALUE_TYPE, _VALUE_TYPE_SCALAR), \
578  IF_SCALAR, \
579  BOOST_PP_IF( \
580  BOOST_PP_EQUAL(VALUE_TYPE, _VALUE_TYPE_COLUMN), \
581  IF_COLUMN, \
582  BOOST_PP_IF(BOOST_PP_EQUAL(VALUE_TYPE, _VALUE_TYPE_EIGEN_COLUMN), IF_EIGEN_COLUMN, BOOST_PP_EMPTY())))
583 
584 namespace cms::soa {
585 
586  /* Column accessors: templates implementing the global accesors (soa::x() and soa::x(index) */
588 
589  template <typename, SoAColumnType, SoAAccessType, byte_size_type, bool>
591 
592  // TODO from Eric Cano:
593  // - add alignment support
594  // - SFINAE-based const/non const variants
595 
596  // Column
597  template <typename T, byte_size_type alignment, bool restrictQualify>
600  : params_(params) {}
601  SOA_HOST_DEVICE SOA_INLINE T* operator()() { return params_.addr_; }
603  using ParamReturnType = T&;
604  SOA_HOST_DEVICE SOA_INLINE T& operator()(size_type index) { return params_.addr_[index]; }
605 
606  private:
608  };
609 
610  // Const column
611  template <typename T, byte_size_type alignment, bool restrictQualify>
614  : params_(params) {}
615  SOA_HOST_DEVICE SOA_INLINE const T* operator()() const { return params_.addr_; }
616  using NoParamReturnType = const T*;
617  using ParamReturnType = const T&;
618  SOA_HOST_DEVICE SOA_INLINE T const& operator()(size_type index) const { return params_.addr_[index]; }
619 
620  private:
622  };
623 
624  // Scalar
625  template <typename T, byte_size_type alignment, bool restrictQualify>
628  : params_(params) {}
629  SOA_HOST_DEVICE SOA_INLINE T& operator()() { return *params_.addr_; }
632  SOA_HOST_DEVICE SOA_INLINE void operator()(size_type index) const {
633  assert(false && "Indexed access impossible for SoA scalars.");
634  }
635 
636  private:
638  };
639 
640  // Const scalar
641  template <typename T, byte_size_type alignment, bool restrictQualify>
644  : params_(params) {}
645  SOA_HOST_DEVICE SOA_INLINE T const& operator()() const { return *params_.addr_; }
646  using NoParamReturnType = T const&;
648  SOA_HOST_DEVICE SOA_INLINE void operator()(size_type index) const {
649  assert(false && "Indexed access impossible for SoA scalars.");
650  }
651 
652  private:
654  };
655 
656  // Eigen-type
657  template <typename T, byte_size_type alignment, bool restrictQualify>
660  : params_(params) {}
661  SOA_HOST_DEVICE SOA_INLINE typename T::Scalar* operator()() { return params_.addr_; }
662  using NoParamReturnType = typename T::Scalar*;
666  }
667 
668  private:
670  };
671 
672  // Const Eigen-type
673  template <typename T, byte_size_type alignment, bool restrictQualify>
676  : params_(params) {}
677  SOA_HOST_DEVICE SOA_INLINE typename T::Scalar const* operator()() const { return params_.addr_; }
678  using NoParamReturnType = typename T::Scalar const*;
682  }
683 
684  private:
686  };
687 
688  /* A helper template stager to avoid commas inside macros */
689  template <typename T>
690  struct SoAAccessors {
691  template <auto columnType>
692  struct ColumnType {
693  template <auto accessType>
694  struct AccessType {
695  template <auto alignment>
696  struct Alignment {
697  template <auto restrictQualify>
699  : public SoAColumnAccessorsImpl<T, columnType, accessType, alignment, restrictQualify> {
701  };
702  };
703  };
704  };
705  };
706 
707  /* Enum parameters allowing templated control of layout/view behaviors */
708  /* Alignment enforcement verifies every column is aligned, and
709  * hints the compiler that it can expect column pointers to be aligned */
711  static constexpr bool relaxed = false;
712  static constexpr bool enforced = true;
713  };
714 
715  struct CacheLineSize {
721  };
722 
723 } // namespace cms::soa
724 
725 // Small wrapper for stream insertion of SoA printing
726 template <typename SOA,
727  typename SFINAE =
728  typename std::enable_if_t<std::is_invocable_v<decltype(&SOA::soaToStreamInternal), SOA&, std::ostream&>>>
729 SOA_HOST_ONLY std::ostream& operator<<(std::ostream& os, const SOA& soa) {
730  soa.soaToStreamInternal(os);
731  return os;
732 }
733 
734 #endif // DataFormats_SoATemplate_interface_SoACommon_h
static constexpr auto valueSize
Definition: SoACommon.h:343
typename Restr::PointerToConst PtrToConst
Definition: SoACommon.h:296
static constexpr bool enforced
Definition: SoACommon.h:712
Basic3DVector & operator=(const Basic3DVector &)=default
Assignment operator.
constexpr byte_size_type alignSize(byte_size_type size, byte_size_type alignment)
Definition: SoACommon.h:557
static constexpr bool checkAlignment(TupleOrPointerType const &tuple, byte_size_type alignment)
Definition: SoACommon.h:240
std::ostream & operator<<(std::ostream &os, const SOA &soa)
Definition: SoACommon.h:729
mathSSE::Vec4< double > operator &(mathSSE::Vec4< double > a, mathSSE::Vec4< double > b)
Definition: AVXVec.h:96
static constexpr byte_size_type AMDCPU
Definition: SoACommon.h:718
double Scalar
Definition: Definitions.h:25
cms_int32_t size_type
Definition: SoACommon.h:62
constexpr bool Default
Definition: SoACommon.h:81
int cms_int32_t
Definition: typedefs.h:14
static constexpr SoAColumnType columnType
Definition: SoACommon.h:191
std::tuple< ScalarType *, byte_size_type > TupleOrPointerType
Definition: SoACommon.h:224
constexpr bool enabled
Definition: SoACommon.h:79
T ScalarType
assert(be >=bs)
SoAConstParametersImpl< COLUMN_TYPE, T > ConstParams
Definition: SoACommon.h:437
constexpr bool enabled
Definition: SoACommon.h:73
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
add_restrict< T, RESTRICT_QUALIFY > Restr
Definition: SoACommon.h:292
constexpr uint32_t stride
Definition: HelixFit.h:22
static constexpr auto valueSize
Definition: SoACommon.h:470
typename Restr::PointerToConst PtrToConst
Definition: SoACommon.h:434
#define _VALUE_TYPE_SCALAR
Definition: SoACommon.h:50
typename Restr::Value Val
Definition: SoACommon.h:293
static constexpr byte_size_type IntelCPU
Definition: SoACommon.h:717
typename Restr::Reference Ref
Definition: SoACommon.h:295
#define SOA_HOST_ONLY
Definition: SoACommon.h:25
static constexpr byte_size_type ARMCPU
Definition: SoACommon.h:719
static constexpr byte_size_type defaultSize
Definition: SoACommon.h:720
size_type idx_
Definition: SoACommon.h:346
T const_cast_SoAParametersImpl(SoAConstParametersImpl< COLUMN_TYPE, T > const &o)
Definition: SoACommon.h:269
std::size_t byte_size_type
Definition: SoACommon.h:64
reco::JetExtendedAssociation::JetExtendedData Value
#define SOA_INLINE
Definition: SoACommon.h:28
SoAParametersImpl< COLUMN_TYPE, T > params
Definition: SoACommon.h:302
static constexpr SoAColumnType columnType
Definition: SoACommon.h:117
SoAParametersImpl< COLUMN_TYPE, T > params
Definition: SoACommon.h:442
#define SOA_HOST_DEVICE
Definition: SoACommon.h:27
#define _VALUE_TYPE_EIGEN_COLUMN
Definition: SoACommon.h:52
static constexpr bool relaxed
Definition: SoACommon.h:711
#define _VALUE_TYPE_COLUMN
Definition: SoACommon.h:51
ValueType const byte_size_type alignment
Definition: SoACommon.h:133
TupleOrPointerType tupleOrPointer()
Definition: SoACommon.h:210
typename Restr::ReferenceToConst RefToConst
Definition: SoACommon.h:297
TupleOrPointerType tupleOrPointer()
Definition: SoACommon.h:137
SoAColumnType
Definition: SoACommon.h:66
typename Restr::ReferenceToConst RefToConst
Definition: SoACommon.h:435
static constexpr byte_size_type NvidiaGPU
Definition: SoACommon.h:716
typename Restr::Pointer Ptr
Definition: SoACommon.h:294
typename Restr::Reference Ref
Definition: SoACommon.h:433
std::tuple< ScalarType *, byte_size_type > TupleOrPointerType
Definition: SoACommon.h:151
constexpr bool Default
Definition: SoACommon.h:75
static constexpr bool checkAlignment(ValueType *addr, byte_size_type alignment)
Definition: SoACommon.h:206
typename SoAValue< SoAColumnType::eigen, T, alignment, restrictQualify >::MapType ParamReturnType
Definition: SoACommon.h:663
((always_inline)) typename T typename SoAValue< SoAColumnType::eigen, T, alignment, restrictQualify >::CMapType ParamReturnType
Definition: SoACommon.h:679
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
constexpr bool disabled
Definition: SoACommon.h:74
ValueType
Type of the value held by a Value object.
Definition: value.h:25
typename Restr::Value Val
Definition: SoACommon.h:431
#define CMS_SOA_BYTE_SIZE_TYPE
Definition: SoACommon.h:57
constexpr bool disabled
Definition: SoACommon.h:80
#define get
long double T
typename Restr::Pointer Ptr
Definition: SoACommon.h:432
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .
Definition: matutil.cc:166