Revision 799236949867b6a2be0d492137b36a0b67011622 authored by Andrew Adams on 07 December 2021, 16:16:50 UTC, committed by GitHub on 07 December 2021, 16:16:50 UTC
* Add a version of fast_integer_divide that rounds towards zero * clang-format * Fix test condition * Clean up debugging code * Add explanatory comment to performance test * Pacify clang tidy
1 parent fb305fd
named_updates.cpp
#include "Halide.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
// Test various possible pieces of syntax for tracking the various
// definitions of a Func. Mostly we just want to make sure they
// compile.
RDom r(0, 16);
Func f;
Var x;
Func ref;
{
Stage pure =
f(x) = x;
Stage fix_first =
f(0) = 1;
Stage rewrites[] = {
f(r * 2) = 13,
f(r * 4) = 14};
struct {
Stage a, b, c;
} more_updates = {
f(3 * r) = 4,
f(2 * r) = 8,
f(5 * r) = 2};
f.compute_root();
pure.vectorize(x, 4);
rewrites[0].parallel(r);
rewrites[1].vectorize(r, 4);
more_updates.a.vectorize(r, 4);
more_updates.b.vectorize(r, 4);
more_updates.c.vectorize(r, 4);
}
// Define the same thing without all the weird syntax and without
// any scheduling.
{
ref(x) = x;
ref(0) = 1;
ref(r * 2) = 13;
ref(r * 4) = 14;
ref(3 * r) = 4;
ref(2 * r) = 8;
ref(5 * r) = 2;
}
Buffer<int> result = f.realize({128});
Buffer<int> result_ref = ref.realize({128});
RDom check(result);
uint32_t error = evaluate<uint32_t>(
maximum(abs(result(check) - result_ref(check))));
if (error) {
printf("There was a difference between using named updates and not.\n");
return -1;
}
printf("Success!\n");
return 0;
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...