Skip to content

Commit 0c5b6e8

Browse files
committed
only events from host task has to be passed in keep_args_alive()
1 parent 05c7d77 commit 0c5b6e8

File tree

4 files changed

+51
-7
lines changed

4 files changed

+51
-7
lines changed

.github/workflows/conda-package.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ jobs:
196196
run: |
197197
python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
198198
working-directory: ${{ env.tests-path }}
199+
env:
200+
SYCL_QUEUE_THREAD_POOL_SIZE: 6
199201

200202
test_windows:
201203
name: Test ['windows-latest', python='${{ matrix.python }}']
@@ -333,6 +335,8 @@ jobs:
333335
run: |
334336
python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
335337
working-directory: ${{ env.tests-path }}
338+
env:
339+
SYCL_QUEUE_THREAD_POOL_SIZE: 6
336340

337341
upload:
338342
name: Upload ['${{ matrix.os }}', python='${{ matrix.python }}']

.github/workflows/generate_coverage.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
env:
6767
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6868
COVERALLS_PARALLEL: true
69+
SYCL_QUEUE_THREAD_POOL_SIZE: 6
6970

7071
coveralls:
7172
name: Indicate completion to coveralls.io

dpnp/backend/extensions/vm/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ endif()
7070

7171
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
7272

73+
target_link_libraries(${python_module_name} PUBLIC oneDPL)
74+
75+
if (UNIX)
76+
# needed for STL headers with GCC < 11
77+
target_compile_definitions(${python_module_name} PUBLIC _GLIBCXX_USE_TBB_PAR_BACKEND=0)
78+
endif()
79+
80+
target_compile_definitions(${python_module_name} PUBLIC PSTL_USE_PARALLEL_POLICIES=0)
81+
# work-around for Windows at exit crash with predefined policies
82+
target_compile_definitions(${python_module_name} PUBLIC ONEDPL_USE_PREDEFINED_POLICIES=0)
83+
7384
install(TARGETS ${python_module_name}
7485
DESTINATION "dpnp/backend/extensions/vm"
7586
)

dpnp/backend/extensions/vm/div.cpp

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,32 @@ static sycl::event div_impl(sycl::queue exec_q,
6464
{
6565
type_utils::validate_type_for_device<T>(exec_q);
6666

67-
const T* a = reinterpret_cast<const T*>(in_a);
68-
const T* b = reinterpret_cast<const T*>(in_b);
69-
T* y = reinterpret_cast<T*>(out_y);
67+
const T* _a = reinterpret_cast<const T*>(in_a);
68+
const T* _b = reinterpret_cast<const T*>(in_b);
69+
T* _y = reinterpret_cast<T*>(out_y);
7070

71-
return mkl_vm::div(exec_q,
71+
T* a = sycl::malloc_device<T>(n, exec_q);
72+
T* b = sycl::malloc_device<T>(n, exec_q);
73+
T* y = sycl::malloc_device<T>(n, exec_q);
74+
75+
exec_q.copy(_a, a, n).wait();
76+
exec_q.copy(_b, b, n).wait();
77+
exec_q.copy(_y, y, n).wait();
78+
79+
sycl::event ev = mkl_vm::div(exec_q,
7280
n, // number of elements to be calculated
7381
a, // pointer `a` containing 1st input vector of size n
7482
b, // pointer `b` containing 2nd input vector of size n
7583
y, // pointer `y` to the output vector of size n
7684
depends);
85+
ev.wait();
86+
87+
exec_q.copy(y, _y, n).wait();
88+
89+
sycl::free(a, exec_q);
90+
sycl::free(b, exec_q);
91+
sycl::free(y, exec_q);
92+
return sycl::event();
7793
}
7894

7995
std::pair<sycl::event, sycl::event> div(sycl::queue exec_q,
@@ -175,9 +191,21 @@ std::pair<sycl::event, sycl::event> div(sycl::queue exec_q,
175191
throw py::value_error("No div implementation defined");
176192
}
177193
sycl::event sum_ev = div_fn(exec_q, src_nelems, src1_data, src2_data, dst_data, depends);
178-
179-
sycl::event ht_ev = dpctl::utils::keep_args_alive(exec_q, {src1, src2, dst}, {sum_ev});
180-
return std::make_pair(ht_ev, sum_ev);
194+
// sum_ev.wait();
195+
196+
// int* dummy = sycl::malloc_device<int>(1, exec_q);
197+
// sycl::event cleanup_ev = exec_q.submit([&](sycl::handler& cgh) {
198+
// // cgh.depends_on(sum_ev);
199+
// auto ctx = exec_q.get_context();
200+
// cgh.host_task([dummy, ctx]() {
201+
// // dummy host task to pass into keep_args_alive
202+
// sycl::free(dummy, ctx);
203+
// });
204+
// });
205+
206+
// sycl::event ht_ev = dpctl::utils::keep_args_alive(exec_q, {src1, src2, dst}, {sum_ev});
207+
// return std::make_pair(ht_ev, sum_ev);
208+
return std::make_pair(sycl::event(), sycl::event());
181209
}
182210

183211
bool can_call_div(sycl::queue exec_q,

0 commit comments

Comments
 (0)