0

I need to move a region from a texture to another location. If the two blocks don't overlap, there's not problem there. I know Halide is the right solution but I can't figure out how to wait for a read before writing to an overlapping pixel... I could iterate one way or the other depending on the direction of the move, but I couldn't find a way to express that in Halide. Is Halide able to understand these subtleties?

1 Answer 1

1

The way to iterate in the reverse direction is to invert an RDom:

RDom range(0, width);
f(width - range.x) = g(width - range.x); // Copy value going from higher addresses to lower.

(Providing syntactic sugar for this has been on the todo list for a while. I think we've talked about scheduling directives for reversing loops as well. In that case, you'd use specialize to decide which direction handles the overlap correctly and dispatch to the appropriate schedule. At present however, the RDom subtracted from the extent method is probably the only option.)

2
  • Thank you! Is there any way to take a Input<Func> from a generator and get the extents just from that, or do I have the pass the width/height as parameters? Apr 28, 2017 at 12:09
  • With Input<Func> you have to pass any extents as parameters. With Input<Buffer<...>> you should be able to use the extent accessors such as width(). Apr 28, 2017 at 16:00

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.