diff --git a/DetectorDescription/GeoModel/GeoSpecialShapes/GeoSpecialShapes/LArWheelCalculator.h b/DetectorDescription/GeoModel/GeoSpecialShapes/GeoSpecialShapes/LArWheelCalculator.h index fa5ffa6285798c4c8d6bcdac71bd492e999f213c..345de39714165ca62de5af3e53793e7dbbd70286 100644 --- a/DetectorDescription/GeoModel/GeoSpecialShapes/GeoSpecialShapes/LArWheelCalculator.h +++ b/DetectorDescription/GeoModel/GeoSpecialShapes/GeoSpecialShapes/LArWheelCalculator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOSPECIALSHAPES_LARWHEELCALCULATOR_H @@ -7,11 +7,16 @@ #include <vector> +// FMV and other checks +#include "CxxUtils/features.h" + #include "CLHEP/Vector/ThreeVector.h" #ifndef XAOD_STANDALONE #include "AthenaKernel/CLASS_DEF.h" #endif // XAOD_STANDALONE - +#if HAVE_VECTOR_SIZE_ATTRIBUTE + #include "vec_parametrized_sincos.h" +#endif #include "GeoSpecialShapes/LArWheelCalculatorEnums.h" #define LARWC_SINCOS_POLY 5 @@ -207,8 +212,11 @@ class LArWheelCalculator LArWheelCalculator_Impl::IDistanceCalculator *m_distanceCalcImpl; LArWheelCalculator_Impl::IFanCalculator *m_fanCalcImpl; - void fill_sincos_parameterization(); +#if HAVE_VECTOR_SIZE_ATTRIBUTE + vsincos_par m_vsincos_par{}; +#endif + }; #ifndef XAOD_STANDALONE diff --git a/DetectorDescription/GeoModel/GeoSpecialShapes/GeoSpecialShapes/vec_parametrized_sincos.h b/DetectorDescription/GeoModel/GeoSpecialShapes/GeoSpecialShapes/vec_parametrized_sincos.h new file mode 100644 index 0000000000000000000000000000000000000000..f662fbf1799365a40b320832b6b27166e89259b8 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoSpecialShapes/GeoSpecialShapes/vec_parametrized_sincos.h @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @brief vectorized version of parametrized sincos + * see ATLASSIM-4753 for details + * @author Miha Muskinja, Chistos Anastopoulos +*/ +#ifndef VEC_PARAMETRIZED_SINCOS_H +#define VEC_PARAMETRIZED_SINCOS_H + +#include "CxxUtils/restrict.h" +#include "CxxUtils/vec.h" +struct vsincos_par +{ + + CxxUtils::vec<double, 4> param_0 = {}; + CxxUtils::vec<double, 4> param_1 = {}; + CxxUtils::vec<double, 4> param_2 = {}; + +#if HAVE_FUNCTION_MULTIVERSIONING +#if defined(__x86_64__) + + __attribute__((target("avx2,fma"))) + + void + evaluate(const double r, + double &ATH_RESTRICT sin_a, + double &ATH_RESTRICT cos_a) const ATH_RESTRICT + { + const double r2 = r * r; + CxxUtils::vec<double, 4> P = r2 * param_0 + param_1; + P = r2 * P + param_2; + CxxUtils::vec<double, 4> P2 = {P[1], P[0], P[3], P[2]}; + CxxUtils::vec<double, 4> res = r * P2 + P; + sin_a = res[0]; + cos_a = res[2]; + } + + __attribute__((target("avx2"))) + + void + eval(const double r, + double &ATH_RESTRICT sin_a, + double &ATH_RESTRICT cos_a) const ATH_RESTRICT + { + const double r2 = r * r; + CxxUtils::vec<double, 4> P = r2 * param_0 + param_1; + P = r2 * P + param_2; + CxxUtils::vec<double, 4> P2 = {P[1], P[0], P[3], P[2]}; + CxxUtils::vec<double, 4> res = r * P2 + P; + sin_a = res[0]; + cos_a = res[2]; + } + + __attribute__((target("default"))) + +#endif // x86 +#endif // FMV + + void + eval(const double r, + double &ATH_RESTRICT sin_a, + double &ATH_RESTRICT cos_a) const ATH_RESTRICT + { + const double r2 = r * r; + CxxUtils::vec<double, 4> P = r2 * param_0 + param_1; + P = r2 * P + param_2; + sin_a = r * P[1] + P[0]; + cos_a = r * P[3] + P[2]; + } +}; + +#endif diff --git a/DetectorDescription/GeoModel/GeoSpecialShapes/src/LArWheelCalculator_Impl/DistanceCalculatorSaggingOff.cxx b/DetectorDescription/GeoModel/GeoSpecialShapes/src/LArWheelCalculator_Impl/DistanceCalculatorSaggingOff.cxx index c8bdbaa421bfff3317bfe705006054256a58000c..06239cc8c1f498f6896d10a35aa4f24aefa2871c 100644 --- a/DetectorDescription/GeoModel/GeoSpecialShapes/src/LArWheelCalculator_Impl/DistanceCalculatorSaggingOff.cxx +++ b/DetectorDescription/GeoModel/GeoSpecialShapes/src/LArWheelCalculator_Impl/DistanceCalculatorSaggingOff.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "DistanceCalculatorSaggingOff.h" @@ -48,7 +48,7 @@ namespace LArWheelCalculator_Impl const double cos_a = scalpha.cs, sin_a = scalpha.sn; #else // parameterized sine double cos_a, sin_a; - lwc()->parameterized_sincos(P.y(), sin_a, cos_a); + lwc()->m_vsincos_par.eval(P.y(), sin_a, cos_a); #endif // determination of the nearest quarter-wave number int nqwave = (z < 0.) ? 0 : int(z / lwc()->m_QuarterWaveLength); @@ -160,7 +160,7 @@ namespace LArWheelCalculator_Impl double cos_a = scalpha.cs, sin_a = scalpha.sn; #else // parameterized sine double cos_a, sin_a; - lwc()->parameterized_sincos(P.y(), sin_a, cos_a); + lwc()->m_vsincos_par.eval(P.y(), sin_a, cos_a); #endif bool sqw = false; @@ -251,7 +251,7 @@ namespace LArWheelCalculator_Impl const double cos_a = scalpha.cs, sin_a = scalpha.sn; #else // parameterized sine double cos_a, sin_a; - lwc()->parameterized_sincos(P.y(), sin_a, cos_a); + lwc()->m_vsincos_par.eval(P.y(), sin_a, cos_a); #endif int nqwave; @@ -339,7 +339,7 @@ namespace LArWheelCalculator_Impl double cos_a = scalpha.cs, sin_a = scalpha.sn; #else // parameterized sine double cos_a, sin_a; - lwc()->parameterized_sincos(P.y(), sin_a, cos_a); + lwc()->m_vsincos_par.eval(P.y(), sin_a, cos_a); #endif bool sqw = false; @@ -434,7 +434,7 @@ namespace LArWheelCalculator_Impl // parameterized sine #else double cos_a, sin_a; - lwc()->parameterized_sincos(P.y(), sin_a, cos_a); + lwc()->m_vsincos_par.eval(P.y(), sin_a, cos_a); #endif // determination of the nearest quarter-wave number diff --git a/DetectorDescription/GeoModel/GeoSpecialShapes/src/LArWheelCalculator_Impl/sincos_poly.cxx b/DetectorDescription/GeoModel/GeoSpecialShapes/src/LArWheelCalculator_Impl/sincos_poly.cxx index 8b277aecf8242dfa0f20ec27580afdc4db9707e9..deebabc0c29389cef9519e7b907ef0b8420d1c51 100644 --- a/DetectorDescription/GeoModel/GeoSpecialShapes/src/LArWheelCalculator_Impl/sincos_poly.cxx +++ b/DetectorDescription/GeoModel/GeoSpecialShapes/src/LArWheelCalculator_Impl/sincos_poly.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "GeoSpecialShapes/LArWheelCalculator.h" @@ -98,6 +98,24 @@ void LArWheelCalculator::fill_sincos_parameterization() m_sin_parametrization[i] = sin_parametrization[S][i]; m_cos_parametrization[i] = cos_parametrization[S][i]; } + + // Parameterization for the vectorized sincos calculation + // see ATLASSIM-4753 for details + // s4, s5, c4, c5 + // s2, s3, c2, c3 + // s0, s1, c0, c1 + m_vsincos_par.param_0[0] = m_sin_parametrization[4]; + m_vsincos_par.param_0[1] = m_sin_parametrization[5]; + m_vsincos_par.param_0[2] = m_cos_parametrization[4]; + m_vsincos_par.param_0[3] = m_cos_parametrization[5]; + m_vsincos_par.param_1[0] = m_sin_parametrization[2]; + m_vsincos_par.param_1[1] = m_sin_parametrization[3]; + m_vsincos_par.param_1[2] = m_cos_parametrization[2]; + m_vsincos_par.param_1[3] = m_cos_parametrization[3]; + m_vsincos_par.param_2[0] = m_sin_parametrization[0]; + m_vsincos_par.param_2[1] = m_sin_parametrization[1]; + m_vsincos_par.param_2[2] = m_cos_parametrization[0]; + m_vsincos_par.param_2[3] = m_cos_parametrization[1]; return; } @@ -139,6 +157,23 @@ void LArWheelCalculator::fill_sincos_parameterization() cos_parametrization[S][i] = params_cos[i]; } + // Parameterization for the vectorized sincos calculation + // see ATLASSIM-4753 for details + // s4, s5, c4, c5 + // s2, s3, c2, c3 + // s0, s1, c0, c1 + m_vsincos_par.param_0[0] = m_sin_parametrization[4]; + m_vsincos_par.param_0[1] = m_sin_parametrization[5]; + m_vsincos_par.param_0[2] = m_cos_parametrization[4]; + m_vsincos_par.param_0[3] = m_cos_parametrization[5]; + m_vsincos_par.param_1[0] = m_sin_parametrization[2]; + m_vsincos_par.param_1[1] = m_sin_parametrization[3]; + m_vsincos_par.param_1[2] = m_cos_parametrization[2]; + m_vsincos_par.param_1[3] = m_cos_parametrization[3]; + m_vsincos_par.param_2[0] = m_sin_parametrization[0]; + m_vsincos_par.param_2[1] = m_sin_parametrization[1]; + m_vsincos_par.param_2[2] = m_cos_parametrization[0]; + m_vsincos_par.param_2[3] = m_cos_parametrization[1]; filled[S] = true; // FIXME: nothing below is needed unless debug printing @@ -156,7 +191,17 @@ void LArWheelCalculator::fill_sincos_parameterization() for(double r = Rmin + 40.; r < Rmax - 40.; r += Rstep / 10.){ CxxUtils::sincos scalpha(parameterized_slant_angle(r)); double sin_a, cos_a; + double sin_a_v, cos_a_v; parameterized_sincos(r, sin_a, cos_a); + m_vsincos_par.eval(r, sin_a_v, cos_a_v); +#if DEBUGPRINT + std::streamsize ss = std::cout.precision(); + std::cout.precision(16); + std::cout << "def: " << r << " " << sin_a << " " << cos_a << std::endl; + std::cout << "vec: " << r << " " << sin_a_v << " " << cos_a_v << std::endl; + std::cout << "dif: " << r << " " << (sin_a - sin_a_v) / sin_a << " " << (cos_a - cos_a_v) / cos_a << std::endl; + std::cout.precision(ss); +#endif double ds = fabs(scalpha.sn - sin_a); if(ds > dsin){ dsin = ds; diff --git a/Tools/PROCTools/python/RunTier0TestsTools.py b/Tools/PROCTools/python/RunTier0TestsTools.py index ccabca200d7b7b5eec8077fba0e73fa7e3d04fa9..c5c0d855bbf6e37a1dc69f38068feeab6da66575 100644 --- a/Tools/PROCTools/python/RunTier0TestsTools.py +++ b/Tools/PROCTools/python/RunTier0TestsTools.py @@ -27,7 +27,7 @@ ciRefFileMap = { 's3505-21.0' : 'v2', 's3505-21.3' : 'v1', 's3505-21.9' : 'v1', - 's3505-22.0' : 'v12', + 's3505-22.0' : 'v13', # OverlayTier0Test_required-test 'overlay-d1498-21.0' : 'v2', 'overlay-d1498-22.0' : 'v38',