Skip to content

Commit 356ee5e

Browse files
committed
Remove unnecessary context parameters
Signed-off-by: Zhan Xue <zhan.xue@intel.com>
1 parent c5008a4 commit 356ee5e

1 file changed

Lines changed: 8 additions & 22 deletions

File tree

dpctl/memory/_memory.pyx

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,9 +1054,6 @@ cdef class IPCMemoryHandle:
10541054
----------
10551055
usm_memory : MemoryUSMDevice
10561056
USM device memory object whose pointer to export.
1057-
context : dpctl.SyclContext, optional
1058-
SYCL context to use. Defaults to the context of *usm_memory*'s
1059-
queue.
10601057
10611058
Raises
10621059
------
@@ -1093,7 +1090,7 @@ cdef class IPCMemoryHandle:
10931090
self._opaque_ptr = NULL
10941091
self._closed = False
10951092

1096-
def __init__(self, _Memory usm_memory not None, SyclContext context=None):
1093+
def __init__(self, _Memory usm_memory not None):
10971094
if not DPCTLIPCMem_Available():
10981095
raise RuntimeError("IPC memory not supported in this build")
10991096

@@ -1121,8 +1118,7 @@ cdef class IPCMemoryHandle:
11211118
)
11221119

11231120
cdef SyclQueue q = usm_memory.queue
1124-
if context is None:
1125-
context = q.sycl_context
1121+
cdef SyclContext context = q.sycl_context
11261122

11271123
cdef DPCTLSyclContextRef ctx_ref = context.get_context_ref()
11281124
cdef char *data_out = NULL
@@ -1158,8 +1154,7 @@ cdef class IPCMemoryHandle:
11581154
@staticmethod
11591155
def open(bytes handle_bytes not None,
11601156
SyclDevice device not None,
1161-
Py_ssize_t nbytes,
1162-
SyclContext context=None):
1157+
Py_ssize_t nbytes):
11631158
"""Open an IPC handle in this process.
11641159
11651160
Parameters
@@ -1171,9 +1166,6 @@ cdef class IPCMemoryHandle:
11711166
Device to map the memory on.
11721167
nbytes : int
11731168
Byte size of the original allocation. Must be > 0.
1174-
context : dpctl.SyclContext, optional
1175-
SYCL context to use. Defaults to the default context for
1176-
*device*'s platform.
11771169
11781170
Returns
11791171
-------
@@ -1204,8 +1196,7 @@ cdef class IPCMemoryHandle:
12041196
cdef const char *raw = PyBytes_AS_STRING(handle_bytes)
12051197
cdef size_t raw_size = <size_t>len(handle_bytes)
12061198

1207-
if context is None:
1208-
context = device.sycl_platform.default_context
1199+
cdef SyclContext context = device.sycl_platform.default_context
12091200

12101201
cdef DPCTLSyclContextRef ctx_ref = context.get_context_ref()
12111202
cdef DPCTLSyclDeviceRef dev_ref = device.get_device_ref()
@@ -1294,29 +1285,26 @@ cdef class IPCMemoryHandle:
12941285

12951286
# ─── SYCL IPC free functions ──────────────────────────────────────────
12961287

1297-
def SyclIPCGetMemHandle(_Memory usm_memory not None, SyclContext context=None):
1288+
def SyclIPCGetMemHandle(_Memory usm_memory not None):
12981289
"""Export a USM device allocation as IPC handle bytes.
12991290
13001291
Parameters
13011292
----------
13021293
usm_memory : MemoryUSMDevice
13031294
USM device memory to export.
1304-
context : dpctl.SyclContext, optional
1305-
SYCL context. Defaults to the memory's queue context.
13061295
13071296
Returns
13081297
-------
13091298
bytes
13101299
Opaque IPC handle data for cross-process transport.
13111300
"""
1312-
cdef IPCMemoryHandle h = IPCMemoryHandle(usm_memory, context)
1301+
cdef IPCMemoryHandle h = IPCMemoryHandle(usm_memory)
13131302
return h.to_bytes()
13141303

13151304

13161305
def SyclIPCOpenMemHandle(bytes handle_bytes not None,
13171306
SyclDevice device not None,
1318-
Py_ssize_t nbytes,
1319-
SyclContext context=None):
1307+
Py_ssize_t nbytes):
13201308
"""Open an IPC handle and return a mapped MemoryIPCDevice.
13211309
13221310
Parameters
@@ -1327,15 +1315,13 @@ def SyclIPCOpenMemHandle(bytes handle_bytes not None,
13271315
Device to map the memory on.
13281316
nbytes : int
13291317
Byte size of the original allocation.
1330-
context : dpctl.SyclContext, optional
1331-
SYCL context. Defaults to the platform default context.
13321318
13331319
Returns
13341320
-------
13351321
MemoryIPCDevice
13361322
Mapped IPC memory. Must be closed with :func:`SyclIPCCloseMemHandle`.
13371323
"""
1338-
return IPCMemoryHandle.open(handle_bytes, device, nbytes, context)
1324+
return IPCMemoryHandle.open(handle_bytes, device, nbytes)
13391325

13401326

13411327
def SyclIPCCloseMemHandle(_Memory usm_memory not None):

0 commit comments

Comments
 (0)