本文整理汇总了C++中Func::compile_to_lowered_stmt方法的典型用法代码示例。如果您正苦于以下问题:C++ Func::compile_to_lowered_stmt方法的具体用法?C++ Func::compile_to_lowered_stmt怎么用?C++ Func::compile_to_lowered_stmt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func::compile_to_lowered_stmt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: x
Image<ushort> stereoBM(Image<uint8_t> left_image, Image<uint8_t> right_image, int SADWindowSize, int minDisparity,
int numDisparities, int xmin, int xmax, int ymin, int ymax) {
Var x("x"), y("y"), c("c");
Func left("left"), right("right");
left(x, y, c) = left_image(x, y, c);
right(x, y, c) = right_image(x, y, c);
int width = left_image.width();
int height = left_image.height();
Func filteredLeft = prefilterXSobel(left, width, height);
Func filteredRight = prefilterXSobel(right, width, height);
int x_tile_size = 64, y_tile_size = 32;
Func disp = findStereoCorrespondence(filteredLeft, filteredRight, SADWindowSize, minDisparity, numDisparities,
left_image.width(), left_image.height(), xmin, xmax, ymin, ymax, x_tile_size, y_tile_size);
disp.compile_to_lowered_stmt("disp.html", {}, HTML);
int w = (xmax-xmin)/x_tile_size*x_tile_size+x_tile_size;
int h = (ymax-ymin)/x_tile_size*x_tile_size+x_tile_size;
profile(disp, w, h, 100);
Target t = get_jit_target_from_environment().with_feature(Target::Profile);
Image<ushort> disp_image = disp.realize(w, h, t);
return disp_image;
}
示例2: main
//.........这里部分代码省略.........
#else
blurImage.split(y, y0, yi, 4);
blurImage.parallel(y0);
blurImage.vectorize(x, 8);
#endif
// Split the y coordinate of the consumer into strips:
blurVariance.split(y, y0, yi, 4);
// Compute the strips using a thread pool and a task queue.
blurVariance.parallel(y0);
// Vectorize across x.
blurVariance.vectorize(x, 8);
// polynomial1.compute_at(blurImage, x).vectorize(x, 8);
// kernel1.compute_at(blurImage, x).vectorize(x, 8);
// Split the y coordinate of the consumer into strips of 16 scanlines:
maskOut.split(y, y0, yi, 30);
// Compute the strips using a thread pool and a task queue.
maskOut.parallel(y0);
// Vectorize across x by a factor of four.
maskOut.vectorize(x, 8);
// kernel1.trace_stores();
// blurImage.trace_stores();
//Check out what is happening
blurImage.print_loop_nest();
// Print out pseudocode for the pipeline.
blurImage.compile_to_lowered_stmt("linearCombinationKernelBlurImage.html", {image}, HTML);
// blurImage.compile_to_c("linearCombinationKernel_C_Code.cpp", std::vector<Argument>(), "linearCombinationKernel_C_Code");
// blurVariance.compile_to_lowered_stmt("blur.html", {variance}, HTML);
// Benchmark the pipeline.
#ifdef TESTING_GPU
Buffer image_output(Float(32), image.width(), image.height()); //for GPU testing
#else
Image<float> image_output(image.width(), image.height());
#endif
blurImage.realize(image_output);
Image<float> variance_output(variance.width(), variance.height());
blurVariance.realize(variance_output);
Image<int32_t> mask_output(mask.width(), mask.height());
maskOut.realize(mask_output);
#ifdef TESTING_GPU
// Run the filter once to initialize any GPU runtime state.
blurImage.realize(image_output);
// Now take the best of 3 runs for timing.
double best_time;
for (int i = 0; i < 3; i++) {
double t1 = current_time();
// Run the filter 100 times.
for (int j = 0; j < 100; j++) {