Skip to content

Commit 612fe24

Browse files
Removing get_usm_pointer_type function (#474)
It was added in early iterations of #449 but then superseded by as_usm_memory, and the get_usm_pointer_type should have been removed. The reasoning for the removal can be found in comments left in #449
1 parent 4fbf7a9 commit 612fe24

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

dpctl/memory/_memory.pyx

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -117,49 +117,6 @@ def _to_memory(unsigned char[::1] b, str usm_kind):
117117
return res
118118

119119

120-
def get_usm_pointer_type(ptr, syclobj):
121-
"""
122-
get_usm_pointer_type(ptr, syclobj)
123-
124-
Gives the SYCL(TM) USM pointer type, using ``sycl::get_pointer_type``,
125-
returning one of 4 possible strings: 'shared', 'host', 'device',
126-
or 'unknown'.
127-
128-
Args:
129-
ptr: int
130-
A pointer stored as size_t Python integer.
131-
syclobj: :class:`dpctl.SyclContext` or :class:`dpctl.SyclQueue`
132-
Python object providing :class:`dpctl.SyclContext` against which
133-
to query for the pointer type.
134-
Returns:
135-
'unknown' if the pointer does not represent USM allocation made using
136-
the given context. Otherwise, returns 'shared', 'device', or 'host'
137-
type of the allocation.
138-
"""
139-
cdef const char* kind
140-
cdef SyclContext ctx
141-
cdef SyclQueue q
142-
cdef DPCTLSyclUSMRef USMRef = NULL
143-
try:
144-
USMRef = <DPCTLSyclUSMRef>(<size_t> ptr)
145-
except Exception as e:
146-
raise TypeError(
147-
"First argument {} could not be converted to Python integer of "
148-
"size_t".format(ptr)
149-
) from e
150-
if isinstance(syclobj, SyclContext):
151-
ctx = <SyclContext>(syclobj)
152-
return _Memory.get_pointer_type(USMRef, ctx).decode("UTF-8")
153-
elif isinstance(syclobj, SyclQueue):
154-
q = <SyclQueue>(syclobj)
155-
ctx = q.get_sycl_context()
156-
return _Memory.get_pointer_type(USMRef, ctx).decode("UTF-8")
157-
raise TypeError(
158-
"Second argument {} is expected to be an instance of "
159-
"SyclContext or SyclQueue".format(syclobj)
160-
)
161-
162-
163120
cdef class _Memory:
164121
""" Internal class implementing methods common to
165122
MemoryUSMShared, MemoryUSMDevice, MemoryUSMHost

0 commit comments

Comments
 (0)