Skip to content

Commit 3a12589

Browse files
committed
Use khr_default_context() per DPC++ compiler deprecation warning
1 parent e39b013 commit 3a12589

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

docs/doc_sources/user_guides/dlpack.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ When sharing USM allocation (of any ``sycl::usm::kind``) with ``void * ptr`` bou
4646
// Keep in mind, the device may be a sub-device
4747
const sycl::device &ptr_dev = sycl::get_pointer_device(ptr, ctx);
4848
49-
#if SYCL_EXT_ONEAPI_DEFAULT_CONTEXT
50-
const sycl::context &default_ctx = ptr_dev.get_platform().ext_oneapi_get_default_context();
49+
#if SYCL_KHR_DEFAULT_CONTEXT
50+
const sycl::context &default_ctx = ptr_dev.get_platform().khr_get_default_context();
5151
#else
5252
static_assert(false, "ext_oneapi_default_context extension is required");
5353
#endif
@@ -106,8 +106,8 @@ Importing DLPack with ``device_type == kDLOneAPI``
106106
// );
107107
108108
// Get default platform context
109-
#if SYCL_EXT_ONEAPI_DEFAULT_CONTEXT
110-
const sycl::context &default_ctx = root_device.get_platform().ext_oneapi_get_default_context();
109+
#if SYCL_KHR_DEFAULT_CONTEXT
110+
const sycl::context &default_ctx = root_device.get_platform().khr_get_default_context();
111111
#else
112112
static_assert(false, "ext_oneapi_default_context extension is required");
113113
#endif

libsyclinterface/source/dpctl_sycl_platform_interface.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,15 @@ DPCTLPlatform_GetDefaultContext(__dpctl_keep const DPCTLSyclPlatformRef PRef)
227227
{
228228
auto P = unwrap<platform>(PRef);
229229
if (P) {
230-
#ifdef SYCL_EXT_ONEAPI_DEFAULT_CONTEXT
230+
#if defined(SYCL_KHR_DEFAULT_CONTEXT) || defined(SYCL_EXT_ONEAPI_DEFAULT_CONTEXT)
231231
try {
232-
const auto &default_ctx = P->ext_oneapi_get_default_context();
232+
const auto &default_ctx = P->
233+
#ifdef SYCL_KHR_DEFAULT_CONTEXT
234+
khr_get_default_context()
235+
#else
236+
ext_oneapi_get_default_context()
237+
#endif
238+
;
233239
return wrap<context>(new context(default_ctx));
234240
} catch (const std::exception &ex) {
235241
error_handler(ex, __FILE__, __func__, __LINE__);

0 commit comments

Comments
 (0)