This source file includes following definitions.
- main
#include "Halide.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
Target t(get_jit_target_from_environment());
if (!t.has_gpu_feature()) {
printf("Not running test because no gpu target enabled\n");
return 0;
}
Buffer<float> in(100, 100);
assert(!in.has_device_allocation());
assert(!in.host_dirty() && !in.device_dirty());
in.fill(7.0f);
assert(!in.has_device_allocation());
assert(in.host_dirty() && !in.device_dirty());
Func f;
Var x, y, xi, yi;
f(x, y) = in(x, y);
f.gpu_tile(x, y, xi, yi, 8, 8);
Buffer<float> out = f.realize(100, 100);
assert(out.has_device_allocation());
assert(!out.host_dirty() && !out.device_dirty());
assert(in.has_device_allocation());
assert(!in.host_dirty() && !in.device_dirty());
f.realize(out);
assert(out.has_device_allocation());
assert(!out.host_dirty() && out.device_dirty());
assert(in.has_device_allocation());
assert(!in.host_dirty() && !in.device_dirty());
printf("Success!\n");
return 0;
}