Revision 16ddff55efc02d37b713eed569d435bdc4f5dfb7 authored by Andrew Adams on 31 August 2023, 22:21:03 UTC, committed by Andrew Adams on 31 August 2023, 22:21:03 UTC
1 parent ef9a7d8
Raw File
compile_to_lowered_stmt.cpp
#include "Halide.h"
#include "halide_test_dirs.h"

#include <cstdio>

using namespace Halide;

int main(int argc, char **argv) {
    Param<float> p("myParam");
    Func f, g, h, j;
    Var x, y;
    f(x, y) = x + y;
    g(x, y) = cast<float>(f(x, y) + f(x + 1, y)) * p;
    h(x, y) = f(x, y) + g(x, y);
    j(x, y) = h(x, y) * 2;

    f.compute_root();
    g.compute_root();
    h.compute_root();

    {
        std::string result_file = Internal::get_test_tmp_dir() + "compile_to_lowered_stmt.stmt";

        Internal::ensure_no_file_exists(result_file);

        j.compile_to_lowered_stmt(result_file, j.infer_arguments());

        Internal::assert_file_exists(result_file);
    }

    printf("Success!\n");
    return 0;
}
back to top