Revision e2448fe535db057b18f7ca16d1c878cd045902e9 authored by Andrew Adams on 01 February 2024, 17:46:10 UTC, committed by GitHub on 01 February 2024, 17:46:10 UTC
1 parent 47378ee
Raw File
gpu_object_lifetime_generator.cpp
#include "Halide.h"

namespace {

class GpuObjectLifetime : public Halide::Generator<GpuObjectLifetime> {
public:
    Output<Buffer<int32_t, 1>> output{"output"};

    void generate() {
        Var x;

        output(x) = x;

        Target target = get_target();
        if (target.has_gpu_feature()) {
            Var xo, xi;
            output.gpu_tile(x, xo, xi, 16);
        }
    }
};

}  // namespace

HALIDE_REGISTER_GENERATOR(GpuObjectLifetime, gpu_object_lifetime)
back to top