Skip to content

GeneratorInput<> can't be declared as Halide::float16_t or _Float16 #9008

@derek-gerstmann

Description

@derek-gerstmann

There appears to be some template mismatch that's preventing GeneratorInput's from being declared as float16 types.

Using Halide::float16_t:

Halide.h:28188:31: error: base specifier must name a class
 28188 | class GeneratorInput : public Internal::GeneratorInputImplBase<T> {
       |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 note: in instantiation of template class 'Halide::GeneratorInput<Halide::float16_t>' requested here

Using _Float16:

Halide.h:28188:7: error: invalid use of ‘Halide::Internal::GeneratorInputImplBase<_Float16, _Float16>’ {aka ‘void’}
class GeneratorInput : public Internal::GeneratorInputImplBase<T> {
      ^~~~~~~~~~~~~~
Halide.h:28193:11: error: ‘Halide::GeneratorInput<_Float16>::Super’ {aka ‘void’} is not a class, struct, or union type
using TBase = typename Super::TBase;

This seems to be something about how halide_handle_cplusplus_type is used to match types to type names used in the GeneratorInputImplBase<> class. These are all declared as Simple types (presumably since they are passed by value in the function signature that is generated), but the actual implementation of these types are structs. Maybe that's causing the missing specialization for template expansion?

HALIDE_DECLARE_EXTERN_SIMPLE_TYPE(Halide::float16_t);
HALIDE_DECLARE_EXTERN_SIMPLE_TYPE(Halide::bfloat16_t);
// ...
#ifdef HALIDE_CPP_COMPILER_HAS_FLOAT16
HALIDE_DECLARE_EXTERN_SIMPLE_TYPE(_Float16);
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions