This source file includes following definitions.
- main
#include "Halide.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
Var x("x"), y("y");
{
RDom r1(0, 10, 1, 10);
RDom r2(0, 10, 3, 10, 0, 5);
Func f("f");
f(x, y) = x + y;
f(x, y) += r1.x * r1.y;
f(x, r2.x) -= r2.z * f(x, r2.x + r2.y);
Func g("g");
g(x, y) = x + y;
g(x, y) += r1.x * r1.y;
g(x, r2.x) -= r2.z * g(x, r2.x + r2.y);
g.reorder(y, x);
g.update(0).reorder(r1.x, y, x, r1.y);
g.update(1).reorder(r2.x, x, r2.y, r2.z);
g.compute_root();
f.compute_root();
RDom r3(0, 20, 0, 20);
Expr check = sum(abs(f(r3.x, r3.y) - g(r3.x, r3.y)));
int err = evaluate_may_gpu<int>(cast<int>(check));
if (err != 0) {
printf("Reordering rvars affected the meaning!\n");
return -1;
}
}
{
Func input;
input(x, y) = x*y;
Func sat;
sat(x, y) = input(x, y);
RDom r(1, 99);
sat(x, r) += sat(x, r-1);
sat(r, y) += sat(r-1, y);
Var xo, xi;
sat.update().split(x, xo, xi, 4).reorder(xi, r, xo).vectorize(xi).parallel(xo);
sat.update(1).parallel(y);
sat.realize(100, 100);
}
printf("Success!\n");
return 0;
}