File indexing completed on 2026-07-26 08:21:57
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "traccc/definitions/qualifiers.hpp"
0011
0012
0013 #if defined(CL_SYCL_LANGUAGE_VERSION) || defined(SYCL_LANGUAGE_VERSION)
0014 #include <sycl/sycl.hpp>
0015 #endif
0016
0017
0018 #include <cmath>
0019
0020 namespace traccc::math {
0021
0022 #if defined(CL_SYCL_LANGUAGE_VERSION) || defined(SYCL_LANGUAGE_VERSION)
0023 using ::sycl::abs;
0024 using ::sycl::acos;
0025 using ::sycl::asin;
0026 using ::sycl::atan;
0027 using ::sycl::atan2;
0028 using ::sycl::cos;
0029 using ::sycl::exp;
0030 using ::sycl::fabs;
0031 using ::sycl::floor;
0032 using ::sycl::fmod;
0033 using ::sycl::log;
0034 using ::sycl::max;
0035 using ::sycl::min;
0036 using ::sycl::pow;
0037 using ::sycl::sin;
0038 using ::sycl::sqrt;
0039 using ::sycl::tan;
0040 #else
0041 using std::abs;
0042 using std::acos;
0043 using std::asin;
0044 using std::atan;
0045 using std::atan2;
0046 using std::cos;
0047 using std::exp;
0048 using std::fabs;
0049 using std::floor;
0050 using std::fmod;
0051 using std::log;
0052 using std::max;
0053 using std::min;
0054 using std::pow;
0055 using std::sin;
0056 using std::sqrt;
0057 using std::tan;
0058 #endif
0059
0060
0061
0062
0063
0064
0065 template <typename T>
0066 TRACCC_HOST_DEVICE inline __attribute__((always_inline)) T div_ieee754(T x,
0067 T y) {
0068 static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>);
0069 #ifdef __CUDA_ARCH__
0070 if constexpr (std::is_same_v<T, double>) {
0071 return __ddiv_rn(x, y);
0072 } else {
0073 return __fdiv_rn(x, y);
0074 }
0075 #else
0076 return x / y;
0077 #endif
0078 }
0079 }