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 #define CMS_SOA_BYTE_SIZE_TYPE std::size_t
56 
57 namespace cms::soa {
58 
59  // size_type for indices. Compatible with ROOT Int_t, but limited to 2G entries
61  // byte_size_type for byte counts. Not creating an artificial limit (and not ROOT serialized).
63 
64  enum class SoAColumnType {
68  };
69 
70  namespace RestrictQualify {
71  constexpr bool enabled = true;
72  constexpr bool disabled = false;
73  constexpr bool Default = disabled;
74  } // namespace RestrictQualify
75 
76  namespace RangeChecking {
77  constexpr bool enabled = true;
78  constexpr bool disabled = false;
79  constexpr bool Default = disabled;
80  } // namespace RangeChecking
81 
82  template <typename T, bool RESTRICT_QUALIFY>
83  struct add_restrict {};
84 
85  template <typename T>
86  struct add_restrict<T, RestrictQualify::enabled> {
87  using Value = T;
88  using Pointer = T* __restrict__;
89  using Reference = T& __restrict__;
90  using ConstValue = const T;
91  using PointerToConst = const T* __restrict__;
92  using ReferenceToConst = const T& __restrict__;
93  };
94 
95  template <typename T>
96  struct add_restrict<T, RestrictQualify::disabled> {
97  using Value = T;
98  using Pointer = T*;
99  using Reference = T&;
100  using ConstValue = const T;
101  using PointerToConst = const T*;
102  using ReferenceToConst = const T&;
103  };
104 
105  // Forward declarations
106  template <SoAColumnType COLUMN_TYPE, typename T>
108 
109  template <SoAColumnType COLUMN_TYPE, typename T>
111 
112  // Templated const parameter sets for scalars, columns and Eigen columns
113  template <SoAColumnType COLUMN_TYPE, typename T>
114  struct SoAConstParametersImpl {
115  static constexpr SoAColumnType columnType = COLUMN_TYPE;
116 
117  using ValueType = T;
118  using ScalarType = T;
120 
121  // default constructor
122  SoAConstParametersImpl() = default;
123 
124  // constructor from an address
126 
127  // constructor from a non-const parameter set
129  : addr_{o.addr_} {}
130 
131  static constexpr bool checkAlignment(ValueType* addr, byte_size_type alignment) {
132  return reinterpret_cast<intptr_t>(addr) % alignment;
133  }
134 
135  public:
136  // scalar or column
137  ValueType const* addr_ = nullptr;
138  };
139 
140  // Templated const parameter specialisation for Eigen columns
141  template <typename T>
144 
145  using ValueType = T;
146  using ScalarType = typename T::Scalar;
147  using TupleOrPointerType = std::tuple<ScalarType*, byte_size_type>;
148 
149  // default constructor
150  SoAConstParametersImpl() = default;
151 
152  // constructor from individual address and stride
154  : addr_(addr), stride_(stride) {}
155 
156  // constructor from address and stride packed in a tuple
158  : addr_(std::get<0>(tuple)), stride_(std::get<1>(tuple)) {}
159 
160  // constructor from a non-const parameter set
162  : addr_{o.addr_}, stride_{o.stride_} {}
163 
164  static constexpr bool checkAlignment(TupleOrPointerType const& tuple, byte_size_type alignment) {
165  const auto& [addr, stride] = tuple;
166  return reinterpret_cast<intptr_t>(addr) % alignment;
167  }
168 
169  public:
170  // address and stride
171  ScalarType const* addr_ = nullptr;
172  byte_size_type stride_ = 0;
173  };
174 
175  // Matryoshka template to avoid commas inside macros
176  template <SoAColumnType COLUMN_TYPE>
178  template <typename T>
180  };
181 
182  // Templated parameter sets for scalars, columns and Eigen columns
183  template <SoAColumnType COLUMN_TYPE, typename T>
184  struct SoAParametersImpl {
185  static constexpr SoAColumnType columnType = COLUMN_TYPE;
186 
187  using ValueType = T;
188  using ScalarType = T;
190 
192  friend ConstType;
193 
194  // default constructor
195  SoAParametersImpl() = default;
196 
197  // constructor from an address
199 
201  return reinterpret_cast<intptr_t>(addr) % alignment;
202  }
203 
204  public:
205  // scalar or column
206  ValueType* addr_ = nullptr;
207  };
208 
209  // Templated parameter specialisation for Eigen columns
210  template <typename T>
213 
214  using ValueType = T;
215  using ScalarType = typename T::Scalar;
216  using TupleOrPointerType = std::tuple<ScalarType*, byte_size_type>;
217 
219  friend ConstType;
220 
221  // default constructor
222  SoAParametersImpl() = default;
223 
224  // constructor from individual address and stride
226  : addr_(addr), stride_(stride) {}
227 
228  // constructor from address and stride packed in a tuple
230  : addr_(std::get<0>(tuple)), stride_(std::get<1>(tuple)) {}
231 
233  const auto& [addr, stride] = tuple;
234  return reinterpret_cast<intptr_t>(addr) % alignment;
235  }
236 
237  public:
238  // address and stride
239  ScalarType* addr_ = nullptr;
240  byte_size_type stride_ = 0;
241  };
242 
243  // Matryoshka template to avoid commas inside macros
244  template <SoAColumnType COLUMN_TYPE>
246  template <typename T>
248  };
249 
250  // Helper converting a const parameter set to a non-const parameter set, to be used only in the constructor of non-const "element"
251  namespace {
252  template <typename T>
253  constexpr inline std::remove_const_t<T>* non_const_ptr(T* p) {
254  return const_cast<std::remove_const_t<T>*>(p);
255  }
256  } // namespace
257 
258  template <SoAColumnType COLUMN_TYPE, typename T>
261  return SoAParametersImpl<COLUMN_TYPE, T>{non_const_ptr(o.addr_)};
262  }
263 
264  template <typename T>
267  return SoAParametersImpl<SoAColumnType::eigen, T>{non_const_ptr(o.addr_), o.stride_};
268  }
269 
270  // Helper template managing the value at index idx within a column.
271  // The optional compile time alignment parameter enables informing the
272  // compiler of alignment (enforced by caller).
273  template <SoAColumnType COLUMN_TYPE,
274  typename T,
275  byte_size_type ALIGNMENT,
276  bool RESTRICT_QUALIFY = RestrictQualify::disabled>
277  class SoAValue {
278  // Eigen is implemented in a specialization
279  static_assert(COLUMN_TYPE != SoAColumnType::eigen);
280 
281  public:
283  using Val = typename Restr::Value;
284  using Ptr = typename Restr::Pointer;
285  using Ref = typename Restr::Reference;
286  using PtrToConst = typename Restr::PointerToConst;
287  using RefToConst = typename Restr::ReferenceToConst;
288 
290 
292  : idx_(i), col_(params.addr_) {}
293 
295  // Ptr type will add the restrict qualifyer if needed
296  Ptr col = col_;
297  return col[idx_];
298  }
299 
300  SOA_HOST_DEVICE SOA_INLINE RefToConst operator()() const {
301  // PtrToConst type will add the restrict qualifyer if needed
302  PtrToConst col = col_();
303  return col[idx_];
304  }
305 
307 
309 
310  /* This was an attempt to implement the syntax
311  *
312  * old_value = view.x
313  * view.x = new_value
314  *
315  * instead of
316  *
317  * old_value = view.x()
318  * view.x() = new_value
319  *
320  * but it was found to break in some corner cases.
321  * We keep them commented out for the time being.
322 
323  SOA_HOST_DEVICE SOA_INLINE operator T&() { return col_[idx_]; }
324 
325  template <typename T2>
326  SOA_HOST_DEVICE SOA_INLINE Ref operator=(const T2& v) {
327  return col_[idx_] = v;
328  }
329  */
330 
331  using valueType = Val;
332 
333  static constexpr auto valueSize = sizeof(T);
334 
335  private:
337  T* col_;
338  };
339 
340  // Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.
341 #ifdef EIGEN_WORLD_VERSION
342  // Helper template managing an Eigen-type value at index idx within a column.
343  template <class C, byte_size_type ALIGNMENT, bool RESTRICT_QUALIFY>
344  class SoAValue<SoAColumnType::eigen, C, ALIGNMENT, RESTRICT_QUALIFY> {
345  public:
346  using Type = C;
347  using MapType = Eigen::Map<C, 0, Eigen::InnerStride<Eigen::Dynamic>>;
348  using CMapType = const Eigen::Map<const C, 0, Eigen::InnerStride<Eigen::Dynamic>>;
350  using Val = typename Restr::Value;
351  using Ptr = typename Restr::Pointer;
352  using Ref = typename Restr::Reference;
353  using PtrToConst = typename Restr::PointerToConst;
354  using RefToConst = typename Restr::ReferenceToConst;
355 
357  : val_(col + i, C::RowsAtCompileTime, C::ColsAtCompileTime, Eigen::InnerStride<Eigen::Dynamic>(stride)),
358  crCol_(col),
359  cVal_(crCol_ + i, C::RowsAtCompileTime, C::ColsAtCompileTime, Eigen::InnerStride<Eigen::Dynamic>(stride)),
360  stride_(stride) {}
361 
362  SOA_HOST_DEVICE SOA_INLINE SoAValue(size_type i, SoAParametersImpl<SoAColumnType::eigen, C> params)
363  : val_(params.addr_ + i,
364  C::RowsAtCompileTime,
365  C::ColsAtCompileTime,
366  Eigen::InnerStride<Eigen::Dynamic>(params.stride_)),
367  crCol_(params.addr_),
368  cVal_(crCol_ + i,
369  C::RowsAtCompileTime,
370  C::ColsAtCompileTime,
371  Eigen::InnerStride<Eigen::Dynamic>(params.stride_)),
372  stride_(params.stride_) {}
373 
374  SOA_HOST_DEVICE SOA_INLINE MapType& operator()() { return val_; }
375 
376  SOA_HOST_DEVICE SOA_INLINE const CMapType& operator()() const { return cVal_; }
377 
378  SOA_HOST_DEVICE SOA_INLINE operator C() { return val_; }
379 
380  SOA_HOST_DEVICE SOA_INLINE operator const C() const { return cVal_; }
381 
382  SOA_HOST_DEVICE SOA_INLINE C* operator&() { return &val_; }
383 
384  SOA_HOST_DEVICE SOA_INLINE const C* operator&() const { return &cVal_; }
385 
386  template <class C2>
387  SOA_HOST_DEVICE SOA_INLINE MapType& operator=(const C2& v) {
388  return val_ = v;
389  }
390 
391  using ValueType = typename C::Scalar;
392  static constexpr auto valueSize = sizeof(typename C::Scalar);
393  SOA_HOST_DEVICE SOA_INLINE byte_size_type stride() const { return stride_; }
394 
395  private:
396  MapType val_;
397  const Ptr crCol_;
398  CMapType cVal_;
399  byte_size_type stride_;
400  };
401 #else
402  // Raise a compile-time error
403  template <class C, byte_size_type ALIGNMENT, bool RESTRICT_QUALIFY>
404  class SoAValue<SoAColumnType::eigen, C, ALIGNMENT, RESTRICT_QUALIFY> {
405  static_assert(!sizeof(C),
406  "Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.");
407  };
408 #endif
409 
410  // Helper template managing a const value at index idx within a column.
411  template <SoAColumnType COLUMN_TYPE,
412  typename T,
413  byte_size_type ALIGNMENT,
414  bool RESTRICT_QUALIFY = RestrictQualify::disabled>
416  // Eigen is implemented in a specialization
417  static_assert(COLUMN_TYPE != SoAColumnType::eigen);
418 
419  public:
421  using Val = typename Restr::Value;
422  using Ptr = typename Restr::Pointer;
423  using Ref = typename Restr::Reference;
424  using PtrToConst = typename Restr::PointerToConst;
425  using RefToConst = typename Restr::ReferenceToConst;
428 
430 
432  : idx_(i), col_(params.addr_) {}
433 
435  : idx_(i), col_(params.addr_) {}
436 
437  SOA_HOST_DEVICE SOA_INLINE RefToConst operator()() const {
438  // Ptr type will add the restrict qualifyer if needed
439  PtrToConst col = col_;
440  return col[idx_];
441  }
442 
443  SOA_HOST_DEVICE SOA_INLINE const T* operator&() const { return &col_[idx_]; }
444 
445  /* This was an attempt to implement the syntax
446  *
447  * old_value = view.x
448  *
449  * instead of
450  *
451  * old_value = view.x()
452  *
453  * but it was found to break in some corner cases.
454  * We keep them commented out for the time being.
455 
456  SOA_HOST_DEVICE SOA_INLINE operator T&() { return col_[idx_]; }
457  */
458 
459  using valueType = T;
460  static constexpr auto valueSize = sizeof(T);
461 
462  private:
464  const T* col_;
465  };
466 
467  // Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.
468 #ifdef EIGEN_WORLD_VERSION
469  // Helper template managing a const Eigen-type value at index idx within a column.
470  template <class C, byte_size_type ALIGNMENT, bool RESTRICT_QUALIFY>
471  class SoAConstValue<SoAColumnType::eigen, C, ALIGNMENT, RESTRICT_QUALIFY> {
472  public:
473  using Type = C;
474  using CMapType = Eigen::Map<const C, 0, Eigen::InnerStride<Eigen::Dynamic>>;
475  using RefToConst = const CMapType&;
477 
479  : crCol_(col),
480  cVal_(crCol_ + i, C::RowsAtCompileTime, C::ColsAtCompileTime, Eigen::InnerStride<Eigen::Dynamic>(stride)),
481  stride_(stride) {}
482 
483  SOA_HOST_DEVICE SOA_INLINE SoAConstValue(size_type i, SoAConstParametersImpl<SoAColumnType::eigen, C> params)
484  : crCol_(params.addr_),
485  cVal_(crCol_ + i,
486  C::RowsAtCompileTime,
487  C::ColsAtCompileTime,
488  Eigen::InnerStride<Eigen::Dynamic>(params.stride_)),
489  stride_(params.stride_) {}
490 
491  SOA_HOST_DEVICE SOA_INLINE const CMapType& operator()() const { return cVal_; }
492 
493  SOA_HOST_DEVICE SOA_INLINE operator const C() const { return cVal_; }
494 
495  SOA_HOST_DEVICE SOA_INLINE const C* operator&() const { return &cVal_; }
496 
497  using ValueType = typename C::Scalar;
498  static constexpr auto valueSize = sizeof(typename C::Scalar);
499 
500  SOA_HOST_DEVICE SOA_INLINE byte_size_type stride() const { return stride_; }
501 
502  private:
503  const typename C::Scalar* __restrict__ crCol_;
504  CMapType cVal_;
505  byte_size_type stride_;
506  };
507 #else
508  // Raise a compile-time error
509  template <class C, byte_size_type ALIGNMENT, bool RESTRICT_QUALIFY>
510  class SoAConstValue<SoAColumnType::eigen, C, ALIGNMENT, RESTRICT_QUALIFY> {
511  static_assert(!sizeof(C),
512  "Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.");
513  };
514 #endif
515 
516  // Helper template to avoid commas inside macros
517 #ifdef EIGEN_WORLD_VERSION
518  template <class C>
519  struct EigenConstMapMaker {
520  using Type = Eigen::Map<const C, Eigen::AlignmentType::Unaligned, Eigen::InnerStride<Eigen::Dynamic>>;
521 
522  class DataHolder {
523  public:
524  DataHolder(const typename C::Scalar* data) : data_(data) {}
525 
528  data_, C::RowsAtCompileTime, C::ColsAtCompileTime, Eigen::InnerStride<Eigen::Dynamic>(stride));
529  }
530 
531  private:
532  const typename C::Scalar* const data_;
533  };
534 
535  static DataHolder withData(const typename C::Scalar* data) { return DataHolder(data); }
536  };
537 #else
538  template <class C>
540  // Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.
541  static_assert(!sizeof(C),
542  "Eigen/Core should be pre-included before the SoA headers to enable support for Eigen columns.");
543  };
544 #endif
545 
546  // Helper function to compute aligned size
548  return ((size + alignment - 1) / alignment) * alignment;
549  }
550 
551 } // namespace cms::soa
552 
553 #define SOA_SCALAR(TYPE, NAME) (_VALUE_TYPE_SCALAR, TYPE, NAME)
554 #define SOA_COLUMN(TYPE, NAME) (_VALUE_TYPE_COLUMN, TYPE, NAME)
555 #define SOA_EIGEN_COLUMN(TYPE, NAME) (_VALUE_TYPE_EIGEN_COLUMN, TYPE, NAME)
556 
557 /* Iterate on the macro MACRO and return the result as a comma separated list */
558 #define _ITERATE_ON_ALL_COMMA(MACRO, DATA, ...) \
559  BOOST_PP_TUPLE_ENUM(BOOST_PP_SEQ_TO_TUPLE(_ITERATE_ON_ALL(MACRO, DATA, __VA_ARGS__)))
560 
561 /* Iterate MACRO on all elements */
562 #define _ITERATE_ON_ALL(MACRO, DATA, ...) BOOST_PP_SEQ_FOR_EACH(MACRO, DATA, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__))
563 
564 /* Switch on macros depending on scalar / column type */
565 #define _SWITCH_ON_TYPE(VALUE_TYPE, IF_SCALAR, IF_COLUMN, IF_EIGEN_COLUMN) \
566  BOOST_PP_IF( \
567  BOOST_PP_EQUAL(VALUE_TYPE, _VALUE_TYPE_SCALAR), \
568  IF_SCALAR, \
569  BOOST_PP_IF( \
570  BOOST_PP_EQUAL(VALUE_TYPE, _VALUE_TYPE_COLUMN), \
571  IF_COLUMN, \
572  BOOST_PP_IF(BOOST_PP_EQUAL(VALUE_TYPE, _VALUE_TYPE_EIGEN_COLUMN), IF_EIGEN_COLUMN, BOOST_PP_EMPTY())))
573 
574 namespace cms::soa {
575 
576  /* Column accessors: templates implementing the global accesors (soa::x() and soa::x(index) */
578 
579  template <typename, SoAColumnType, SoAAccessType, byte_size_type, bool>
581 
582  // TODO from Eric Cano:
583  // - add alignment support
584  // - SFINAE-based const/non const variants
585 
586  // Column
587  template <typename T, byte_size_type alignment, bool restrictQualify>
590  : params_(params) {}
591  SOA_HOST_DEVICE SOA_INLINE T* operator()() { return params_.addr_; }
593  using ParamReturnType = T&;
594  SOA_HOST_DEVICE SOA_INLINE T& operator()(size_type index) { return params_.addr_[index]; }
595 
596  private:
598  };
599 
600  // Const column
601  template <typename T, byte_size_type alignment, bool restrictQualify>
604  : params_(params) {}
605  SOA_HOST_DEVICE SOA_INLINE const T* operator()() const { return params_.addr_; }
606  using NoParamReturnType = const T*;
607  using ParamReturnType = const T&;
608  SOA_HOST_DEVICE SOA_INLINE T const& operator()(size_type index) const { return params_.addr_[index]; }
609 
610  private:
612  };
613 
614  // Scalar
615  template <typename T, byte_size_type alignment, bool restrictQualify>
618  : params_(params) {}
619  SOA_HOST_DEVICE SOA_INLINE T& operator()() { return *params_.addr_; }
622  SOA_HOST_DEVICE SOA_INLINE void operator()(size_type index) const {
623  assert(false && "Indexed access impossible for SoA scalars.");
624  }
625 
626  private:
628  };
629 
630  // Const scalar
631  template <typename T, byte_size_type alignment, bool restrictQualify>
634  : params_(params) {}
635  SOA_HOST_DEVICE SOA_INLINE T const& operator()() const { return *params_.addr_; }
636  using NoParamReturnType = T const&;
638  SOA_HOST_DEVICE SOA_INLINE void operator()(size_type index) const {
639  assert(false && "Indexed access impossible for SoA scalars.");
640  }
641 
642  private:
644  };
645 
646  // Eigen-type
647  template <typename T, byte_size_type alignment, bool restrictQualify>
650  : params_(params) {}
651  SOA_HOST_DEVICE SOA_INLINE typename T::Scalar* operator()() { return params_.addr_; }
652  using NoParamReturnType = typename T::Scalar*;
656  }
657 
658  private:
660  };
661 
662  // Const Eigen-type
663  template <typename T, byte_size_type alignment, bool restrictQualify>
666  : params_(params) {}
667  SOA_HOST_DEVICE SOA_INLINE typename T::Scalar const* operator()() const { return params_.addr_; }
668  using NoParamReturnType = typename T::Scalar const*;
672  }
673 
674  private:
676  };
677 
678  /* A helper template stager to avoid commas inside macros */
679  template <typename T>
680  struct SoAAccessors {
681  template <auto columnType>
682  struct ColumnType {
683  template <auto accessType>
684  struct AccessType {
685  template <auto alignment>
686  struct Alignment {
687  template <auto restrictQualify>
689  : public SoAColumnAccessorsImpl<T, columnType, accessType, alignment, restrictQualify> {
691  };
692  };
693  };
694  };
695  };
696 
697  /* Enum parameters allowing templated control of layout/view behaviors */
698  /* Alignment enforcement verifies every column is aligned, and
699  * hints the compiler that it can expect column pointers to be aligned */
701  static constexpr bool relaxed = false;
702  static constexpr bool enforced = true;
703  };
704 
705  struct CacheLineSize {
706  static constexpr byte_size_type NvidiaGPU = 128;
707  static constexpr byte_size_type IntelCPU = 64;
708  static constexpr byte_size_type AMDCPU = 64;
709  static constexpr byte_size_type ARMCPU = 64;
711  };
712 
713 } // namespace cms::soa
714 
715 // Small wrapper for stream insertion of SoA printing
716 template <typename SOA,
717  typename SFINAE =
718  typename std::enable_if_t<std::is_invocable_v<decltype(&SOA::soaToStreamInternal), SOA&, std::ostream&>>>
719 SOA_HOST_ONLY std::ostream& operator<<(std::ostream& os, const SOA& soa) {
720  soa.soaToStreamInternal(os);
721  return os;
722 }
723 
724 #endif // DataFormats_SoATemplate_interface_SoACommon_h
static constexpr auto valueSize
Definition: SoACommon.h:333
typename Restr::PointerToConst PtrToConst
Definition: SoACommon.h:286
static constexpr bool enforced
Definition: SoACommon.h:702
constexpr byte_size_type alignSize(byte_size_type size, byte_size_type alignment)
Definition: SoACommon.h:547
static constexpr bool checkAlignment(TupleOrPointerType const &tuple, byte_size_type alignment)
Definition: SoACommon.h:232
std::ostream & operator<<(std::ostream &os, const SOA &soa)
Definition: SoACommon.h:719
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:708
double Scalar
Definition: Definitions.h:25
cms_int32_t size_type
Definition: SoACommon.h:60
constexpr bool Default
Definition: SoACommon.h:79
int cms_int32_t
Definition: typedefs.h:14
static constexpr SoAColumnType columnType
Definition: SoACommon.h:185
std::tuple< ScalarType *, byte_size_type > TupleOrPointerType
Definition: SoACommon.h:216
constexpr bool enabled
Definition: SoACommon.h:77
T ScalarType
assert(be >=bs)
SoAConstParametersImpl< COLUMN_TYPE, T > ConstParams
Definition: SoACommon.h:427
constexpr bool enabled
Definition: SoACommon.h:71
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
add_restrict< T, RESTRICT_QUALIFY > Restr
Definition: SoACommon.h:282
static constexpr auto valueSize
Definition: SoACommon.h:460
typename Restr::PointerToConst PtrToConst
Definition: SoACommon.h:424
#define _VALUE_TYPE_SCALAR
Definition: SoACommon.h:50
typename Restr::Value Val
Definition: SoACommon.h:283
static constexpr byte_size_type IntelCPU
Definition: SoACommon.h:707
typename Restr::Reference Ref
Definition: SoACommon.h:285
#define SOA_HOST_ONLY
Definition: SoACommon.h:25
static constexpr byte_size_type ARMCPU
Definition: SoACommon.h:709
static constexpr byte_size_type defaultSize
Definition: SoACommon.h:710
size_type idx_
Definition: SoACommon.h:336
T const_cast_SoAParametersImpl(SoAConstParametersImpl< COLUMN_TYPE, T > const &o)
Definition: SoACommon.h:259
std::size_t byte_size_type
Definition: SoACommon.h:62
reco::JetExtendedAssociation::JetExtendedData Value
ValueType
Type of the value held by a Value object.
Definition: value.h:23
#define SOA_INLINE
Definition: SoACommon.h:28
SoAParametersImpl< COLUMN_TYPE, T > params
Definition: SoACommon.h:292
static constexpr SoAColumnType columnType
Definition: SoACommon.h:115
SoAParametersImpl< COLUMN_TYPE, T > params
Definition: SoACommon.h:432
#define SOA_HOST_DEVICE
Definition: SoACommon.h:27
#define _VALUE_TYPE_EIGEN_COLUMN
Definition: SoACommon.h:52
static constexpr bool relaxed
Definition: SoACommon.h:701
#define _VALUE_TYPE_COLUMN
Definition: SoACommon.h:51
typename Restr::ReferenceToConst RefToConst
Definition: SoACommon.h:287
SoAColumnType
Definition: SoACommon.h:64
typename Restr::ReferenceToConst RefToConst
Definition: SoACommon.h:425
static constexpr byte_size_type NvidiaGPU
Definition: SoACommon.h:706
typename Restr::Pointer Ptr
Definition: SoACommon.h:284
typename Restr::Reference Ref
Definition: SoACommon.h:423
std::tuple< ScalarType *, byte_size_type > TupleOrPointerType
Definition: SoACommon.h:147
constexpr bool Default
Definition: SoACommon.h:73
static constexpr bool checkAlignment(ValueType *addr, byte_size_type alignment)
Definition: SoACommon.h:200
typename SoAValue< SoAColumnType::eigen, T, alignment, restrictQualify >::MapType ParamReturnType
Definition: SoACommon.h:653
((always_inline)) typename T typename SoAValue< SoAColumnType::eigen, T, alignment, restrictQualify >::CMapType ParamReturnType
Definition: SoACommon.h:669
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
constexpr bool disabled
Definition: SoACommon.h:72
typename Restr::Value Val
Definition: SoACommon.h:421
#define CMS_SOA_BYTE_SIZE_TYPE
Definition: SoACommon.h:55
constexpr bool disabled
Definition: SoACommon.h:78
#define get
long double T
typename Restr::Pointer Ptr
Definition: SoACommon.h:422
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .
Definition: matutil.cc:166