Revision 0aa3766355c7a108578ab45d1f752a91ce8f0f6e authored by Steven Johnson on 19 August 2019, 21:36:33 UTC, committed by Steven Johnson on 19 August 2019, 21:36:33 UTC
1 parent e110b79
Raw File
alias_generator.cpp
#include "Halide.h"

namespace {

class Alias : public Halide::Generator<Alias> {
public:
    GeneratorParam<int32_t> offset{ "offset", 0 };
    Input<Buffer<int32_t>>  input{ "input", 1 };
    Output<Buffer<int32_t>> output{ "output", 1 };

    void generate() {
        Var x;
        output(x) = input(x) + offset;
    }
};

}  // namespace

HALIDE_REGISTER_GENERATOR(Alias, alias)
HALIDE_REGISTER_GENERATOR_ALIAS(alias_with_offset_42, alias, { { "offset", "42" }})
back to top