Halide 言語での split() の動作について質問があります。
split() を使用すると、計算領域が分割係数の倍数でない場合、エッジで要素が 2 回計算されます。たとえば、計算領域が 10 で分割係数が 4 の場合、Halide は要素 [0,1,2,3]、[4,5,6,7]、および [6,7,8,9] を次のように計算します。以下の trace_stores() の結果。
split() の内部ループの最後のステップで要素 [8,9] のみを計算する方法はありますか?
サンプルコード:
#include "Halide.h"
using namespace Halide;
#define INPUT_SIZE 10
int main(int argc, char** argv) {
Func f("f");
Var x("x");
f(x) = x;
Var xi("xi");
f.split(x, x, xi, 4);
f.trace_stores();
Image<int32_t> out = f.realize(INPUT_SIZE);
return 0;
}
trace_stores() の結果:
Store f.0(0) = 0
Store f.0(1) = 1
Store f.0(2) = 2
Store f.0(3) = 3
Store f.0(4) = 4
Store f.0(5) = 5
Store f.0(6) = 6
Store f.0(7) = 7
Store f.0(6) = 6
Store f.0(7) = 7
Store f.0(8) = 8
Store f.0(9) = 9