Skip to content

Commit aef3dd1

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

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
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: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,17 +227,24 @@ 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) || \
231+
defined(SYCL_EXT_ONEAPI_DEFAULT_CONTEXT)
231232
try {
232-
const auto &default_ctx = P->ext_oneapi_get_default_context();
233+
const auto &default_ctx = P->
234+
#ifdef SYCL_KHR_DEFAULT_CONTEXT
235+
khr_get_default_context()
236+
#else
237+
ext_oneapi_get_default_context()
238+
#endif // SYCL_KHR_DEFAULT_CONTEXT
239+
;
233240
return wrap<context>(new context(default_ctx));
234241
} catch (const std::exception &ex) {
235242
error_handler(ex, __FILE__, __func__, __LINE__);
236243
return nullptr;
237244
}
238245
#else
239246
return nullptr;
240-
#endif
247+
#endif // SYCL_KHR_DEFAULT_CONTEXT || SYCL_EXT_ONEAPI_DEFAULT_CONTEXT
241248
}
242249
else {
243250
error_handler(

0 commit comments

Comments
 (0)