Description
If you prefetch and ring_buffer the same Func, it only prefetches ring slot zero. The repro below produces the IR:
allocate producer[int32 * 17 * 1 * 2]
for (consumer.s0.x.xo, 0, (consumer.extent.0/16) + -1) {
produce producer {
let t330 = (consumer.s0.x.xo*16) + ((consumer.min.0 + consumer.min.1) + consumer.s0.y.rebased)
for (producer.s0.x.rebased, 0, 16) {
producer[((consumer.s0.x.xo % 2)*17) + producer.s0.x.rebased] = producer.s0.x.rebased + t330
}
}
consume producer {
let t333 = (consumer.s0.x.xo*16) + (consumer.s0.y.rebased*consumer.stride.1)
for (consumer.s0.x.xi, 0, 15) {
if (consumer.s0.x.xi <= 11) {
prefetch(producer, consumer.s0.x.xi + 4, 1, 16)
}
consumer[consumer.s0.x.xi + t333] =
let t355 = ((consumer.s0.x.xo % 2)*17) + consumer.s0.x.xi in
producer[t355] + producer[t355 + 1]
}
}
}
Nothing about the prefetch node names xo, even though the actual consumption toggles based on it.
Reproducing case
#include "Halide.h"
using namespace Halide;
int main() {
Func producer("producer"), consumer("consumer");
Var x("x"), y("y"), xo("xo"), xi("xi");
producer(x, y) = x + y;
consumer(x, y) = producer(x, y) + producer(x + 1, y);
consumer.compute_root().split(x, xo, xi, 16, TailStrategy::RoundUp);
producer.compute_at(consumer, xo)
.hoist_storage(consumer, y)
.ring_buffer(2);
consumer.prefetch(producer, xi, xi, 4);
consumer.compile_to_lowered_stmt("repro.stmt", {}, StmtOutputFormat::Text,
Target("host-no_asserts-no_bounds_query-no_runtime"));
Buffer<int> out = consumer.realize({64, 4});
return 0;
}
Description
If you prefetch and ring_buffer the same Func, it only prefetches ring slot zero. The repro below produces the IR:
Nothing about the prefetch node names xo, even though the actual consumption toggles based on it.
Reproducing case