Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Vectorised compact mode #248

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Internal simplification.
  • Loading branch information
bluescarni committed Apr 1, 2022
commit 877b10dc17fcbaa5db1c71ef5f5b4f8656667929
30 changes: 2 additions & 28 deletions include/heyoka/expression.hpp
Original file line number Diff line number Diff line change
@@ -381,35 +381,9 @@ inline llvm::Value *taylor_diff(llvm_state &s, const expression &ex, const std::
}
}

HEYOKA_DLL_PUBLIC llvm::Function *taylor_c_diff_func_dbl(llvm_state &, const expression &, std::uint32_t, std::uint32_t,
bool);

HEYOKA_DLL_PUBLIC llvm::Function *taylor_c_diff_func_ldbl(llvm_state &, const expression &, std::uint32_t,
std::uint32_t, bool);

#if defined(HEYOKA_HAVE_REAL128)

HEYOKA_DLL_PUBLIC llvm::Function *taylor_c_diff_func_f128(llvm_state &, const expression &, std::uint32_t,
std::uint32_t, bool);

#endif

template <typename T>
inline llvm::Function *taylor_c_diff_func(llvm_state &s, const expression &ex, std::uint32_t n_uvars,
std::uint32_t batch_size, bool high_accuracy)
{
if constexpr (std::is_same_v<T, double>) {
return taylor_c_diff_func_dbl(s, ex, n_uvars, batch_size, high_accuracy);
} else if constexpr (std::is_same_v<T, long double>) {
return taylor_c_diff_func_ldbl(s, ex, n_uvars, batch_size, high_accuracy);
#if defined(HEYOKA_HAVE_REAL128)
} else if constexpr (std::is_same_v<T, mppp::real128>) {
return taylor_c_diff_func_f128(s, ex, n_uvars, batch_size, high_accuracy);
#endif
} else {
static_assert(detail::always_false_v<T>, "Unhandled type.");
}
}
HEYOKA_DLL_PUBLIC llvm::Function *taylor_c_diff_func(llvm_state &, const expression &, std::uint32_t, std::uint32_t,
bool);

HEYOKA_DLL_PUBLIC std::uint32_t get_param_size(const expression &);

36 changes: 9 additions & 27 deletions src/expression.cpp
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@

#include <heyoka/detail/llvm_fwd.hpp>
#include <heyoka/detail/type_traits.hpp>
#include <heyoka/detail/visibility.hpp>
#include <heyoka/exceptions.hpp>
#include <heyoka/expression.hpp>
#include <heyoka/func.hpp>
@@ -1336,15 +1337,9 @@ llvm::Value *taylor_diff_f128(llvm_state &s, const expression &ex, const std::ve

#endif

namespace detail
{

namespace
{

template <typename T>
llvm::Function *taylor_c_diff_func_impl(llvm_state &s, const expression &ex, std::uint32_t n_uvars,
std::uint32_t batch_size, bool high_accuracy)
llvm::Function *taylor_c_diff_func(llvm_state &s, const expression &ex, std::uint32_t n_uvars, std::uint32_t batch_size,
bool high_accuracy)
{
if (auto fptr = std::get_if<func>(&ex.value())) {
if constexpr (std::is_same_v<T, double>) {
@@ -1365,29 +1360,16 @@ llvm::Function *taylor_c_diff_func_impl(llvm_state &s, const expression &ex, std
}
}

} // namespace

} // namespace detail

llvm::Function *taylor_c_diff_func_dbl(llvm_state &s, const expression &ex, std::uint32_t n_uvars,
std::uint32_t batch_size, bool high_accuracy)
{
return detail::taylor_c_diff_func_impl<double>(s, ex, n_uvars, batch_size, high_accuracy);
}
template HEYOKA_DLL_PUBLIC llvm::Function *taylor_c_diff_func<double>(llvm_state &, const expression &, std::uint32_t,
std::uint32_t, bool);

llvm::Function *taylor_c_diff_func_ldbl(llvm_state &s, const expression &ex, std::uint32_t n_uvars,
std::uint32_t batch_size, bool high_accuracy)
{
return detail::taylor_c_diff_func_impl<long double>(s, ex, n_uvars, batch_size, high_accuracy);
}
template HEYOKA_DLL_PUBLIC llvm::Function *taylor_c_diff_func<long double>(llvm_state &, const expression &,
std::uint32_t, std::uint32_t, bool);

#if defined(HEYOKA_HAVE_REAL128)

llvm::Function *taylor_c_diff_func_f128(llvm_state &s, const expression &ex, std::uint32_t n_uvars,
std::uint32_t batch_size, bool high_accuracy)
{
return detail::taylor_c_diff_func_impl<mppp::real128>(s, ex, n_uvars, batch_size, high_accuracy);
}
template HEYOKA_DLL_PUBLIC llvm::Function *taylor_c_diff_func<mppp::real128>(llvm_state &, const expression &,
std::uint32_t, std::uint32_t, bool);

#endif