Skip to content

Commit 739d652

Browse files
committed
eye uses queues_are_compatible, endpoint fix
1 parent 95e0cf8 commit 739d652

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dpctl/tensor/libtensor/source/tensor_py.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,9 +1827,9 @@ eye(py::ssize_t k,
18271827
}
18281828

18291829
sycl::queue dst_q = dst.get_queue();
1830-
if (dst_q != exec_q && dst_q.get_context() != exec_q.get_context()) {
1831-
throw py::value_error(
1832-
"Execution queue context is not the same as allocation context");
1830+
if (!dpctl::utils::queues_are_compatible(exec_q, {dst_q})) {
1831+
throw py::value_error("Execution queue is not compatible with the "
1832+
"allocation queue");
18331833
}
18341834

18351835
int dst_typenum = dst.get_typenum();
@@ -1857,17 +1857,17 @@ eye(py::ssize_t k,
18571857
start = (k < 0) ? -k : k * rows;
18581858
}
18591859

1860+
const py::ssize_t *strides = dst.get_strides_raw();
18601861
py::ssize_t step;
1861-
if (dst.get_strides_raw() == nullptr) {
1862+
if (strides == nullptr) {
18621863
step = (is_dst_c_contig) ? cols + 1 : rows + 1;
18631864
}
18641865
else {
1865-
const py::ssize_t *strides = dst.get_strides_raw();
18661866
step = strides[0] + strides[1];
18671867
}
18681868

18691869
const py::ssize_t length = std::min({rows, cols, rows + k, cols - k});
1870-
const py::ssize_t end = start + step * (length - 1) + 1;
1870+
const py::ssize_t end = start + step * (length - 1);
18711871

18721872
char *dst_data = dst.get_data();
18731873
sycl::event eye_event;

0 commit comments

Comments
 (0)