Revision d523b8325857e4cd6f298ec9f356432676c81edb authored by Steven Johnson on 13 March 2021, 00:54:23 UTC, committed by GitHub on 13 March 2021, 00:54:23 UTC
(1) Both the 'deprecated' and new, non-deprecated variants existed back to at least LLVM10, and the deprecated variant was commented as deprecated at that point as well; the change in LLVM13 is that they are now annotated with LLVM_ATTRIBUTE_DEPRECATED so we get compiler warnings (and thus errors).

(2) The fixes are simply replicating what the old, deprecated methods did internally.
1 parent c3882a5
Raw File
test_two_kernels.cpp
#include "Halide.h"

using namespace Halide;

int main(int argc, char **argv) {
    ImageParam input(UInt(32), 3, "input");
    input.dim(2).set_bounds(0, 4).set_stride(1).dim(0).set_stride(4);

    Var x, y, c, xi, yi;
    Func f("f");
    f(x, y, c) = input(x, y, c) + 1;
    f.bound(c, 0, 4)
        .reorder_storage(c, x, y)
        .reorder(c, x, y);

    f.compute_root();
    f.output_buffer().dim(2).set_bounds(0, 4).set_stride(1).dim(0).set_stride(4);

    Target target = get_target_from_environment();
    if (target.has_gpu_feature() || target.has_feature(Target::OpenGLCompute)) {
        f.unroll(c)
            .gpu_tile(x, y, xi, yi, 64, 64);
    }

    Func g("g");
    g(x, y, c) = f(x, y, c) - 1;
    g.bound(c, 0, 4)
        .reorder_storage(c, x, y)
        .reorder(c, x, y);
    if (target.has_gpu_feature() || target.has_feature(Target::OpenGLCompute)) {
        g.unroll(c)
            .gpu_tile(x, y, xi, yi, 64, 64);
    }
    g.output_buffer().dim(2).set_bounds(0, 4).set_stride(1).dim(0).set_stride(4);

    std::string fn_name = std::string("two_kernels_filter") + (argc > 1 ? argv[1] : "");
    g.compile_to_file(fn_name, {input}, fn_name);

    return 0;
}
back to top