@@ -30,6 +30,7 @@ from ._backend cimport ( # noqa: E211
30
30
DPCTLPlatform_CreateFromSelector,
31
31
DPCTLPlatform_Delete,
32
32
DPCTLPlatform_GetBackend,
33
+ DPCTLPlatform_GetDefaultContext,
33
34
DPCTLPlatform_GetName,
34
35
DPCTLPlatform_GetPlatforms,
35
36
DPCTLPlatform_GetVendor,
@@ -40,15 +41,19 @@ from ._backend cimport ( # noqa: E211
40
41
DPCTLPlatformVector_GetAt,
41
42
DPCTLPlatformVector_Size,
42
43
DPCTLPlatformVectorRef,
44
+ DPCTLSyclContextRef,
43
45
DPCTLSyclDeviceSelectorRef,
44
46
DPCTLSyclPlatformRef,
45
47
_backend_type,
46
48
)
47
49
48
50
import warnings
49
51
52
+ from ._sycl_context import SyclContextCreationError
50
53
from .enum_types import backend_type
51
54
55
+ from ._sycl_context cimport SyclContext
56
+
52
57
__all__ = [
53
58
" get_platforms" ,
54
59
" lsplatform" ,
@@ -236,10 +241,10 @@ cdef class SyclPlatform(_SyclPlatform):
236
241
237
242
@property
238
243
def backend (self ):
239
- """ Returns the backend_type enum value for this device
244
+ """ Returns the backend_type enum value for this platform
240
245
241
246
Returns:
242
- backend_type: The backend for the device .
247
+ backend_type: The backend for the platform .
243
248
"""
244
249
cdef _backend_type BTy = (
245
250
DPCTLPlatform_GetBackend(self ._platform_ref)
@@ -255,6 +260,22 @@ cdef class SyclPlatform(_SyclPlatform):
255
260
else :
256
261
raise ValueError (" Unknown backend type." )
257
262
263
+ @property
264
+ def default_context (self ):
265
+ """ Returns the default platform context for this platform
266
+
267
+ Returns:
268
+ SyclContext: The default context for the platform.
269
+ """
270
+ cdef DPCTLSyclContextRef CRef = (
271
+ DPCTLPlatform_GetDefaultContext(self ._platform_ref)
272
+ )
273
+
274
+ if (CRef == NULL ):
275
+ raise
276
+ else :
277
+ return SyclContext._create(CRef)
278
+
258
279
259
280
def lsplatform (verbosity = 0 ):
260
281
"""
0 commit comments