@@ -11,21 +11,14 @@ namespace quda
1111 static constexpr int size = prefetch;
1212 };
1313
14- /* *
15- @brief Element type used for coalesced storage.
16- */
17- template <typename T>
18- using atom_t = std::conditional_t <sizeof (T) % 16 == 0 , int4, std::conditional_t <sizeof (T) % 8 == 0 , int2, int >>;
19-
2014 /* *
2115 @brief Non-specialized load operation
2216 */
2317 template <bool is_device> struct vector_load_impl {
2418 template <typename T, size_t prefetch_size>
2519 __device__ __host__ inline void operator ()(T &value, const void *ptr, int idx, const prefetch_t <prefetch_size> &)
2620 {
27- // value = reinterpret_cast<const T *>(ptr)[idx];
28- memcpy (&value, static_cast <const T *>(ptr) + idx, sizeof (value));
21+ value = reinterpret_cast <const T *>(ptr)[idx];
2922 }
3023 };
3124
@@ -60,12 +53,11 @@ namespace quda
6053 template <bool is_device> struct vector_store_impl {
6154 template <typename T> __device__ __host__ inline void operator ()(void *ptr, int idx, const T &value)
6255 {
63- // reinterpret_cast<T *>(ptr)[idx] = value;
64- memcpy (static_cast <T *>(ptr) + idx, &value, sizeof (value));
56+ reinterpret_cast <T *>(ptr)[idx] = value;
6557 }
6658 };
6759
68- template <typename vector_t > __device__ __host__ inline void vector_storeV (void *ptr, int idx, const vector_t &value)
60+ template <typename vector_t > __device__ __host__ inline void vector_store (void *ptr, int idx, const vector_t &value)
6961 {
7062 target::dispatch<vector_store_impl>(ptr, idx, value);
7163 }
@@ -77,9 +69,7 @@ namespace quda
7769 vector_t value_v;
7870 static_assert (sizeof (value_a) == sizeof (value_v), " array type and vector type are different sizes" );
7971 memcpy (&value_v, &value_a, sizeof (vector_t ));
80- // vector_storeV<vector_t>(ptr, idx, value_v);
81- scalar_t *a = static_cast <scalar_t *>(ptr) + N * idx;
82- memcpy (a, &value_v, sizeof (value_v));
72+ vector_store<vector_t >(ptr, idx, value_v);
8373 }
8474
8575 template <typename scalar_t , int N>
0 commit comments