Commit 649af8b2 authored by Jing Zhang's avatar Jing Zhang
Browse files

simply vector type At

parent 159559c1
...@@ -197,7 +197,7 @@ struct ThreadwiseGenericTensorSliceCopy_v5 ...@@ -197,7 +197,7 @@ struct ThreadwiseGenericTensorSliceCopy_v5
ThreadBufferDesc::CalculateOffset(to_multi_index(long_vector_data_begin_id)) / ThreadBufferDesc::CalculateOffset(to_multi_index(long_vector_data_begin_id)) /
long_vector_size; long_vector_size;
thread_buff.template At<SrcDataPerRead>()(Number<buff_off>{}) = src_buff; thread_buff.At(Number<SrcDataPerRead>{})(Number<buff_off>{}) = src_buff;
}); });
} }
...@@ -225,7 +225,7 @@ struct ThreadwiseGenericTensorSliceCopy_v5 ...@@ -225,7 +225,7 @@ struct ThreadwiseGenericTensorSliceCopy_v5
ThreadBufferDesc::CalculateOffset(to_multi_index(long_vector_data_begin_id)) / ThreadBufferDesc::CalculateOffset(to_multi_index(long_vector_data_begin_id)) /
long_vector_size; long_vector_size;
auto src_buff = thread_buff.template At<DstDataPerWrite>()[Number<buff_off>{}]; auto src_buff = thread_buff.At(Number<DstDataPerWrite>{})[Number<buff_off>{}];
const auto dst_coord = mDstSliceOrigin + to_multi_index(long_vector_data_begin_id); const auto dst_coord = mDstSliceOrigin + to_multi_index(long_vector_data_begin_id);
......
...@@ -37,22 +37,22 @@ union float_vec4_t ...@@ -37,22 +37,22 @@ union float_vec4_t
__host__ __device__ constexpr float_vec4_t() {} __host__ __device__ constexpr float_vec4_t() {}
template <index_t vs> template <index_t vs>
__host__ __device__ auto& At(); __host__ __device__ auto& At(Number<vs>);
template <> template <>
__host__ __device__ auto& At<1>() __host__ __device__ auto& At(Number<1>)
{ {
return s1; return s1;
} }
template <> template <>
__host__ __device__ auto& At<2>() __host__ __device__ auto& At(Number<2>)
{ {
return s2; return s2;
} }
template <> template <>
__host__ __device__ auto& At<4>() __host__ __device__ auto& At(Number<4>)
{ {
return s4; return s4;
} }
...@@ -67,28 +67,28 @@ union float_vec8_t ...@@ -67,28 +67,28 @@ union float_vec8_t
__host__ __device__ constexpr float_vec8_t() {} __host__ __device__ constexpr float_vec8_t() {}
template <index_t vs> template <index_t vs>
__host__ __device__ auto& At(); __host__ __device__ auto& At(Number<vs>);
template <> template <>
__host__ __device__ auto& At<1>() __host__ __device__ auto& At(Number<1>)
{ {
return s1; return s1;
} }
template <> template <>
__host__ __device__ auto& At<2>() __host__ __device__ auto& At(Number<2>)
{ {
return s2; return s2;
} }
template <> template <>
__host__ __device__ auto& At<4>() __host__ __device__ auto& At(Number<4>)
{ {
return s4; return s4;
} }
template <> template <>
__host__ __device__ auto& At<8>() __host__ __device__ auto& At(Number<8>)
{ {
return s8; return s8;
} }
...@@ -104,34 +104,34 @@ union float_vec16_t ...@@ -104,34 +104,34 @@ union float_vec16_t
__host__ __device__ constexpr float_vec16_t() {} __host__ __device__ constexpr float_vec16_t() {}
template <index_t vs> template <index_t vs>
__host__ __device__ auto& At(); __host__ __device__ auto& At(Number<vs>);
template <> template <>
__host__ __device__ auto& At<1>() __host__ __device__ auto& At(Number<1>)
{ {
return s1; return s1;
} }
template <> template <>
__host__ __device__ auto& At<2>() __host__ __device__ auto& At(Number<2>)
{ {
return s2; return s2;
} }
template <> template <>
__host__ __device__ auto& At<4>() __host__ __device__ auto& At(Number<4>)
{ {
return s4; return s4;
} }
template <> template <>
__host__ __device__ auto& At<8>() __host__ __device__ auto& At(Number<8>)
{ {
return s8; return s8;
} }
template <> template <>
__host__ __device__ auto& At<16>() __host__ __device__ auto& At(Number<16>)
{ {
return s16; return s16;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment