1

Say I have computation something like

Image resultA, resultB;
Func A, B, C, D, E; 
Var x, y;
A(x,y) = C(x,y) * D(x,y);
B(x,y) = C(x,y) - D(x,y);
E(x,y) = abs(A(x,y)/B(x,y));  

resultA(x,y) = sqrt(E(x,y));

resultB(x,y) =  2.f * E(x,y) + C(x,y);

How to define AOT schedule such that I can save resultA and resultB ?
E(x,y) is common to the computation of resultA and resultB.

Thank you in advance

1 Answer 1

2

If the results are the same size in all dimensions, you can return a Tuple:

result(x, y) = Tuple(resultA, resultB);

If they are not the same size, they can be added to a Pipeline and the Pipeline can be compiled to a filter that returns multiple Funcs.

See:

https://github.com/halide/Halide/blob/master/test/correctness/multiple_outputs.cpp

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.