CbmRoot
Loading...
Searching...
No Matches
KfSimdVc.h
Go to the documentation of this file.
1/* Copyright (C) 2010-2024 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Igor Kulakov [committer], Maksym Zyzak, Sergei Zharko */
4
5#pragma once // include this header only once per compilation unit
6
7#include <boost/serialization/access.hpp>
8#include <boost/serialization/array.hpp>
9#include <boost/serialization/split_free.hpp>
10
11#include <Vc/Vc>
12
13namespace cbm::algo::kf
14{
15 using fvec = Vc::float_v;
16 //using fvec = Vc::double_v;
17 //using fvec = Vc::Vector<float, Vc::VectorAbi::Scalar>;
18 //using fvec = Vc::SimdArray<float, 4>;
19
20 using fscal = fvec::EntryType;
21 using fmask = fvec::MaskType;
22
23 constexpr auto VcMemAlign = Vc::VectorAlignment;
24
25// TODO: redefine via C++11 alignas
26#define _fvecalignment __attribute__((aligned(Vc::VectorAlignment)))
27} // namespace cbm::algo::kf
28
31{
32 template<class Archive>
33 void save(Archive& ar, const cbm::algo::kf::fvec& vect, unsigned int)
34 {
35 std::array<cbm::algo::kf::fscal, cbm::algo::kf::fvec::size()> buffer;
36 for (size_t i = 0; i < cbm::algo::kf::fvec::size(); ++i) {
37 buffer[i] = vect[i];
38 }
39 ar << buffer;
40 }
41
42 template<class Archive>
43 void load(Archive& ar, cbm::algo::kf::fvec& vect, unsigned int)
44 {
45 std::array<cbm::algo::kf::fscal, cbm::algo::kf::fvec::size()> buffer;
46 ar >> buffer;
47 for (size_t i = 0; i < cbm::algo::kf::fvec::size(); ++i) {
48 vect[i] = buffer[i];
49 }
50 }
51
52 template<class Archive>
53 void serialize(Archive& ar, cbm::algo::kf::fvec& vect, const unsigned int version)
54 {
55 split_free(ar, vect, version);
56 }
57} // namespace boost::serialization
Serializer for SIMD vectors.
void load(Archive &ar, ROOT::Math::XYZVector &val, const unsigned int)
void serialize(Archive &ar, ROOT::Math::XYZVector &val, const unsigned int version)
void save(Archive &ar, const ROOT::Math::XYZVector &val, const unsigned int)
constexpr auto VcMemAlign