-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
copiers use PM memcpy equivalent when possible
when possible use the progrmamming model equivalent of memcpy. This had inadvertantly been disabled. This avoids a kernel launch.
- Loading branch information
Showing
10 changed files
with
264 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "hamr_config.h" | ||
#include <type_traits> | ||
|
||
namespace hamr | ||
{ | ||
/// @name type trait that enables object copy | ||
///@{ | ||
template <typename T, typename U, bool val = (!std::is_arithmetic<T>::value || !std::is_arithmetic<U>::value)> struct use_object_copier : std::false_type {}; | ||
template <typename T, typename U> struct use_object_copier<T, U, true> : std::true_type {}; | ||
template <typename T, typename U> using use_object_copier_t = typename std::enable_if<use_object_copier<T,U>::value>::type; | ||
///@} | ||
|
||
|
||
/// @name type trait that enables POD copy from different types | ||
///@{ | ||
#if defined(HAMR_ENABLE_OBJECTS) | ||
template <typename T, typename U, bool val = (!std::is_same<T,U>::value)> struct use_cons_copier : std::false_type {}; | ||
template <typename T, typename U> struct use_cons_copier<T, U, true> : std::true_type {}; | ||
template <typename T, typename U> using use_cons_copier_t = typename std::enable_if<use_cons_copier<T,U>::value>::type; | ||
#else | ||
template <typename T, typename U, bool val = (!std::is_same<T,U>::value && std::is_arithmetic<T>::value)> struct use_cons_copier : std::false_type {}; | ||
template <typename T, typename U> struct use_cons_copier<T, U, true> : std::true_type {}; | ||
template <typename T, typename U> using use_cons_copier_t = typename std::enable_if<use_cons_copier<T,U>::value>::type; | ||
#endif | ||
///@} | ||
|
||
/// @name type trait that enables POD copy from the same types | ||
///@{ | ||
template <typename T, typename U, bool obj = (std::is_same<T,U>::value && std::is_arithmetic<T>::value)> struct use_bytes_copier : std::false_type {}; | ||
template <typename T, typename U> struct use_bytes_copier<T, U, true> : std::true_type {}; | ||
template <typename T, typename U> using use_bytes_copier_t = typename std::enable_if<use_bytes_copier<T,U>::value>::type; | ||
///@} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.