mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-22 05:57:48 +00:00
use the correct SYCL context for host USM allocations (llama/7777)
Signed-off-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
This commit is contained in:
parent
760497e1ab
commit
1fe5948227
@ -13089,10 +13089,12 @@ void *ggml_sycl_host_malloc(size_t size) try {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ggml_sycl_set_device(g_main_device);
|
||||||
|
dpct::queue_ptr main_stream = g_syclStreams[g_main_device][0];
|
||||||
|
|
||||||
void * ptr = nullptr;
|
void * ptr = nullptr;
|
||||||
//allow to use dpct::get_in_order_queue() for host malloc
|
|
||||||
dpct::err0 err = CHECK_TRY_ERROR(
|
dpct::err0 err = CHECK_TRY_ERROR(
|
||||||
ptr = (void *)sycl::malloc_host(size, dpct::get_in_order_queue()));
|
ptr = (void *)sycl::malloc_host(size, *main_stream));
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
// clear the error
|
// clear the error
|
||||||
@ -13113,8 +13115,9 @@ catch (sycl::exception const &exc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ggml_sycl_host_free(void *ptr) try {
|
void ggml_sycl_host_free(void *ptr) try {
|
||||||
//allow to use dpct::get_in_order_queue() for host malloc
|
ggml_sycl_set_device(g_main_device);
|
||||||
SYCL_CHECK(CHECK_TRY_ERROR(sycl::free(ptr, dpct::get_in_order_queue())));
|
dpct::queue_ptr main_stream = g_syclStreams[g_main_device][0];
|
||||||
|
SYCL_CHECK(CHECK_TRY_ERROR(sycl::free(ptr, *main_stream)));
|
||||||
}
|
}
|
||||||
catch (sycl::exception const &exc) {
|
catch (sycl::exception const &exc) {
|
||||||
std::cerr << exc.what() << "Exception caught at file:" << __FILE__
|
std::cerr << exc.what() << "Exception caught at file:" << __FILE__
|
||||||
|
Loading…
Reference in New Issue
Block a user