Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
SIMDDistance.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
13#include "math/simd/detail/AVX512Kernels.hpp" // IWYU pragma: export
14#include "math/simd/detail/ScalarKernels.hpp" // IWYU pragma: export
15
16namespace correlation::math {
17
22template <typename T>
23inline void computeDsqBlock(T ref_x, T ref_y, T ref_z, const PositionBlockT<T> &block,
24 T *CORRELATION_RESTRICT out_dsq) noexcept {
25#ifdef CORRELATION_SIMD_AVX512
26 detail::avx512::computeDsqBlock(ref_x, ref_y, ref_z, block, out_dsq);
27#elifdef CORRELATION_SIMD_AVX2
28 detail::avx2::computeDsqBlock(ref_x, ref_y, ref_z, block, out_dsq);
29#else
30 detail::scalar::computeDsqBlock(ref_x, ref_y, ref_z, block, out_dsq);
31#endif
32}
33
39template <typename AtomRange, typename T = real_t>
40inline std::size_t fillPositionBlock(const FillPositionBlockParams<AtomRange, T> &params) noexcept {
41 if (params.atoms == nullptr || params.x_s == nullptr || params.y_s == nullptr ||
42 params.z_s == nullptr) {
43 return 0;
44 }
45 const std::size_t count = params.end_idx - params.begin_idx;
46 params.x_s->resize(count);
47 params.y_s->resize(count);
48 params.z_s->resize(count);
49 for (std::size_t idx = 0; idx < count; ++idx) {
50 const auto &pos = (*params.atoms)[params.begin_idx + idx].position();
51 (*params.x_s)[idx] = static_cast<T>(pos.x());
52 (*params.y_s)[idx] = static_cast<T>(pos.y());
53 (*params.z_s)[idx] = static_cast<T>(pos.z());
54 }
55 return count;
56}
57
58} // namespace correlation::math
Low-level AVX2 intrinsic kernel implementations.
Low-level AVX-512 intrinsic kernel implementations.
Common parameter containers, POD types, and scalar helpers for SIMD operations.
Low-level Scalar fallback kernel implementations.
void computeDsqBlock(float ref_x, float ref_y, float ref_z, const PositionBlockT< float > &block, float *out_dsq) noexcept
Definition AVX2Kernels.hpp:21
void computeDsqBlock(float ref_x, float ref_y, float ref_z, const PositionBlockT< float > &block, float *out_dsq) noexcept
Definition ScalarKernels.hpp:17
Defines universal mathematical and physical constants.
std::size_t fillPositionBlock(const FillPositionBlockParams< AtomRange, T > &params) noexcept
Populates vectors with standard atom block positions for SIMD.
Definition SIMDDistance.hpp:40
void computeDsqBlock(T ref_x, T ref_y, T ref_z, const PositionBlockT< T > &block, T *out_dsq) noexcept
Computes squared distances from a reference point to a SoA block of positions.
Definition SIMDDistance.hpp:23
Parameter container for fillPositionBlock kernel invocations.
Definition SIMDTypes.hpp:145
Represents a Structure of Arrays (SoA) block of atom positions for SIMD processing.
Definition SIMDTypes.hpp:27