This source file includes following definitions.
- call_counter
- main
#include "Halide.h"
#include <stdio.h>
using namespace Halide;
#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif
int call_count;
extern "C" DLLEXPORT float call_counter(float x) {
call_count++;
return x;
}
HalideExtern_1(float, call_counter, float);
int main(int argc, char **argv) {
Func f;
Var x, y;
f(x, y) = call_counter(sin(x*3 + y));
Func blur;
RDom r(-10, 20, -10, 20);
blur(x, y) = select(f(x, y) > 0, sum(f(x+r.x, y+r.y)), 0);
call_count = 0;
blur.realize(100, 100);
if (call_count > 2100000) {
printf("Expected call_count ~= 2000000. Instead it's %d\n", call_count);
return -1;
}
printf("Success!\n");
return 0;
}