Updates for 3.0 (#857)
Co-authored-by: Aniket Shivam <ashivam@nvidia.com>
This commit is contained in:
co-authored by
Aniket Shivam
parent
a68e2f95f0
commit
c4f6b8c6bc
@@ -52,7 +52,10 @@ template <
|
||||
/// Element type
|
||||
typename T,
|
||||
/// Number of elements in the array
|
||||
int N
|
||||
int N,
|
||||
/// Whether the element type of T is half_t or __half
|
||||
bool IsHalfType = (platform::is_same<typename T::element_type, cutlass::half_t>::value ||
|
||||
platform::is_same<typename T::element_type, __half>::value)
|
||||
>
|
||||
class WmmaFragmentArray: public Array<T, N, true> {
|
||||
public:
|
||||
@@ -80,7 +83,44 @@ public:
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
/// Partial specialization for the case in which T::element_type is
|
||||
/// half_t or __half. This is needed because the cast (typename T::element_type)0
|
||||
/// in the primary template flags as an error when __CUDA_NO_HALF_CONVERSIONS__
|
||||
/// is set.
|
||||
template <
|
||||
/// Element type
|
||||
typename T,
|
||||
/// Number of elements in the array
|
||||
int N
|
||||
>
|
||||
class WmmaFragmentArray<T, N, true>: public Array<T, N, true> {
|
||||
public:
|
||||
|
||||
/// Efficient clear method (override Array::clear())
|
||||
CUTLASS_HOST_DEVICE
|
||||
void clear()
|
||||
{
|
||||
for(int i = 0; i < Array<T, N, true>::kElements; i++)
|
||||
{
|
||||
nvcuda::wmma::fill_fragment((*this)[i], __float2half(0.f));
|
||||
}
|
||||
}
|
||||
|
||||
CUTLASS_HOST_DEVICE
|
||||
WmmaFragmentArray<T, N>& operator+=(const WmmaFragmentArray<T, N>& rhs)
|
||||
{
|
||||
using element_type = typename T::element_type;
|
||||
plus<T> add;
|
||||
|
||||
for (int i = 0; i < Array<T, N, true>::kElements; i++)
|
||||
{
|
||||
(*this)[i] = add((*this)[i], rhs[i]);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user