diff --git a/cmake/algebra-plugins-functions.cmake b/cmake/algebra-plugins-functions.cmake index 21af0427..fb2ea687 100644 --- a/cmake/algebra-plugins-functions.cmake +++ b/cmake/algebra-plugins-functions.cmake @@ -123,6 +123,8 @@ function( algebra_add_benchmark name ) if( ARG_LINK_LIBRARIES ) target_link_libraries( ${bench_exe_name} PRIVATE ${ARG_LINK_LIBRARIES} ) endif() + target_compile_options( algebra_benchmark_${name} PRIVATE + "-march=native" "-ftree-vectorize") endfunction( algebra_add_benchmark ) diff --git a/frontend/vc_aos/include/algebra/vc_aos.hpp b/frontend/vc_aos/include/algebra/vc_aos.hpp index 4245f9d1..a32c3926 100644 --- a/frontend/vc_aos/include/algebra/vc_aos.hpp +++ b/frontend/vc_aos/include/algebra/vc_aos.hpp @@ -23,7 +23,7 @@ namespace vc_aos { /// @{ template -using transform3 = math::transform3, point2>; +using transform3 = math::transform3; /// @} @@ -42,11 +42,17 @@ using vc_aos::math::theta; /// @} -/// Function extracting a slice from the matrix used by -/// @c algebra::vc_aos::transform3 -template = true> -ALGEBRA_HOST_DEVICE inline vc_aos::vector3 vector( - const vc_aos::transform3::matrix44& m, +/// @name Getter functions on @c algebra::vc_aos::matrix_type +/// @{ + +using cmath::element; + +/// Function extracting a slice from matrix44 - const +template class array_t, + typename value_t, std::size_t N, + std::enable_if_t = true> +ALGEBRA_HOST_DEVICE inline const auto& vector( + const storage::matrix44& m, std::size_t #ifndef NDEBUG row @@ -66,15 +72,20 @@ ALGEBRA_HOST_DEVICE inline vc_aos::vector3 vector( case 3: return m.t; default: +#ifndef _MSC_VER + __builtin_unreachable(); +#else return m.x; +#endif } } -/// Function extracting a slice from the matrix used by -/// @c algebra::vc_aos::transform3 -template = true> -ALGEBRA_HOST_DEVICE inline vc_aos::vector3 vector( - const vc_aos::transform3::matrix44& m, +/// Function extracting a slice from matrix44 - non-const +template class array_t, + typename value_t, std::size_t N, + std::enable_if_t = true> +ALGEBRA_HOST_DEVICE inline auto& vector( + storage::matrix44& m, std::size_t #ifndef NDEBUG row @@ -94,15 +105,14 @@ ALGEBRA_HOST_DEVICE inline vc_aos::vector3 vector( case 3: return m.t; default: +#ifndef _MSC_VER + __builtin_unreachable(); +#else return m.x; +#endif } } -/// @name Getter functions on @c algebra::vc_aos::matrix_type -/// @{ - -using cmath::element; - /// @} } // namespace getter diff --git a/frontend/vc_soa/CMakeLists.txt b/frontend/vc_soa/CMakeLists.txt index b6344424..d4980cca 100644 --- a/frontend/vc_soa/CMakeLists.txt +++ b/frontend/vc_soa/CMakeLists.txt @@ -9,6 +9,6 @@ algebra_add_library( algebra_vc_soa vc_soa "include/algebra/vc_soa.hpp" ) target_link_libraries( algebra_vc_soa INTERFACE algebra::common algebra::vc_soa_storage algebra::cmath_math - algebra::vc_soa_math ) + algebra::vc_soa_math algebra::vc_aos_math ) algebra_test_public_headers( algebra_vc_soa "algebra/vc_soa.hpp" ) diff --git a/frontend/vc_soa/include/algebra/vc_soa.hpp b/frontend/vc_soa/include/algebra/vc_soa.hpp index e89eb8aa..ef0c7881 100644 --- a/frontend/vc_soa/include/algebra/vc_soa.hpp +++ b/frontend/vc_soa/include/algebra/vc_soa.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,6 +8,7 @@ #pragma once // Project include(s). +#include "algebra/math/impl/vc_aos_transform3.hpp" #include "algebra/math/vc_soa.hpp" #include "algebra/storage/vc_soa.hpp" @@ -32,7 +33,7 @@ namespace vc_soa { /// @{ template -using transform3 = math::transform3; +using transform3 = algebra::vc_aos::math::transform3; /// @} diff --git a/math/vc_aos/CMakeLists.txt b/math/vc_aos/CMakeLists.txt index 64a723c7..8e6a63a9 100644 --- a/math/vc_aos/CMakeLists.txt +++ b/math/vc_aos/CMakeLists.txt @@ -11,7 +11,6 @@ algebra_add_library( algebra_vc_aos_math vc_aos_math "include/algebra/math/impl/vc_aos_transform3.hpp" "include/algebra/math/impl/vc_aos_vector.hpp" ) target_link_libraries( algebra_vc_aos_math - INTERFACE Vc::Vc algebra::common algebra::common_math algebra::vc_storage - algebra::cmath_math ) + INTERFACE Vc::Vc algebra::common algebra::common_math algebra::vc_storage ) algebra_test_public_headers( algebra_vc_aos_math "algebra/math/vc_aos.hpp" ) diff --git a/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp b/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp index d40f8ff8..391c3607 100644 --- a/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp +++ b/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp @@ -8,9 +8,10 @@ #pragma once // Project include(s). -#include "algebra/math/cmath.hpp" -#include "algebra/math/impl/vc_aos_vector.hpp" +#include "algebra/math/common.hpp" #include "algebra/qualifiers.hpp" +#include "algebra/storage/matrix44.hpp" +#include "algebra/storage/vector.hpp" // Vc include(s). #ifdef _MSC_VER @@ -26,95 +27,47 @@ namespace algebra::vc_aos::math { -namespace internal { - -/// 4x4 matrix type used by @c algebra::vc_aos::math::transform3 -template -struct matrix44 { - - /// Equality operator between two matrices - bool operator==(const matrix44 &rhs) const { - return ((x == rhs.x).isFull() && (y == rhs.y).isFull() && - (z == rhs.z).isFull() && (t == rhs.t).isFull()); - } - - /// Data variables - Vc::SimdArray x, y, z, t; - -}; // struct matrix44 - -/// Functor used to access elements of Vc matrices -template