Revision 06b208f28b94b202ef14360339126d2d21a0463f authored by Dillon Sharlet on 04 March 2021, 18:11:57 UTC, committed by GitHub on 04 March 2021, 18:11:57 UTC
* Remove unused vertex buffer parameters. * Offload GPU code in a lowering pass instead of via CodeGen_GPU_Host. Fixes #5650, fixes #2797, fixes #2084, now #1971 is more relevant. * clang-format. * clang-format sorting is case sensitive!? * clang-tidy * Move codegen backends into anonymous namespaces in source files. * clang-format * Pass type arguments correctly. * Update OffloadGPULoops.cpp * trigger buildbots * trigger buildbots * Hack around tests that rely on the IR for offloaded GPU loops. * Fix missing include. * Remove unused include. * clang-tidy * Use custom lowering pass to see code before GPU offloading * Speculative fix for segfault * Fix const correctness * Fix error on unused variables in generated code. Co-authored-by: Steven Johnson <srj@google.com>
1 parent abf0f69
process.cpp
#include <chrono>
#include <cstdio>
#include "nl_means.h"
#include "nl_means_auto_schedule.h"
#include "HalideBuffer.h"
#include "halide_benchmark.h"
#include "halide_image_io.h"
using namespace Halide::Runtime;
using namespace Halide::Tools;
int main(int argc, char **argv) {
if (argc < 7) {
printf("Usage: ./process input.png patch_size search_area sigma timing_iterations output.png\n"
"e.g.: ./process input.png 7 7 0.12 10 output.png\n");
return 0;
}
Buffer<float> input = load_and_convert_image(argv[1]);
int patch_size = atoi(argv[2]);
int search_area = atoi(argv[3]);
float sigma = atof(argv[4]);
Buffer<float> output(input.width(), input.height(), 3);
int timing_iterations = atoi(argv[5]);
nl_means(input, patch_size, search_area, sigma, output);
// Timing code
printf("Input size: %d by %d, patch size: %d, search area: %d, sigma: %f\n",
input.width(), input.height(), patch_size, search_area, sigma);
// Manually-tuned version
double min_t_manual = benchmark(timing_iterations, 1, [&]() {
nl_means(input, patch_size, search_area, sigma, output);
output.device_sync();
});
printf("Manually-tuned time: %gms\n", min_t_manual * 1e3);
// Auto-scheduled version
double min_t_auto = benchmark(timing_iterations, 1, [&]() {
nl_means_auto_schedule(input, patch_size, search_area, sigma, output);
output.device_sync();
});
printf("Auto-scheduled time: %gms\n", min_t_auto * 1e3);
convert_and_save_image(output, argv[6]);
printf("Success!\n");
return 0;
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...