File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -74,10 +74,20 @@ cdef class Memory:
7474 return " <Intel(R) USM allocated memory block of {} bytes at {}>" \
7575 .format(self .nbytes, hex (< object > (< Py_ssize_t> self .memory_ptr)))
7676
77- def _usm_type (self ):
77+ def _usm_type (self , sycl_context = None ):
7878 cdef const char * kind
79- kind = DPPLUSM_GetPointerType(self .memory_ptr,
80- self .context.get_context_ref())
79+ cdef SyclContext ctx
80+ if sycl_context is None :
81+ ctx = self .context
82+ kind = DPPLUSM_GetPointerType(self .memory_ptr,
83+ ctx.get_context_ref())
84+ elif isinstance (sycl_context, SyclContext):
85+ ctx = < SyclContext> (sycl_context)
86+ kind = DPPLUSM_GetPointerType(self .memory_ptr,
87+ ctx.get_context_ref())
88+ else :
89+ raise ValueError (" sycl_context keyword can be either None, "
90+ " or an instance of dppl.SyclConext" )
8191 return kind.decode(' UTF-8' )
8292
8393
You can’t perform that action at this time.
0 commit comments