1#ifndef HALIDE_IR_MATCH_H
2#define HALIDE_IR_MATCH_H
139 typename =
typename std::remove_reference<T>::type::pattern_tag>
146 constexpr static uint32_t mask = std::remove_reference<T>::type::binds;
204 template<u
int32_t bound>
232 template<u
int32_t bound>
234 static_assert(
i >= 0 &&
i <
max_wild,
"Wild with out-of-range index");
237 op = ((
const Broadcast *)op)->value.get();
246 state.get_bound_const(
i, val, type);
249 state.set_bound_const(
i, value, e.type);
253 template<u
int32_t bound>
255 static_assert(
i >= 0 &&
i <
max_wild,
"Wild with out-of-range index");
259 state.get_bound_const(
i, val, type);
260 return type == i64_type && value == val.
u.
i64;
262 state.set_bound_const(
i, value, i64_type);
298 template<u
int32_t bound>
300 static_assert(
i >= 0 &&
i <
max_wild,
"Wild with out-of-range index");
303 op = ((
const Broadcast *)op)->value.get();
312 state.get_bound_const(
i, val, type);
315 state.set_bound_const(
i, value, e.type);
331 state.get_bound_const(
i, val,
ty);
351 template<u
int32_t bound>
353 static_assert(
i >= 0 &&
i <
max_wild,
"Wild with out-of-range index");
356 op = ((
const Broadcast *)op)->value.get();
361 double value = ((
const FloatImm *)op)->value;
365 state.get_bound_const(
i, val, type);
368 state.set_bound_const(
i, value, e.type);
384 state.get_bound_const(
i, val,
ty);
405 template<u
int32_t bound>
407 static_assert(
i >= 0 &&
i <
max_wild,
"Wild with out-of-range index");
410 op = ((
const Broadcast *)op)->value.get();
424 template<u
int32_t bound>
426 static_assert(
i >= 0 &&
i <
max_wild,
"Wild with out-of-range index");
442 state.get_bound_const(
i, val,
ty);
463 template<u
int32_t bound>
466 return equal(*state.get_binding(
i), e);
468 state.set_binding(
i, e);
503 template<u
int32_t bound>
507 op = ((
const Broadcast *)op)->value.get();
515 return ((
const FloatImm *)op)->value == (
double)
v;
521 template<u
int32_t bound>
526 template<u
int32_t bound>
566 typename =
typename std::decay<T>::type::pattern_tag>
577 static_assert(!std::is_same<typename std::decay<T>::type,
Expr>::value || std::is_lvalue_reference<T>::value,
578 "Exprs are captured by reference by IRMatcher objects and so must be lvalues");
589 typename =
typename std::decay<T>::type::pattern_tag,
591 typename =
typename std::enable_if<!std::is_same<typename std::decay<T>::type, SpecificExpr>::value>::type>
627template<
typename Op,
typename A,
typename B>
642 A::canonical && B::canonical && (!
commutative(Op::_node_type) || (A::max_node_type >= B::min_node_type));
644 template<u
int32_t bound>
646 if (e.node_type != Op::_node_type) {
649 const Op &op = (
const Op &)e;
654 template<u
int32_t bound,
typename Op2,
typename A2,
typename B2>
656 return (std::is_same<Op, Op2>::value &&
661 constexpr static bool foldable = A::foldable && B::foldable;
666 if (std::is_same<A, IntLiteral>::value) {
667 b.make_folded_const(
val_b,
ty, state);
668 if ((std::is_same<Op, And>::value &&
val_b.u.u64 == 0) ||
669 (std::is_same<Op, Or>::value &&
val_b.u.u64 == 1)) {
675 a.make_folded_const(
val_a,
ty, state);
678 a.make_folded_const(
val_a,
ty, state);
679 if ((std::is_same<Op, And>::value &&
val_a.u.u64 == 0) ||
680 (std::is_same<Op, Or>::value &&
val_a.u.u64 == 1)) {
686 b.make_folded_const(
val_b,
ty, state);
709 if (std::is_same<A, IntLiteral>::value) {
711 ea =
a.make(state,
eb.type());
714 eb =
b.make(state,
ea.type());
716 return Op::make(std::move(
ea), std::move(
eb));
730template<
typename Op,
typename A,
typename B>
742 (!
commutative(Op::_node_type) || A::max_node_type >= B::min_node_type) &&
746 template<u
int32_t bound>
748 if (e.node_type != Op::_node_type) {
751 const Op &op = (
const Op &)e;
756 template<u
int32_t bound,
typename Op2,
typename A2,
typename B2>
758 return (std::is_same<Op, Op2>::value &&
763 constexpr static bool foldable = A::foldable && B::foldable;
769 if (std::is_same<A, IntLiteral>::value) {
770 b.make_folded_const(
val_b,
ty, state);
772 a.make_folded_const(
val_a,
ty, state);
775 a.make_folded_const(
val_a,
ty, state);
777 b.make_folded_const(
val_b,
ty, state);
803 if (std::is_same<A, IntLiteral>::value) {
804 eb =
b.make(state, {});
805 ea =
a.make(state,
eb.type());
807 ea =
a.make(state, {});
808 eb =
b.make(state,
ea.type());
810 return Op::make(std::move(
ea), std::move(
eb));
814template<
typename A,
typename B>
816 s <<
"(" << op.
a <<
" + " << op.
b <<
")";
820template<
typename A,
typename B>
822 s <<
"(" << op.
a <<
" - " << op.
b <<
")";
826template<
typename A,
typename B>
828 s <<
"(" << op.
a <<
" * " << op.
b <<
")";
832template<
typename A,
typename B>
834 s <<
"(" << op.
a <<
" / " << op.
b <<
")";
838template<
typename A,
typename B>
840 s <<
"(" << op.
a <<
" && " << op.
b <<
")";
844template<
typename A,
typename B>
846 s <<
"(" << op.
a <<
" || " << op.
b <<
")";
850template<
typename A,
typename B>
852 s <<
"min(" << op.
a <<
", " << op.
b <<
")";
856template<
typename A,
typename B>
858 s <<
"max(" << op.
a <<
", " << op.
b <<
")";
862template<
typename A,
typename B>
864 s <<
"(" << op.
a <<
" <= " << op.
b <<
")";
868template<
typename A,
typename B>
870 s <<
"(" << op.
a <<
" < " << op.
b <<
")";
874template<
typename A,
typename B>
876 s <<
"(" << op.
a <<
" >= " << op.
b <<
")";
880template<
typename A,
typename B>
882 s <<
"(" << op.
a <<
" > " << op.
b <<
")";
886template<
typename A,
typename B>
888 s <<
"(" << op.
a <<
" == " << op.
b <<
")";
892template<
typename A,
typename B>
894 s <<
"(" << op.
a <<
" != " << op.
b <<
")";
898template<
typename A,
typename B>
900 s <<
"(" << op.
a <<
" % " << op.
b <<
")";
904template<
typename A,
typename B>
911template<
typename A,
typename B>
929 return (a + b) & (
ones >> (64 - t.bits));
937template<
typename A,
typename B>
944template<
typename A,
typename B>
962 return (a - b) & (
ones >> (64 - t.bits));
970template<
typename A,
typename B>
977template<
typename A,
typename B>
995 return (a * b) & (
ones >> (64 - t.bits));
1003template<
typename A,
typename B>
1010template<
typename A,
typename B>
1030template<
typename A,
typename B>
1037template<
typename A,
typename B>
1059template<
typename A,
typename B>
1068 return std::min(a, b);
1073 return std::min(a, b);
1078 return std::min(a, b);
1081template<
typename A,
typename B>
1090 return std::max(a, b);
1095 return std::max(a, b);
1100 return std::max(a, b);
1103template<
typename A,
typename B>
1108template<
typename A,
typename B>
1128template<
typename A,
typename B>
1133template<
typename A,
typename B>
1153template<
typename A,
typename B>
1158template<
typename A,
typename B>
1178template<
typename A,
typename B>
1183template<
typename A,
typename B>
1203template<
typename A,
typename B>
1208template<
typename A,
typename B>
1228template<
typename A,
typename B>
1233template<
typename A,
typename B>
1253template<
typename A,
typename B>
1258template<
typename A,
typename B>
1279template<
typename A,
typename B>
1284template<
typename A,
typename B>
1309template<
typename...
Args>
1318template<
typename...
Args>
1325 return a < b ? a : b;
1328template<
typename...
Args>
1346 typename =
typename std::enable_if<(
i <
sizeof...(Args))>::type>
1348 using T =
decltype(std::get<i>(
args));
1353 template<
int i, u
int32_t binds>
1358 template<u
int32_t bound>
1370 typename =
typename std::enable_if<(
i <
sizeof...(Args))>::type>
1373 if (
i + 1 <
sizeof...(
Args)) {
1427 return std::move(
arg0) << std::move(
arg1);
1429 return std::move(
arg0) >> std::move(
arg1);
1455 std::get<0>(
args).make_folded_const(val,
ty, state);
1463 if (
arg1.u.i64 < 0) {
1466 val.u.i64 >>= -
arg1.u.i64;
1469 val.u.u64 >>= -
arg1.u.i64;
1472 val.u.u64 <<=
arg1.u.i64;
1475 if (
arg1.u.i64 > 0) {
1478 val.u.i64 >>=
arg1.u.i64;
1481 val.u.u64 >>=
arg1.u.i64;
1484 val.u.u64 <<= -
arg1.u.i64;
1497template<
typename...
Args>
1505template<
typename...
Args>
1510template<
typename A,
typename B>
1514template<
typename A,
typename B>
1518template<
typename A,
typename B>
1523template<
typename A,
typename B>
1527template<
typename A,
typename B>
1531template<
typename A,
typename B>
1535template<
typename A,
typename B>
1539template<
typename A,
typename B>
1549template<
typename A,
typename B>
1553template<
typename A,
typename B>
1557template<
typename A,
typename B>
1561template<
typename A,
typename B>
1565template<
typename A,
typename B>
1569template<
typename A,
typename B>
1573template<
typename A,
typename B>
1577template<
typename A,
typename B,
typename C>
1581template<
typename A,
typename B,
typename C>
1597 template<u
int32_t bound>
1602 const Not &op = (
const Not &)e;
1606 template<u
int32_t bound,
typename A2>
1618 template<
typename A1 = A>
1620 a.make_folded_const(val,
ty, state);
1621 val.u.u64 =
~val.u.u64;
1640 s <<
"!(" << op.
a <<
")";
1644template<
typename C,
typename T,
typename F>
1656 constexpr static bool canonical = C::canonical && T::canonical && F::canonical;
1658 template<u
int32_t bound>
1668 template<u
int32_t bound,
typename C2,
typename T2,
typename F2>
1680 constexpr static bool foldable = C::foldable && T::foldable && F::foldable;
1682 template<
typename C1 = C>
1687 if ((
c_val.u.u64 & 1) == 1) {
1688 t.make_folded_const(val,
ty, state);
1690 f.make_folded_const(val,
ty, state);
1696template<
typename C,
typename T,
typename F>
1698 s <<
"select(" << op.
c <<
", " << op.
t <<
", " << op.
f <<
")";
1702template<
typename C,
typename T,
typename F>
1710template<
typename A,
typename B>
1721 constexpr static bool canonical = A::canonical && B::canonical;
1723 template<u
int32_t bound>
1735 template<u
int32_t bound,
typename A2,
typename B2>
1758 template<
typename A1 = A>
1764 a.make_folded_const(val,
ty, state);
1769template<
typename A,
typename B>
1771 s <<
"broadcast(" << op.
a <<
", " << op.
lanes <<
")";
1775template<
typename A,
typename B>
1781template<
typename A,
typename B,
typename C>
1793 constexpr static bool canonical = A::canonical && B::canonical && C::canonical;
1795 template<u
int32_t bound>
1810 template<u
int32_t bound,
typename A2,
typename B2,
typename C2>
1826 ea =
a.make(state,
eb.type());
1833template<
typename A,
typename B,
typename C>
1835 s <<
"ramp(" << op.
a <<
", " << op.
b <<
", " << op.
lanes <<
")";
1839template<
typename A,
typename B,
typename C>
1847template<
typename A,
typename B, VectorReduce::Operator reduce_op>
1859 template<u
int32_t bound>
1872 template<u
int32_t bound,
typename A2,
typename B2, VectorReduce::Operator reduce_op_2>
1891template<
typename A,
typename B, VectorReduce::Operator reduce_op>
1893 s <<
"vector_reduce(" <<
reduce_op <<
", " << op.
a <<
", " << op.
lanes <<
")";
1897template<
typename A,
typename B>
1903template<
typename A,
typename B>
1909template<
typename A,
typename B>
1915template<
typename A,
typename B>
1921template<
typename A,
typename B>
1939 template<u
int32_t bound>
1944 const Sub &op = (
const Sub &)e;
1949 template<u
int32_t bound,
typename A2>
1963 template<
typename A1 = A>
1965 a.make_folded_const(val,
ty, state);
1969 if (
ty.bits >= 32 && val.u.u64 && (val.u.u64 << (65 -
ty.bits)) == 0) {
1982 val.u.f64 = -val.u.f64;
2021 template<u
int32_t bound>
2027 return (e.type ==
t &&
2030 template<u
int32_t bound,
typename A2>
2037 return cast(
t,
a.make(state, {}));
2045 s <<
"cast(" << op.
t <<
", " << op.
a <<
")";
2066 template<u
int32_t bound>
2075 template<u
int32_t bound,
typename A2>
2082 Expr e =
a.make(state, {});
2084 return cast(w, std::move(e));
2092 s <<
"widen(" << op.
a <<
")";
2102template<
typename Vec,
typename Base,
typename Str
ide,
typename Lanes>
2110 static constexpr uint32_t binds = Vec::binds | Base::binds | Stride::binds | Lanes::binds;
2114 constexpr static bool canonical = Vec::canonical && Base::canonical && Stride::canonical && Lanes::canonical;
2116 template<u
int32_t bound>
2122 return v.
vectors.size() == 1 &&
2148 static_assert(Base::foldable,
"Base of slice should consist only of operations that constant-fold");
2149 static_assert(Stride::foldable,
"Stride of slice should consist only of operations that constant-fold");
2150 static_assert(Lanes::foldable,
"Lanes of slice should consist only of operations that constant-fold");
2154template<
typename Vec,
typename Base,
typename Str
ide,
typename Lanes>
2156 s <<
"slice(" << op.
vec <<
", " << op.
base <<
", " << op.
stride <<
", " << op.
lanes <<
")";
2160template<
typename Vec,
typename Base,
typename Str
ide,
typename Lanes>
2181 a.make_folded_const(c,
ty, state);
2202 template<
typename A1 = A>
2204 a.make_folded_const(val,
ty, state);
2216 s <<
"fold(" << op.
a <<
")";
2235 template<
typename A1 = A>
2237 a.make_folded_const(val,
ty, state);
2253 s <<
"overflows(" << op.
a <<
")";
2267 template<u
int32_t bound>
2313 template<
typename A1 = A>
2315 Expr e =
a.make(state, {});
2342 s <<
"is_const(" << op.
a <<
")";
2344 s <<
"is_const(" << op.
a <<
", " << op.
v <<
")";
2349template<
typename A,
typename Prover>
2366 Expr condition =
a.make(state, {});
2367 condition =
prover->mutate(condition,
nullptr);
2375template<
typename A,
typename Prover>
2381template<
typename A,
typename Prover>
2383 s <<
"can_prove(" << op.
a <<
")";
2404 Type t =
a.make(state, {}).type();
2420 s <<
"is_float(" << op.
a <<
")";
2442 Type t =
a.make(state, {}).type();
2458 s <<
"is_int(" << op.
a;
2460 s <<
", " << op.
bits;
2487 Type t =
a.make(state, {}).type();
2503 s <<
"is_uint(" << op.
a;
2505 s <<
", " << op.
bits;
2531 Type t =
a.make(state, {}).type();
2547 s <<
"is_scalar(" << op.
a <<
")";
2568 a.make_folded_const(val,
ty, state);
2588 s <<
"is_max_value(" << op.
a <<
")";
2609 a.make_folded_const(val,
ty, state);
2631 s <<
"is_min_value(" << op.
a <<
")";
2652 Type t =
a.make(state, {}).type();
2668 s <<
"lanes_of(" << op.
a <<
")";
2676 typename =
typename std::enable_if<std::decay<Before>::type::foldable &&
2677 std::decay<After>::type::foldable>::type>
2682 wildcard_type.lanes = output_type.lanes = 1;
2685 static std::set<uint32_t>
tested;
2692 debug(0) <<
"validate('" <<
before <<
"', '" <<
after <<
"', '" <<
pred <<
"', " <<
Type(wildcard_type) <<
", " <<
Type(output_type) <<
")\n";
2697 static std::mt19937_64 rng(0);
2706 int shift = (
int)(rng() & (wildcard_type.bits - 1));
2710 switch (wildcard_type.code) {
2730 double val = ((
int64_t)(rng() & 15) - 8) / 2.0;
2732 val = ((
int64_t)(rng() & 15) - 8) / 2.0;
2749 lanes |= type.
lanes;
2756 switch (output_type.code) {
2771 ok &= (error < 0.01 ||
2781 debug(0) <<
"Fails with values:\n";
2801 typename =
typename std::enable_if<!(std::decay<Before>::type::foldable &&
2802 std::decay<After>::type::foldable)>::type>
2814 typename =
typename enable_if_pattern<Pattern>::type>
2818 p.make_folded_const(c,
ty, state);
2826#define HALIDE_DEBUG_MATCHED_RULES 0
2827#define HALIDE_DEBUG_UNMATCHED_RULES 0
2833#define HALIDE_FUZZ_TEST_RULES 0
2835template<
typename Instance>
2848 template<
typename After>
2850#if HALIDE_DEBUG_MATCHED_RULES
2856 template<
typename Before,
2861 static_assert((Before::binds & After::binds) == After::binds,
"Rule result uses unbound values");
2862 static_assert(Before::canonical,
"LHS of rewrite rule should be in canonical form");
2863 static_assert(After::canonical,
"RHS of rewrite rule should be in canonical form");
2864#if HALIDE_FUZZ_TEST_RULES
2869#if HALIDE_DEBUG_MATCHED_RULES
2874#if HALIDE_DEBUG_UNMATCHED_RULES
2881 template<
typename Before,
2884 static_assert(Before::canonical,
"LHS of rewrite rule should be in canonical form");
2887#if HALIDE_DEBUG_MATCHED_RULES
2892#if HALIDE_DEBUG_UNMATCHED_RULES
2899 template<
typename Before,
2902 static_assert(Before::canonical,
"LHS of rewrite rule should be in canonical form");
2903#if HALIDE_FUZZ_TEST_RULES
2908#if HALIDE_DEBUG_MATCHED_RULES
2913#if HALIDE_DEBUG_UNMATCHED_RULES
2920 template<
typename Before,
2927 static_assert(Predicate::foldable,
"Predicates must consist only of operations that can constant-fold");
2928 static_assert((Before::binds & After::binds) == After::binds,
"Rule result uses unbound values");
2929 static_assert((Before::binds & Predicate::binds) == Predicate::binds,
"Rule predicate uses unbound values");
2930 static_assert(Before::canonical,
"LHS of rewrite rule should be in canonical form");
2931 static_assert(After::canonical,
"RHS of rewrite rule should be in canonical form");
2933#if HALIDE_FUZZ_TEST_RULES
2939#if HALIDE_DEBUG_MATCHED_RULES
2944#if HALIDE_DEBUG_UNMATCHED_RULES
2951 template<
typename Before,
2956 static_assert(Predicate::foldable,
"Predicates must consist only of operations that can constant-fold");
2957 static_assert(Before::canonical,
"LHS of rewrite rule should be in canonical form");
2962#if HALIDE_DEBUG_MATCHED_RULES
2967#if HALIDE_DEBUG_UNMATCHED_RULES
2974 template<
typename Before,
2979 static_assert(Predicate::foldable,
"Predicates must consist only of operations that can constant-fold");
2980 static_assert(Before::canonical,
"LHS of rewrite rule should be in canonical form");
2981#if HALIDE_FUZZ_TEST_RULES
2987#if HALIDE_DEBUG_MATCHED_RULES
2992#if HALIDE_DEBUG_UNMATCHED_RULES
3018 typename =
typename enable_if_pattern<Instance>::type>
3020 return {
pattern_arg(instance), output_type, wildcard_type};
3024 typename =
typename enable_if_pattern<Instance>::type>
3026 return {
pattern_arg(instance), output_type, output_type};
@ halide_type_float
IEEE floating point numbers.
@ halide_type_bfloat
floating point numbers in the bfloat format
@ halide_type_int
signed integers
@ halide_type_uint
unsigned integers
#define HALIDE_NEVER_INLINE
#define HALIDE_ALWAYS_INLINE
Subtypes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Methods to test Exprs and Stmts for equality of value.
Defines various operator overloads and utility functions that make it more pleasant to work with Hali...
For optional debugging during codegen, use the debug class as follows:
auto rounding_shift_left(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
auto shift_left(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto rewriter(Instance instance, halide_type_t output_type, halide_type_t wildcard_type) noexcept -> Rewriter< decltype(pattern_arg(instance))>
Construct a rewriter for the given instance, which may be a pattern with concrete expressions as leav...
HALIDE_ALWAYS_INLINE T pattern_arg(T t)
auto widen_right_add(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto or_op(A &&a, B &&b) -> decltype(IRMatcher::operator||(a, b))
HALIDE_ALWAYS_INLINE auto operator!(A &&a) noexcept -> NotOp< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE bool evaluate_predicate(bool x, MatcherState &) noexcept
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Div >(halide_type_t &t, int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE auto ne(A &&a, B &&b) -> decltype(IRMatcher::operator!=(a, b))
HALIDE_ALWAYS_INLINE auto negate(A &&a) -> decltype(IRMatcher::operator-(a))
uint64_t constant_fold_cmp_op(int64_t, int64_t) noexcept
HALIDE_ALWAYS_INLINE auto operator<=(A &&a, B &&b) noexcept -> CmpOp< LE, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto operator+(A &&a, B &&b) noexcept -> BinOp< Add, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto is_max_value(A &&a) noexcept -> IsMaxValue< decltype(pattern_arg(a))>
std::ostream & operator<<(std::ostream &s, const SpecificExpr &e)
HALIDE_ALWAYS_INLINE auto and_op(A &&a, B &&b) -> decltype(IRMatcher::operator&&(a, b))
HALIDE_ALWAYS_INLINE auto h_and(A &&a, B lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), decltype(pattern_arg(lanes)), VectorReduce::And >
HALIDE_ALWAYS_INLINE auto gt(A &&a, B &&b) -> decltype(IRMatcher::operator>(a, b))
HALIDE_ALWAYS_INLINE auto is_const(A &&a) noexcept -> IsConst< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE auto intrin(Call::IntrinsicOp intrinsic_op, Args... args) noexcept -> Intrin< decltype(pattern_arg(args))... >
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< LE >(int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE auto operator*(A &&a, B &&b) noexcept -> BinOp< Mul, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
auto rounding_halving_add(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
auto rounding_shift_right(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
auto widen_right_sub(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto add(A &&a, B &&b) -> decltype(IRMatcher::operator+(a, b))
HALIDE_ALWAYS_INLINE auto div(A &&a, B &&b) -> decltype(IRMatcher::operator/(a, b))
auto saturating_add(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto mul(A &&a, B &&b) -> decltype(IRMatcher::operator*(a, b))
HALIDE_ALWAYS_INLINE auto slice(Vec vec, Base base, Stride stride, Lanes lanes) noexcept -> SliceOp< decltype(pattern_arg(vec)), decltype(pattern_arg(base)), decltype(pattern_arg(stride)), decltype(pattern_arg(lanes))>
HALIDE_ALWAYS_INLINE auto ramp(A &&a, B &&b, C &&c) noexcept -> RampOp< decltype(pattern_arg(a)), decltype(pattern_arg(b)), decltype(pattern_arg(c))>
HALIDE_ALWAYS_INLINE auto operator/(A &&a, B &&b) noexcept -> BinOp< Div, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto widen(A &&a) noexcept -> WidenOp< decltype(pattern_arg(a))>
auto widening_mul(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Mod >(halide_type_t &t, int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< And >(halide_type_t &t, int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE int64_t unwrap(IntLiteral t)
HALIDE_ALWAYS_INLINE auto operator>(A &&a, B &&b) noexcept -> CmpOp< GT, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto cast(halide_type_t t, A &&a) noexcept -> CastOp< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE auto overflows(A &&a) noexcept -> Overflows< decltype(pattern_arg(a))>
auto widening_add(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE void assert_is_lvalue_if_expr()
HALIDE_ALWAYS_INLINE auto operator%(A &&a, B &&b) noexcept -> BinOp< Mod, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Sub >(halide_type_t &t, int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE auto is_scalar(A &&a) noexcept -> IsScalar< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE auto fold(A &&a) noexcept -> Fold< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE auto not_op(A &&a) -> decltype(IRMatcher::operator!(a))
auto halving_add(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Max >(halide_type_t &t, int64_t a, int64_t b) noexcept
constexpr bool and_reduce()
HALIDE_ALWAYS_INLINE auto operator||(A &&a, B &&b) noexcept -> BinOp< Or, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
auto widening_sub(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto operator!=(A &&a, B &&b) noexcept -> CmpOp< NE, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto is_float(A &&a) noexcept -> IsFloat< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE auto operator>=(A &&a, B &&b) noexcept -> CmpOp< GE, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto operator<(A &&a, B &&b) noexcept -> CmpOp< LT, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto operator&&(A &&a, B &&b) noexcept -> BinOp< And, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto is_uint(A &&a, int bits=0, int lanes=0) noexcept -> IsUInt< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE auto h_or(A &&a, B lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), decltype(pattern_arg(lanes)), VectorReduce::Or >
constexpr bool commutative(IRNodeType t)
auto widen_right_mul(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto sub(A &&a, B &&b) -> decltype(IRMatcher::operator-(a, b))
HALIDE_ALWAYS_INLINE auto h_max(A &&a, B lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), decltype(pattern_arg(lanes)), VectorReduce::Max >
HALIDE_ALWAYS_INLINE auto broadcast(A &&a, B lanes) noexcept -> BroadcastOp< decltype(pattern_arg(a)), decltype(pattern_arg(lanes))>
HALIDE_ALWAYS_INLINE auto is_int(A &&a, int bits=0, int lanes=0) noexcept -> IsInt< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE auto select(C &&c, T &&t, F &&f) noexcept -> SelectOp< decltype(pattern_arg(c)), decltype(pattern_arg(t)), decltype(pattern_arg(f))>
HALIDE_ALWAYS_INLINE auto is_min_value(A &&a) noexcept -> IsMinValue< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Min >(halide_type_t &t, int64_t a, int64_t b) noexcept
HALIDE_NEVER_INLINE void fuzz_test_rule(Before &&before, After &&after, Predicate &&pred, halide_type_t wildcard_type, halide_type_t output_type) noexcept
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< GT >(int64_t a, int64_t b) noexcept
auto halving_sub(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
auto saturating_sub(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Mul >(halide_type_t &t, int64_t a, int64_t b) noexcept
auto mul_shift_right(A &&a, B &&b, C &&c) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b)), decltype(pattern_arg(c))>
auto shift_right(A &&a, B &&b) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< GE >(int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE auto operator-(A &&a, B &&b) noexcept -> BinOp< Sub, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE auto le(A &&a, B &&b) -> decltype(IRMatcher::operator<=(a, b))
HALIDE_ALWAYS_INLINE auto lt(A &&a, B &&b) -> decltype(IRMatcher::operator<(a, b))
HALIDE_ALWAYS_INLINE auto lanes_of(A &&a) noexcept -> LanesOf< decltype(pattern_arg(a))>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< LT >(int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE auto h_min(A &&a, B lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), decltype(pattern_arg(lanes)), VectorReduce::Min >
HALIDE_ALWAYS_INLINE auto h_add(A &&a, B lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), decltype(pattern_arg(lanes)), VectorReduce::Add >
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Or >(halide_type_t &t, int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE Expr make_const_expr(halide_scalar_value_t val, halide_type_t ty)
constexpr uint32_t bitwise_or_reduce()
auto rounding_mul_shift_right(A &&a, B &&b, C &&c) noexcept -> Intrin< decltype(pattern_arg(a)), decltype(pattern_arg(b)), decltype(pattern_arg(c))>
int64_t constant_fold_bin_op(halide_type_t &, int64_t, int64_t) noexcept
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< EQ >(int64_t a, int64_t b) noexcept
HALIDE_NEVER_INLINE Expr make_const_special_expr(halide_type_t ty)
HALIDE_ALWAYS_INLINE auto ge(A &&a, B &&b) -> decltype(IRMatcher::operator>=(a, b))
auto saturating_cast(const Type &t, A &&a) noexcept -> Intrin< decltype(pattern_arg(a))>
constexpr int const_min(int a, int b)
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< NE >(int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE auto mod(A &&a, B &&b) -> decltype(IRMatcher::operator%(a, b))
HALIDE_ALWAYS_INLINE auto operator==(A &&a, B &&b) noexcept -> CmpOp< EQ, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Add >(halide_type_t &t, int64_t a, int64_t b) noexcept
HALIDE_ALWAYS_INLINE auto can_prove(A &&a, Prover *p) noexcept -> CanProve< decltype(pattern_arg(a)), Prover >
HALIDE_ALWAYS_INLINE auto eq(A &&a, B &&b) -> decltype(IRMatcher::operator==(a, b))
bool is_const_zero(const Expr &e)
Is the expression a const (as defined by is_const), and also equal to zero (in all lanes,...
Expr make_zero(Type t)
Construct the representation of zero in the given type.
bool is_const_one(const Expr &e)
Is the expression a const (as defined by is_const), and also equal to one (in all lanes,...
ConstantInterval min(const ConstantInterval &a, const ConstantInterval &b)
bool equal(const RDom &bounds0, const RDom &bounds1)
Return true if bounds0 and bounds1 represent the same bounds.
constexpr IRNodeType StrongestExprNodeType
Expr make_const(Type t, int64_t val)
Construct an immediate of the given type from any numeric C++ type.
ConstantInterval max(const ConstantInterval &a, const ConstantInterval &b)
T mod_imp(T a, T b)
Implementations of division and mod that are specific to Halide.
bool sub_would_overflow(int bits, int64_t a, int64_t b)
bool add_would_overflow(int bits, int64_t a, int64_t b)
Routines to test if math would overflow for signed integers with the given number of bits.
bool mul_would_overflow(int bits, int64_t a, int64_t b)
Expr with_lanes(const Expr &x, int lanes)
Rewrite the expression x to have lanes lanes.
bool expr_match(const Expr &pattern, const Expr &expr, std::vector< Expr > &result)
Does the first expression have the same structure as the second? Variables in the first expression wi...
ConstantInterval abs(const ConstantInterval &a)
Expr make_signed_integer_overflow(Type type)
Construct a unique signed_integer_overflow Expr.
IRNodeType
All our IR node types get unique IDs for the purposes of RTTI.
bool is_const(const Expr &e)
Is the expression either an IntImm, a FloatImm, a StringImm, or a Cast of the same,...
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
@ Predicate
Guard the loads and stores in the loop with an if statement that prevents evaluation beyond the origi...
Expr absd(Expr a, Expr b)
Return the absolute difference between two values.
Expr likely_if_innermost(Expr e)
Equivalent to likely, but only triggers a loop partitioning if found in an innermost loop.
Expr likely(Expr e)
Expressions tagged with this intrinsic are considered to be part of the steady state of some loop wit...
unsigned __INT64_TYPE__ uint64_t
signed __INT64_TYPE__ int64_t
signed __INT32_TYPE__ int32_t
unsigned __INT16_TYPE__ uint16_t
unsigned __INT32_TYPE__ uint32_t
A fragment of Halide syntax.
HALIDE_ALWAYS_INLINE Type type() const
Get the type of this expression node.
HALIDE_ALWAYS_INLINE const Internal::BaseExprNode * get() const
Override get() to return a BaseExprNode * instead of an IRNode *.
The sum of two expressions.
Logical and - are both expressions true.
A base class for expression nodes.
A vector with 'lanes' elements, in which every element is 'value'.
static Expr make(Expr value, int lanes)
static const IRNodeType _node_type
@ signed_integer_overflow
@ rounding_mul_shift_right
bool is_intrinsic() const
static const IRNodeType _node_type
The actual IR nodes begin here.
static const IRNodeType _node_type
The ratio of two expressions.
Is the first expression equal to the second.
Floating point constants.
static const FloatImm * make(Type t, double value)
Is the first expression greater than or equal to the second.
Is the first expression greater than the second.
static constexpr bool canonical
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr bool foldable
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const noexcept
HALIDE_ALWAYS_INLINE bool match(const BinOp< Op2, A2, B2 > &op, MatcherState &state) const noexcept
static constexpr IRNodeType max_node_type
static constexpr IRNodeType min_node_type
static constexpr IRNodeType min_node_type
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
HALIDE_ALWAYS_INLINE bool match(const BroadcastOp< A2, B2 > &op, MatcherState &state) const noexcept
static constexpr bool foldable
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr bool canonical
static constexpr IRNodeType max_node_type
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
HALIDE_NEVER_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const
static constexpr uint32_t binds
static constexpr IRNodeType min_node_type
static constexpr IRNodeType max_node_type
static constexpr bool foldable
static constexpr bool canonical
static constexpr IRNodeType max_node_type
static constexpr bool foldable
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr IRNodeType min_node_type
static constexpr uint32_t binds
static constexpr bool canonical
HALIDE_ALWAYS_INLINE bool match(const CastOp< A2 > &op, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr IRNodeType max_node_type
static constexpr uint32_t binds
static constexpr bool canonical
static constexpr bool foldable
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr IRNodeType min_node_type
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE bool match(const CmpOp< Op2, A2, B2 > &op, MatcherState &state) const noexcept
static constexpr IRNodeType max_node_type
static constexpr uint32_t binds
static constexpr IRNodeType min_node_type
static constexpr bool canonical
static constexpr bool foldable
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const noexcept
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr IRNodeType max_node_type
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE IntLiteral(int64_t v)
HALIDE_ALWAYS_INLINE bool match(const IntLiteral &b, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr IRNodeType min_node_type
static constexpr bool canonical
static constexpr bool foldable
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
HALIDE_ALWAYS_INLINE bool match(int64_t val, MatcherState &state) const noexcept
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE bool match_args(double, const Call &c, MatcherState &state) const noexcept
static constexpr IRNodeType max_node_type
static constexpr bool canonical
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
HALIDE_ALWAYS_INLINE void print_args(std::ostream &s) const
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr uint32_t binds
static constexpr bool foldable
HALIDE_ALWAYS_INLINE bool match_args(int, const Call &c, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE void print_args(int, std::ostream &s) const
std::tuple< Args... > args
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE void print_args(double, std::ostream &s) const
HALIDE_ALWAYS_INLINE Intrin(Call::IntrinsicOp intrin, Args... args) noexcept
static constexpr IRNodeType min_node_type
static constexpr IRNodeType min_node_type
static constexpr bool canonical
static constexpr bool foldable
static constexpr IRNodeType max_node_type
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr bool foldable
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const
static constexpr bool canonical
static constexpr IRNodeType min_node_type
static constexpr IRNodeType max_node_type
static constexpr uint32_t binds
static constexpr IRNodeType max_node_type
static constexpr bool foldable
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const
static constexpr IRNodeType min_node_type
static constexpr bool canonical
static constexpr bool foldable
static constexpr IRNodeType min_node_type
static constexpr bool canonical
static constexpr IRNodeType max_node_type
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const
static constexpr uint32_t binds
static constexpr IRNodeType min_node_type
static constexpr bool canonical
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const
static constexpr bool foldable
static constexpr IRNodeType max_node_type
static constexpr uint32_t binds
static constexpr IRNodeType max_node_type
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const
static constexpr IRNodeType min_node_type
static constexpr bool foldable
static constexpr bool canonical
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const
static constexpr bool foldable
static constexpr IRNodeType min_node_type
static constexpr bool canonical
static constexpr uint32_t binds
static constexpr IRNodeType max_node_type
static constexpr IRNodeType max_node_type
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const
static constexpr IRNodeType min_node_type
static constexpr bool foldable
static constexpr uint32_t binds
static constexpr bool canonical
To save stack space, the matcher objects are largely stateless and immutable.
HALIDE_ALWAYS_INLINE void get_bound_const(int i, halide_scalar_value_t &val, halide_type_t &type) const noexcept
HALIDE_ALWAYS_INLINE void set_bound_const(int i, int64_t s, halide_type_t t) noexcept
HALIDE_ALWAYS_INLINE void set_bound_const(int i, double f, halide_type_t t) noexcept
static constexpr uint16_t special_values_mask
HALIDE_ALWAYS_INLINE void set_bound_const(int i, halide_scalar_value_t val, halide_type_t t) noexcept
halide_type_t bound_const_type[max_wild]
HALIDE_ALWAYS_INLINE void set_binding(int i, const BaseExprNode &n) noexcept
HALIDE_ALWAYS_INLINE MatcherState() noexcept
HALIDE_ALWAYS_INLINE const BaseExprNode * get_binding(int i) const noexcept
halide_scalar_value_t bound_const[max_wild]
HALIDE_ALWAYS_INLINE void set_bound_const(int i, uint64_t u, halide_type_t t) noexcept
static constexpr uint16_t signed_integer_overflow
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
HALIDE_ALWAYS_INLINE bool match(NegateOp< A2 > &&p, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr uint32_t binds
static constexpr bool canonical
static constexpr bool foldable
static constexpr IRNodeType max_node_type
static constexpr IRNodeType min_node_type
static constexpr uint32_t binds
static constexpr bool foldable
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr IRNodeType max_node_type
static constexpr bool canonical
HALIDE_ALWAYS_INLINE bool match(const NotOp< A2 > &op, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr IRNodeType min_node_type
static constexpr uint32_t binds
static constexpr IRNodeType max_node_type
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr bool canonical
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr bool foldable
static constexpr IRNodeType min_node_type
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr IRNodeType min_node_type
static constexpr uint32_t binds
static constexpr bool canonical
static constexpr IRNodeType max_node_type
static constexpr bool foldable
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr bool canonical
static constexpr IRNodeType max_node_type
static constexpr IRNodeType min_node_type
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE bool match(const RampOp< A2, B2, C2 > &op, MatcherState &state) const noexcept
static constexpr bool foldable
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_NEVER_INLINE void build_replacement(After after)
HALIDE_ALWAYS_INLINE bool operator()(Before before, After after, Predicate pred)
HALIDE_ALWAYS_INLINE bool operator()(Before before, int64_t after) noexcept
HALIDE_ALWAYS_INLINE Rewriter(Instance instance, halide_type_t ot, halide_type_t wt)
HALIDE_ALWAYS_INLINE bool operator()(Before before, const Expr &after, Predicate pred)
HALIDE_ALWAYS_INLINE bool operator()(Before before, const Expr &after) noexcept
HALIDE_ALWAYS_INLINE bool operator()(Before before, int64_t after, Predicate pred)
HALIDE_ALWAYS_INLINE bool operator()(Before before, After after)
halide_type_t wildcard_type
halide_type_t output_type
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr bool foldable
static constexpr bool canonical
HALIDE_ALWAYS_INLINE bool match(const SelectOp< C2, T2, F2 > &instance, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr IRNodeType max_node_type
static constexpr IRNodeType min_node_type
static constexpr bool canonical
static constexpr IRNodeType max_node_type
static constexpr bool foldable
HALIDE_ALWAYS_INLINE SliceOp(Vec v, Base b, Stride s, Lanes l)
static constexpr IRNodeType min_node_type
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr IRNodeType min_node_type
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr bool canonical
static constexpr IRNodeType max_node_type
const BaseExprNode & expr
static constexpr uint32_t binds
static constexpr bool foldable
static constexpr bool canonical
HALIDE_ALWAYS_INLINE bool match(const VectorReduceOp< A2, B2, reduce_op_2 > &op, MatcherState &state) const noexcept
static constexpr uint32_t binds
static constexpr IRNodeType min_node_type
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr IRNodeType max_node_type
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr bool foldable
static constexpr uint32_t binds
static constexpr bool canonical
static constexpr bool foldable
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr IRNodeType max_node_type
HALIDE_ALWAYS_INLINE bool match(const WidenOp< A2 > &op, MatcherState &state) const noexcept
static constexpr IRNodeType min_node_type
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr bool canonical
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr IRNodeType max_node_type
static constexpr IRNodeType min_node_type
static constexpr uint32_t binds
static constexpr bool foldable
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr bool canonical
static constexpr IRNodeType max_node_type
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE bool match(int64_t e, MatcherState &state) const noexcept
static constexpr IRNodeType min_node_type
static constexpr bool foldable
static constexpr bool canonical
static constexpr bool foldable
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr uint32_t binds
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE bool match(int64_t value, MatcherState &state) const noexcept
static constexpr IRNodeType min_node_type
static constexpr IRNodeType max_node_type
static constexpr uint32_t binds
static constexpr bool foldable
static constexpr IRNodeType max_node_type
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
HALIDE_ALWAYS_INLINE void make_folded_const(halide_scalar_value_t &val, halide_type_t &ty, MatcherState &state) const noexcept
static constexpr IRNodeType min_node_type
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr bool canonical
static constexpr IRNodeType min_node_type
static constexpr uint32_t binds
static constexpr IRNodeType max_node_type
static constexpr bool canonical
HALIDE_ALWAYS_INLINE Expr make(MatcherState &state, halide_type_t type_hint) const
static constexpr bool foldable
HALIDE_ALWAYS_INLINE bool match(const BaseExprNode &e, MatcherState &state) const noexcept
static constexpr uint32_t mask
IRNodeType node_type
Each IR node subclass has a unique identifier.
static const IntImm * make(Type t, int64_t value)
Is the first expression less than or equal to the second.
Is the first expression less than the second.
The greater of two values.
The lesser of two values.
The product of two expressions.
Is the first expression not equal to the second.
Logical not - true if the expression false.
Logical or - is at least one of the expression true.
A linear ramp vector node.
static const IRNodeType _node_type
static Expr make(Expr base, Expr stride, int lanes)
static Expr make(Expr condition, Expr true_value, Expr false_value)
static const IRNodeType _node_type
Construct a new vector by taking elements from another sequence of vectors.
static Expr make_slice(Expr vector, int begin, int stride, int size)
Convenience constructor for making a shuffle representing a contiguous subset of a vector.
std::vector< Expr > vectors
bool is_slice() const
Check if this shuffle is a contiguous strict subset of the vector arguments, and if so,...
int slice_stride() const
Check if this shuffle is a contiguous strict subset of the vector arguments, and if so,...
int slice_begin() const
Check if this shuffle is a contiguous strict subset of the vector arguments, and if so,...
The difference of two expressions.
static const IRNodeType _node_type
static Expr make(Expr a, Expr b)
Unsigned integer constants.
static const UIntImm * make(Type t, uint64_t value)
Horizontally reduce a vector to a scalar or narrower vector using the given commutative and associati...
static const IRNodeType _node_type
static Expr make(Operator op, Expr vec, int lanes)
Types in the halide type system.
Type widen() const
Return Type with the same type code and number of lanes, but with at least twice as many bits.
HALIDE_ALWAYS_INLINE bool is_int() const
Is this type a signed integer type?
HALIDE_ALWAYS_INLINE int lanes() const
Return the number of vector elements in this type.
HALIDE_ALWAYS_INLINE bool is_uint() const
Is this type an unsigned integer type?
HALIDE_ALWAYS_INLINE int bits() const
Return the bit size of a single element of this type.
HALIDE_ALWAYS_INLINE bool is_scalar() const
Is this type a scalar type? (lanes() == 1).
HALIDE_ALWAYS_INLINE bool is_float() const
Is this type a floating point type (float or double).
halide_scalar_value_t is a simple union able to represent all the well-known scalar values in a filte...
union halide_scalar_value_t::@3 u
A runtime tag for a type in the halide type system.
uint16_t lanes
How many elements in a vector.
uint8_t code
The basic type code: signed integer, unsigned integer, or floating point.