Skip to content

Commit

Permalink
Add conversion code for Float16 that was missed in #8174
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-johnson committed Apr 4, 2024
1 parent 3b8a532 commit 715be86
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/halide_image_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,10 @@ struct ImageTypeConversion {

const halide_type_t src_type = src.type();
switch (src_type.element_of().as_u32()) {
#ifdef HALIDE_CPP_COMPILER_HAS_FLOAT16
case halide_type_t(halide_type_float, 16).as_u32():
return convert_image<DstElemType>(src.template as<_Float16, AnyDims>());
#endif
case halide_type_t(halide_type_float, 32).as_u32():
return convert_image<DstElemType>(src.template as<float, AnyDims>());
case halide_type_t(halide_type_float, 64).as_u32():
Expand Down Expand Up @@ -2272,6 +2276,10 @@ struct ImageTypeConversion {
// Call the appropriate static-to-static conversion routine
// based on the desired dst type.
switch (dst_type.element_of().as_u32()) {
#ifdef HALIDE_CPP_COMPILER_HAS_FLOAT16
case halide_type_t(halide_type_float, 16).as_u32():
return convert_image<_Float16>(src);
#endif
case halide_type_t(halide_type_float, 32).as_u32():
return convert_image<float>(src);
case halide_type_t(halide_type_float, 64).as_u32():
Expand Down

0 comments on commit 715be86

Please sign in to comment.