diff --git a/llvm/tools/hpvm/test/unitTests/CreateNodeAndEdge.c b/llvm/tools/hpvm/test/unitTests/CreateNodeAndEdge.c new file mode 100644 index 0000000000000000000000000000000000000000..f8ba09217de591d4ccc7cd81896d0d865b6d7ba5 --- /dev/null +++ b/llvm/tools/hpvm/test/unitTests/CreateNodeAndEdge.c @@ -0,0 +1,52 @@ +#include <stdio.h> +#include "visc.h" + +struct Root { + int *input; + int *output; +}; + + +void Func1(int *In, int *Out) { + __visc__hint (CPU_TARGET); + __visc__attributes(1, In, 1, Out); + + __visc__return(1, Out); +} + +void Func2(int *BindIn, int *SrcIn, int *Out) { + __visc__hint (CPU_TARGET); + __visc__attributes(2, BindIn, SrcIn, 1, Out); + + __visc__return(1, Out); +} + +void PipeRoot(int *In, int *Out) { + __visc__hint (CPU_TARGET); + + __visc__attributes(1, In, 1, Out); + + void* SrcNode = __visc__createNodeND(0, Func1); + void* DestNode = __visc__createNodeND(0, Func2); + + __visc__bindIn(SrcNode, 0, 0, 0); + + __visc__bindIn(DestNode, 0, 0, 0); + __visc__edge(SrcNode, DestNode, 1, 0, 1, 0); + + __visc__bindOut(SrcNode, 0, 0, 0); +} + +int main(void) { + int In = 1; + int Out = 0; + struct Root RootArgs = {(int *) &In, (int *) &Out}; + + __visc__init(); + void* PipeDFG = __visc__launch(0, PipeRoot, (void *) &RootArgs); + __visc__wait(PipeDFG); + __visc__cleanup(); + + return 0; +} +