#include "Halide.h"
#include <stdio.h>
int main(int argc, char **argv) {
Type valid_halide_types[] = {
{
assert(
UInt(8).bits() == 8);
}
{
for (
Type t : valid_halide_types) {
assert((e + e).type() == e.
type());
}
assert((u8 + f32).type() ==
Float(32));
assert((f32 + s64).type() ==
Float(32));
assert((u16 + f64).type() ==
Float(64));
assert((f64 + s32).type() ==
Float(64));
assert((f64 + f32).type() ==
Float(64));
assert((u32 + 3).type() ==
UInt(32));
assert((3 + s16).type() ==
Int(16));
assert((u32 + u8).type() ==
UInt(32));
assert((s16 + s64).type() ==
Int(64));
assert((u8 + s32).type() ==
Int(32));
assert((u32 + s8).type() ==
Int(32));
assert((u32 + s32).type() ==
Int(32));
assert(result32 == 255);
assert(result16 == 65535);
}
{
assert(
Handle().bits() == 64);
}
{
assert(average(x, 3).type() ==
Int(32));
}
printf("Success!\n");
return 0;
}
return (a + b) / 2;
}
return cast(narrow, (a + b) / 2);
}
const std::vector< Type > & types() const
A Halide variable, to be used when defining functions.
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Type UInt(int bits, int lanes=1)
Constructing an unsigned integer type.
Type Float(int bits, int lanes=1)
Construct a floating-point type.
Type type_of()
Construct the halide equivalent of a C type.
Expr sin(Expr x)
Return the sine of a floating-point expression.
Type Int(int bits, int lanes=1)
Constructing a signed integer type.
Type Handle(int lanes=1, const halide_handle_cplusplus_type *handle_type=nullptr)
Construct a handle type.
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.
HALIDE_NO_USER_CODE_INLINE T evaluate(JITUserContext *ctx, const Expr &e)
JIT-Compile and run enough code to evaluate a Halide expression.
signed __INT32_TYPE__ int32_t
unsigned __INT16_TYPE__ uint16_t
A fragment of Halide syntax.
HALIDE_ALWAYS_INLINE Type type() const
Get the type of this expression node.
Types in the halide type system.
Type with_bits(int new_bits) const
Return Type with same type code and lanes, but new_bits for the number of bits.
HALIDE_ALWAYS_INLINE int bits() const
Return the bit size of a single element of this type.
HALIDE_ALWAYS_INLINE bool is_handle() const
Is this type an opaque handle type (void *)
HALIDE_ALWAYS_INLINE bool is_float() const
Is this type a floating point type (float or double).