-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix default device wrap native function #6310
Conversation
Currently, an attempt to call device_wrap_native on a target that uses the default device wrap native function will result in an error of type halide_error_device_interface_no_device, namely in the OpenGLCompute and the Hexagon targets. This happens because the default wrap native function calls debug_log_and_validate_buf after the device_interface is set in halide_device_wrap_native but before the device handle is set, which is validated as a bad state. This patch removes the validation call and adds an assert for the handle much like the other wrap_native implementations in other targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct to me. Thanks for the fix!
Perhaps this was missed, do I need to do anything else for this pull request? |
Yes it was missed. Thanks for the ping. |
Update: this is causing some issues downstream, and I wonder at the logic of this change: |
(side note: we should rename |
This was inserted in #6310, probably mistakenly, since `halide_assert()` in the Halide runtime is *not* a debug-only assertion). Instead of a controlled runtime failure, we just abort, which is not OK.
This was inserted in #6310, probably mistakenly, since `halide_assert()` in the Halide runtime is *not* a debug-only assertion). Instead of a controlled runtime failure, we just abort, which is not OK.
Currently, an attempt to call
device_wrap_native
on a target that usesthe default device wrap native function will result in an error of type
halide_error_device_interface_no_device
, namely in the OpenGLCompute andthe Hexagon targets. This happens because the default wrap native
function calls
debug_log_and_validate_buf
after thedevice_interface
isset in
halide_device_wrap_native
but before thedevice
handle is set,which is validated as a bad state.
This patch removes the validation call and adds an assert for the handle
much like the other wrap_native implementations in other targets.