Skip to content
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

Remove halide_assert() from halide_default_device_wrap_native #6381

Merged
merged 1 commit into from
Nov 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/runtime/device_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,15 @@ WEAK int halide_device_detach_native(void *user_context, struct halide_buffer_t
}

WEAK int halide_default_device_wrap_native(void *user_context, struct halide_buffer_t *buf, uint64_t handle) {
halide_assert(user_context, buf->device == 0);
// No: this can return halide_error_no_device_interface for OGLC and HVX,
// since `device_interface` may be set but `device` may not be. Instead,
// just return halide_error_code_device_wrap_native_failed if buf->device isn't set.
// (And *don't* halide_assert() here, as that will abort. Just return an error and let the caller handle it.)
//
// int result = debug_log_and_validate_buf(user_context, buf, "halide_default_device_wrap_native");
// if (result != 0) {
// return result;
// }
if (buf->device != 0) {
return halide_error_code_device_wrap_native_failed;
}
Expand Down