Skip to content

Commit 352d2f8

Browse files
committed
Add aspect::ext_oneapi_ipc_memory for SyclDevice
Signed-off-by: Zhan Xue <zhan.xue@intel.com>
1 parent 65361bf commit 352d2f8

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

dpctl/_backend.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ cdef extern from "syclinterface/dpctl_sycl_enum_types.h":
101101
_emulated "emulated",
102102
_is_component "is_component",
103103
_is_composite "is_composite",
104+
_ext_oneapi_ipc_memory "ext_oneapi_ipc_memory",
104105

105106
ctypedef enum _partition_affinity_domain_type \
106107
"DPCTLPartitionAffinityDomainType":

dpctl/_sycl_device.pyx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,18 @@ cdef class SyclDevice(_SyclDevice):
885885
cdef _aspect_type AT = _aspect_type._is_composite
886886
return DPCTLDevice_HasAspect(self._device_ref, AT)
887887

888+
@property
889+
def has_aspect_ext_oneapi_ipc_memory(self):
890+
""" Returns ``True`` if this device supports inter-process
891+
communication (IPC) memory handles, ``False`` otherwise.
892+
893+
Returns:
894+
bool:
895+
Indicates if device supports IPC memory.
896+
"""
897+
cdef _aspect_type AT = _aspect_type._ext_oneapi_ipc_memory
898+
return DPCTLDevice_HasAspect(self._device_ref, AT)
899+
888900
@property
889901
def image_2d_max_width(self):
890902
""" Returns the maximum width of a 2D image or 1D image in pixels.

libsyclinterface/helper/source/dpctl_utils_helper.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ std::string DPCTL_AspectToStr(aspect aspectTy)
224224
case aspect::ext_oneapi_is_composite:
225225
ss << "is_composite";
226226
break;
227+
case aspect::ext_oneapi_ipc_memory:
228+
ss << "ext_oneapi_ipc_memory";
229+
break;
227230
default:
228231
throw std::runtime_error("Unsupported aspect type");
229232
}
@@ -299,6 +302,9 @@ aspect DPCTL_StrToAspectType(const std::string &aspectTyStr)
299302
else if (aspectTyStr == "is_composite") {
300303
aspectTy = aspect::ext_oneapi_is_composite;
301304
}
305+
else if (aspectTyStr == "ext_oneapi_ipc_memory") {
306+
aspectTy = aspect::ext_oneapi_ipc_memory;
307+
}
302308
else {
303309
// \todo handle the error
304310
throw std::runtime_error("Unsupported aspect type");
@@ -351,6 +357,8 @@ aspect DPCTL_DPCTLAspectTypeToSyclAspect(DPCTLSyclAspectType AspectTy)
351357
return aspect::ext_oneapi_is_component;
352358
case DPCTLSyclAspectType::is_composite:
353359
return aspect::ext_oneapi_is_composite;
360+
case DPCTLSyclAspectType::ext_oneapi_ipc_memory:
361+
return aspect::ext_oneapi_ipc_memory;
354362
default:
355363
throw std::runtime_error("Unsupported aspect type");
356364
}
@@ -401,6 +409,8 @@ DPCTLSyclAspectType DPCTL_SyclAspectToDPCTLAspectType(aspect Aspect)
401409
return DPCTLSyclAspectType::is_composite;
402410
case aspect::ext_oneapi_is_component:
403411
return DPCTLSyclAspectType::is_component;
412+
case aspect::ext_oneapi_ipc_memory:
413+
return DPCTLSyclAspectType::ext_oneapi_ipc_memory;
404414
default:
405415
throw std::runtime_error("Unsupported aspect type");
406416
}

libsyclinterface/include/syclinterface/dpctl_sycl_enum_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ typedef enum
133133
host_debuggable,
134134
emulated,
135135
is_component,
136-
is_composite
136+
is_composite,
137+
ext_oneapi_ipc_memory
137138
} DPCTLSyclAspectType;
138139

139140
/*!

0 commit comments

Comments
 (0)