Skip to content

Commit c3cf2a4

Browse files
authored
Add Float16 as a Scalar type option (#180)
* Add Float16
1 parent edd3cac commit c3cf2a4

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

include/Support/Pipeline.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ enum class DataFormat {
4040
Int16,
4141
Int32,
4242
Int64,
43+
Float16,
4344
Float32,
4445
Float64,
4546
Bool,
@@ -88,6 +89,7 @@ struct Buffer {
8889
case DataFormat::Hex16:
8990
case DataFormat::UInt16:
9091
case DataFormat::Int16:
92+
case DataFormat::Float16:
9193
return 2;
9294
case DataFormat::Hex32:
9395
case DataFormat::UInt32:
@@ -340,6 +342,7 @@ template <> struct ScalarEnumerationTraits<offloadtest::DataFormat> {
340342
ENUM_CASE(Int16);
341343
ENUM_CASE(Int32);
342344
ENUM_CASE(Int64);
345+
ENUM_CASE(Float16);
343346
ENUM_CASE(Float32);
344347
ENUM_CASE(Float64);
345348
ENUM_CASE(Bool);

lib/Support/Pipeline.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ void MappingTraits<offloadtest::Buffer>::mapping(IO &I,
127127
DATA_CASE(Int16, int16_t)
128128
DATA_CASE(Int32, int32_t)
129129
DATA_CASE(Int64, int64_t)
130+
DATA_CASE(Float16, uint16_t)
130131
DATA_CASE(Float32, float)
131132
DATA_CASE(Float64, double)
132133
DATA_CASE(Bool, uint32_t) // Because sizeof(bool) is 1 but HLSL represents a bool using 4 bytes.

0 commit comments

Comments
 (0)