mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-19 20:40:07 +00:00
adding fp16 direct that reads pre-vectorized data
[ROCm/composable_kernel commit: 4f0fc72e91]
This commit is contained in:
@@ -28,44 +28,44 @@ struct vector_type
|
||||
template <>
|
||||
struct vector_type<float, 1>
|
||||
{
|
||||
using type = float;
|
||||
using VectorType = float;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct vector_type<float, 2>
|
||||
{
|
||||
using type = float2;
|
||||
using VectorType = float2;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct vector_type<float, 4>
|
||||
{
|
||||
using type = float4;
|
||||
using VectorType = float4;
|
||||
};
|
||||
|
||||
#if 0
|
||||
template <>
|
||||
struct vector_type<half_float::half, 1>
|
||||
{
|
||||
using type = half_float::half;
|
||||
using VectorType = half_float::half;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct vector_type<half_float::half, 2>
|
||||
{
|
||||
using type = float;
|
||||
using VectorType = float;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct vector_type<half_float::half, 4>
|
||||
{
|
||||
using type = float2;
|
||||
using VectorType = float2;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct vector_type<half_float::half, 8>
|
||||
{
|
||||
using type = float4;
|
||||
using VectorType = float4;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -73,25 +73,41 @@ struct vector_type<half_float::half, 8>
|
||||
template <>
|
||||
struct vector_type<half, 1>
|
||||
{
|
||||
using type = half;
|
||||
using VectorType = half;
|
||||
|
||||
__host__ __device__ static VectorType pack(half s) { return s; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct vector_type<half, 2>
|
||||
{
|
||||
using type = half2;
|
||||
using VectorType = half2;
|
||||
|
||||
union Data
|
||||
{
|
||||
VectorType vector;
|
||||
half scalar[2];
|
||||
};
|
||||
|
||||
__host__ __device__ static VectorType pack(half s0, half s1)
|
||||
{
|
||||
Data data;
|
||||
data.scalar[0] = s0;
|
||||
data.scalar[1] = s1;
|
||||
return data.vector;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct vector_type<half, 4>
|
||||
{
|
||||
using type = float2;
|
||||
using VectorType = float2;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct vector_type<half, 8>
|
||||
{
|
||||
using type = float4;
|
||||
using VectorType = float4;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user