Skip to content
Snippets Groups Projects
Commit 1992ac67 authored by Charles Villard's avatar Charles Villard Committed by Maxence Naud
Browse files

fix: TensorImpl: Enable if on return type instead of parameter

parent f5dbfb26
No related branches found
No related tags found
2 merge requests!75Update 0.5.1 -> 0.6.0,!40Fix template compilation and warnings
......@@ -22,10 +22,15 @@ namespace Aidge {
template <typename SRC_T, typename DST_T>
void thrust_copy(const SRC_T* /*srcData*/, DST_T* /*dstData*/, size_t /*size*/);
template <typename SRC_T, typename std::enable_if<!std::is_same<half_float::half, SRC_T>::value>::type* = nullptr>
void thrust_copy(const SRC_T* srcData, half_float::half* dstData, size_t size);
template <typename DST_T, typename std::enable_if<!std::is_same<half_float::half, DST_T>::value>::type* = nullptr>
void thrust_copy(const half_float::half* srcData, DST_T* dstData, size_t size);
template <typename SRC_T>
typename std::enable_if<!std::is_same<half_float::half, SRC_T>::value>::type
thrust_copy(const SRC_T *srcData, half_float::half *dstData, size_t size);
template <typename DST_T>
typename std::enable_if<!std::is_same<half_float::half, DST_T>::value>::type
thrust_copy(const half_float::half* srcData, DST_T* dstData, size_t size);
template <>
void thrust_copy(const half_float::half* srcData, half_float::half* dstData, size_t size);
......
......@@ -36,8 +36,9 @@ cudaCopyToH_kernel(const SRC_T* srcData,
}
}
template <typename SRC_T, typename std::enable_if<!std::is_same<half_float::half, SRC_T>::value>::type*>
void Aidge::thrust_copy(const SRC_T* srcData, half_float::half* dstData, size_t size)
template <typename SRC_T>
typename std::enable_if<!std::is_same<half_float::half, SRC_T>::value>::type
Aidge::thrust_copy(const SRC_T* srcData, half_float::half* dstData, size_t size)
{
cudaCopyToH_kernel<SRC_T><<<(size + 255) / 256, 256>>>
(srcData, reinterpret_cast<__half*>(dstData), size);
......@@ -58,8 +59,9 @@ cudaCopyFromH_kernel(const __half* srcData,
}
}
template <typename DST_T, typename std::enable_if<!std::is_same<half_float::half, DST_T>::value>::type*>
void Aidge::thrust_copy(const half_float::half* srcData, DST_T* dstData, size_t size)
template <typename DST_T>
typename std::enable_if<!std::is_same<half_float::half, DST_T>::value>::type
Aidge::thrust_copy(const half_float::half* srcData, DST_T* dstData, size_t size)
{
cudaCopyFromH_kernel<DST_T><<<(size + 255) / 256, 256>>>
(reinterpret_cast<const __half*>(srcData), dstData, size);
......@@ -230,4 +232,4 @@ template void Aidge::thrust_copy<>(uint8_t const*, int8_t*, size_t);
template void Aidge::thrust_copy<>(uint8_t const*, uint64_t*, size_t);
template void Aidge::thrust_copy<>(uint8_t const*, uint32_t*, size_t);
template void Aidge::thrust_copy<>(uint8_t const*, uint16_t*, size_t);
template void Aidge::thrust_copy<>(uint8_t const*, uint8_t*, size_t);
\ No newline at end of file
template void Aidge::thrust_copy<>(uint8_t const*, uint8_t*, size_t);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment