halide / Halide

a language for fast, portable data-parallel computation
https://halide-lang.org
Other
5.78k stars 1.07k forks source link

compute_with on a Func with specializations causes missing symbol error #8316

Open abadams opened 1 week ago

abadams commented 1 week ago
#include "Halide.h"
#include <iostream>
#include <stdio.h>

using namespace Halide;

int main(int argc, char **argv) {

    Var x("x"), y("y"), yi("yi");
    Func g, h, out;

    g(x, y) = x + y;
    h(x, y) = x * y;
    out(x, y) = g(x, y) + h(x, y);
    Param<bool> p;
    p.set(true);
    h.compute_root();
    g.compute_root();
    g.compute_with(h, y);
    h.specialize(p).split(y, y, yi, 4);

    out.compile_jit();

    printf("Success!\n");
    return 0;
}
Symbol not found: f1.s0.y
The following names are in scope:
{
  ::f2
  __user_context
  f1
  f1.y.min_realized
  f2
  f2.buffer
  f2.device_dirty
  f2.dimensions
  f2.extent.0
  f2.extent.1
  f2.min.0
  f2.min.1
  f2.stride.0
  f2.stride.1
  f2.total_extent.1
  f2.type
  p0
}

I think the injection of g takes the Var name for y from the unspecialized definition and tries to use it in the specialized definition. In the specialized definition 'y' means f1.s0.y.y