File: realize_condition_depends_on_tuple.cpp

package info (click to toggle)
halide 21.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,752 kB
  • sloc: cpp: 289,334; ansic: 22,751; python: 7,486; makefile: 4,299; sh: 2,508; java: 1,549; javascript: 282; pascal: 207; xml: 127; asm: 9
file content (31 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "Halide.h"

using namespace Halide;

// This is a test for a bug where the condition on a realize node didn't have
// tuple-valued calls resolved if the realization was itself tuple-valued.

int main(int argc, char **argv) {
    Func f;
    Param<int> p;
    f() = {p, p};

    Func g;
    g() = {4, 4};

    Func h;
    h() = g()[1];

    // h may or may not be necessary to evaluate, depending on a load from f,
    // which means g in turn may or may not be necessary to allocate.
    Func out;
    out() = select(f()[1] == 3, h(), 17);

    f.compute_root();
    g.compute_root();
    h.compute_root();
    out.compile_jit();

    printf("Success!\n");
    return 0;
}