Last active
January 8, 2019 16:35
-
-
Save BachiLi/75adba8f0319e08555c03f345c43cd09 to your computer and use it in GitHub Desktop.
Halide bug?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ rfactor_split.cpp -I ${HALIDE_DIR}/include -I ${HALIDE_DIR}/tools -L ${HALIDE_DIR}/bin -lHalide -o rfactor_split -std=c++11 -O2 | |
// LD_LIBRARY_PATH=${HALIDE_DIR}/bin ./rfactor_split | |
#include "Halide.h" | |
using namespace Halide; | |
int main(int argc, char *argv[]) { | |
Var x("x"); | |
int n = 10000; | |
Buffer<float> input(n); | |
RDom r(0, n); | |
Func f("f"); | |
f() += input(r); | |
RVar rxo, rxi, ryi; | |
int tile_width = 32; | |
f.update(0) | |
.split(r, rxo, rxi, tile_width, TailStrategy::GuardWithIf); | |
// Adding the rfactor schedule makes f's access out of bound | |
// Removing the following 3 lines eliminates the out of bound access | |
Var xo; | |
Func f_interm = f.update(0).rfactor(rxo, xo); | |
f_interm.compute_root(); | |
Buffer<float> f_buf = Buffer<float>::make_scalar(); | |
f.realize(f_buf); | |
// Error: | |
// Input buffer b0 is accessed at 10015, which is beyond the max (9999) in dimension 0 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment