Skip to content

Commit 9ba523e

Browse files
Created dpctl::detail::dpctl_capi class to import_dpctl()
The class implements a singleton pattern that populates global variables exported by Cython CAPI functions via call to import_dpctl() and then populates internal struct members with pointers populated by Cython. This loads both Cython 'public api' functions, types, and integer values. dpctl::tensor::usm_ndarray and dpctl::memory::usm_memory classes, as well as type-casters for dpctl.SyclQueue <-> sycl::queue, dpctl.SyclDevice <-> sycl::device, etc. use dpctl_capi. The singleton patterns helps avoid static initialization order fiasco problem when using multiple translation units. Single dpctl_capi loads typenum values, the dpctl::tensor::detail::usm_ndarray_types struct no longer needs to be a singleton, and becomes an ordinary struct with a static method. tensor_py.cpp was changed to reflect that.
1 parent 798ecca commit 9ba523e

File tree

3 files changed

+380
-222
lines changed

3 files changed

+380
-222
lines changed

0 commit comments

Comments
 (0)