bad_alloc
Hello Jing,
Here is a small test case that runs into a bad_alloc error:
#include "Halide.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
Func e, f, g;
Var x;
e(x) =x;
f(x) = e(x);
g(x) = f(x);
Var xi, xo;
g.split(x, xo, xi, 16).accelerate({e}, xi, xo);
f.linebuffer();
Image<int> out = g.realize(100);//, target);
return 0;
}
Halide-HLS]$ g++ -std=c++11 -g -fno-omit-frame-pointer -fno-rtti -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -O3 test/correctness/gpu_dynamic_shared.cpp -Iinclude -Lbin -lHalide -lpthread -ldl -lz -rdynamic -Wl,--rpath=/home/hrong/Halide-HLS/bin -o t
Halide-HLS]$ ./t Warning at test/correctness/gpu_dynamic_shared.cpp:34: No linebuffer inserted after function f. Warning at test/correctness/gpu_dynamic_shared.cpp:34: No linebuffer inserted after function . terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted (core dumped)
Thanks! Hongbo
@ronghongbo The HLS backend cannot be used with JIT (i.e. func.realize()) yet.
The fanout example is similar to your example. Maybe you can start from that example.
https://github.com/jingpu/Halide-HLS/blob/HLS/apps/hls_examples/fanout_hls/pipeline.cpp