Skip to content

Commit

Permalink
Fix cuda device host constexpr execute functions declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 authored and MihailMihov committed Oct 27, 2024
1 parent a2587a4 commit 781c08e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions include/clad/Differentiator/Differentiator.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,9 @@ CUDA_HOST_DEVICE T push(tape<T>& to, ArgsT... val) {
constexpr CladFunctionType getFunctionPtr() const { return m_Function; }

template <typename... Args, class FnType = CladFunctionType>
typename std::enable_if<
!std::is_same<FnType, NoFunction*>::value,
return_type_t<F>>::type constexpr execute(Args&&... args)
CUDA_HOST_DEVICE const {
typename std::enable_if<!std::is_same<FnType, NoFunction*>::value,
return_type_t<F>>::type constexpr CUDA_HOST_DEVICE
execute(Args&&... args) const {
if (!m_Function)
return static_cast<return_type_t<F>>(return_type_t<F>());
if (m_CUDAkernel) {
Expand Down Expand Up @@ -313,10 +312,9 @@ CUDA_HOST_DEVICE T push(tape<T>& to, ArgsT... val) {
/// Error handling is handled in the clad side using clang diagnostics
/// subsystem.
template <typename... Args, class FnType = CladFunctionType>
typename std::enable_if<
std::is_same<FnType, NoFunction*>::value,
return_type_t<F>>::type constexpr execute(Args&&... args)
CUDA_HOST_DEVICE const {
typename std::enable_if<std::is_same<FnType, NoFunction*>::value,
return_type_t<F>>::type constexpr CUDA_HOST_DEVICE
execute(Args&&... args) const {
return static_cast<return_type_t<F>>(0);
}

Expand Down

0 comments on commit 781c08e

Please sign in to comment.