Revision d13bfa85191d5e46f8f6fed8c5d0810da81bb78f authored by Andrew Adams on 18 March 2024, 16:00:29 UTC, committed by Andrew Adams on 18 March 2024, 16:00:29 UTC
1 parent 59d6462
filter.cpp
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include "HalideBuffer.h"
#include "HalideRuntime.h"
#include "iir_blur.h"
#include "iir_blur_auto_schedule.h"
#include "halide_benchmark.h"
#include "halide_image_io.h"
using namespace Halide::Tools;
int main(int argc, char **argv) {
if (argc != 3) {
printf("Usage: %s in out\n", argv[0]);
return 1;
}
Halide::Runtime::Buffer<float, 3> input = load_and_convert_image(argv[1]);
Halide::Runtime::Buffer<float, 3> output(input.width(), input.height(), input.channels());
double best_manual = benchmark([&]() {
iir_blur(input, 0.5f, output);
output.device_sync();
});
printf("Manually-tuned time: %gms\n", best_manual * 1e3);
double best_auto = benchmark([&]() {
iir_blur_auto_schedule(input, 0.5f, output);
output.device_sync();
});
printf("Auto-scheduled time: %gms\n", best_auto * 1e3);
convert_and_save_image(output, argv[2]);
printf("Success!\n");
return 0;
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...