Skip to content

Return events for comp. tasks, rather than temp-clean up host tasks #1176

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

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,7 @@ std::pair<sycl::event, sycl::event> py_nonzero(
sycl::event py_obj_management_host_task_ev = dpctl::utils::keep_args_alive(
exec_q, {cumsum, indexes}, host_task_events);

return std::make_pair(py_obj_management_host_task_ev,
temporaries_cleanup_ev);
return std::make_pair(py_obj_management_host_task_ev, non_zero_indexes_ev);
}

} // namespace py_internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ copy_usm_ndarray_into_usm_ndarray(dpctl::tensor::usm_ndarray src,
host_task_events.push_back(temporaries_cleanup_ev);

return std::make_pair(keep_args_alive(exec_q, {src, dst}, host_task_events),
temporaries_cleanup_ev);
copy_and_cast_generic_ev);
}

void init_copy_and_cast_usm_to_usm_dispatch_tables(void)
Expand Down
2 changes: 1 addition & 1 deletion dpctl/tensor/libtensor/source/copy_for_reshape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ copy_usm_ndarray_for_reshape(dpctl::tensor::usm_ndarray src,
host_task_events.push_back(temporaries_cleanup_ev);

return std::make_pair(keep_args_alive(exec_q, {src, dst}, host_task_events),
temporaries_cleanup_ev);
copy_for_reshape_event);
}

void init_copy_for_reshape_dispatch_vectors(void)
Expand Down
4 changes: 2 additions & 2 deletions dpctl/tensor/libtensor/source/integer_advanced_indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ usm_ndarray_take(dpctl::tensor::usm_ndarray src,
sycl::event arg_cleanup_ev =
keep_args_alive(exec_q, {src, py_ind, dst}, host_task_events);

return std::make_pair(arg_cleanup_ev, temporaries_cleanup_ev);
return std::make_pair(arg_cleanup_ev, take_generic_ev);
}

std::pair<sycl::event, sycl::event>
Expand Down Expand Up @@ -854,7 +854,7 @@ usm_ndarray_put(dpctl::tensor::usm_ndarray dst,
sycl::event arg_cleanup_ev =
keep_args_alive(exec_q, {dst, py_ind, val}, host_task_events);

return std::make_pair(arg_cleanup_ev, temporaries_cleanup_ev);
return std::make_pair(arg_cleanup_ev, put_generic_ev);
}

void init_advanced_indexing_dispatch_tables(void)
Expand Down
5 changes: 2 additions & 3 deletions dpctl/tensor/libtensor/source/triul_ctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ usm_ndarray_triul(sycl::queue exec_q,
}

auto temporaries_cleanup_ev = exec_q.submit([&](sycl::handler &cgh) {
cgh.depends_on({tri_ev});
cgh.depends_on(tri_ev);
auto ctx = exec_q.get_context();
cgh.host_task(
[shp_host_shape_and_strides, dev_shape_and_strides, ctx]() {
Expand All @@ -213,8 +213,7 @@ usm_ndarray_triul(sycl::queue exec_q,
});

return std::make_pair(
keep_args_alive(exec_q, {src, dst}, {temporaries_cleanup_ev}),
temporaries_cleanup_ev);
keep_args_alive(exec_q, {src, dst}, {temporaries_cleanup_ev}), tri_ev);
}

void init_triul_ctor_dispatch_vectors(void)
Expand Down
2 changes: 1 addition & 1 deletion dpctl/tensor/libtensor/source/where.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ py_where(dpctl::tensor::usm_ndarray condition,
sycl::event arg_cleanup_ev =
keep_args_alive(exec_q, {x1, x2, condition, dst}, host_task_events);

return std::make_pair(arg_cleanup_ev, temporaries_cleanup_ev);
return std::make_pair(arg_cleanup_ev, where_ev);
}

void init_where_dispatch_tables(void)
Expand Down