Replies: 6 comments 1 reply
-
There was no such change (at least, not intentionally), so this may be a bug. Maybe @steven-johnson knows if something has changed that might have caused this. |
Beta Was this translation helpful? Give feedback.
-
I'm not aware of any such (intentional) change to the Python Buffer code between Halide 13 and Halide 14. Generally, the intended behavior is to never to a copy to/from host/gpu unless needed -- i.e., it should never pre-emptively copy in either direction until that data is going to be immediately used -- so this sounds like a regression. (I don't see a "patch below", can you include it?) |
Beta Was this translation helpful? Give feedback.
-
OK, this is interesting: The lesson-10 tutorial just uses a |
Beta Was this translation helpful? Give feedback.
-
So I'm assuming that you used the tutorial here as a convenient example, but the issue is really in "real" code you have. EDIT: |
Beta Was this translation helpful? Give feedback.
-
Great, thanks for looking into this! I also concluded that calling |
Beta Was this translation helpful? Give feedback.
-
In Halide 13, if I modify lesson 10 in the the python bindings tutorial to use GPU tiling (see patch below) then the output does not seem to be properly copied back to the host. To get the correct output data, I had to modify the generated .py.cpp file to include a call to
halide_copy_to_host
.However, when applying the same patch to Halide 14, there is no need for such a call to
halide_copy_to_host
.Was there a change between Halide 13 and Halide 14 that automatically ensures the buffer is copied to host after calling an AOT function? There is not call to
halide_copy_to_host
in the generated .py.cpp, so it must be a change elsewhere.As a side-note: For performance reasons we have usually been happy that the result is not copied back to host automatically when calling AOT-compiled functions in C++. That allows us to keep the data on the GPU only for as long as possible. However, when working exclusively in Python the new behavior in Halide 14 almost seems necessary, since I could not find any other way to trigger a copy to host.
EDIT: Added patch.
Beta Was this translation helpful? Give feedback.
All reactions