-
Notifications
You must be signed in to change notification settings - Fork 29
Dpctl c api constructors added, dpctl/include restructured #685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
View rendered docs @ https://intelpython.github.io/dpctl/pulls/685/index.html |
@densmirn @Alexander-Makaryev Most likely @napetrov Please forward this to relevant people working on |
@diptorupd This change is going to cause some disruption in downstream code:
I am not sure what But perhaps to minimize the disruption, we could temporarily add symbolic links in |
No please. It is a minimal change that we have enough time to fix in downstream. I will suggest that we keep the change out of 0.12 and then fix it. |
I am afraid I need parts of this PR (support for dpctl4pybind11) in 0.12.
UpdateDownstream projects can use #if defined __has_include
# if __has_include("dpctl_sycl_interface.h")
# include "dpctl_sycl_interface.h"
# else
# include "dpctl_sycl_queue_manager.h" // include one or more explicit dpctl_sycl* headers
# endif
#else
# include "dpctl_sycl_interface.h"
#endif for a transition period. I would therefore merge this to master once this change is added to downstream projects. |
Use __has_include to minimize disruption that the said reorg may cause
Use `__has_include` to work with both layouts
Use __has_include to minimize disruption that the said reorg may cause Co-authored-by: Alexander-Makaryev <alexander.makaryev@gmail.com>
Actually, testing locally, there are no conflicts between this branch and the work in #683 |
This is needed in order to be able to write pybind11 casters directly mapping sycl classes to `dpctl.Sycl*` classes for SyclContext, SyclQueue, SyclDevice and SyclEvent classes.
1. `dpctl/include` folder that is being installed in the site-packages/dpctl changes layout. It now has the structure dpctl/ include/ syclinterface/ *.h # all files that used to be in dpctl/include are moving here syclinterface.h dpctl_capi.h dpctl4pybind11.hpp _backend.pxd was modified to include syclinterface/ into path of header files from which we are importing build_backend.py was modified to copy install/include into dpctl/include/syclinterface instead of dpctl/include, and steps were added to also copy newly added dpctl/apis/include/* files into dpctl/include/ 2. Now, to work with syclinterface, one only needs `#include "syclinterface.h"` assuming `-I$(python -c "import dpctl; print(dpctl.get_include())")` is used 3. To work with `dpctl` objects using Python C-API one needs ``#include "dpctl_capi.h"`` where objects, types and C-API functions are declared. 4. To work with pybind11, one needs ``#include "dpctl4pybind11.hpp"`` where type casters are defined to map betwen ``sycl::queue`` and `dpctl.SyclQueue`, and correspondingly for ``sycl::device``, ``sycl::context`` and ``sycl::event``. Modifications to examples are forthcoming _backend.pxd should use syclinterface/ to reference .h files
Fixed runtime_error verbiage.
60c5523
to
d42e403
Compare
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Refactored
dpctl/include
layout. Instead of containing all files fromlibsyclinterface/include
it introduces substructure:The newly added files are residing in new folder
dpctl/apis/include
from whichbuild_backend.py
copies then intodpctl/include
Modified
_backend.pxd
to include"syclinterface/"
in the path.Modified
build_backend.py
to reassembledpctl/include
frominstall/include
anddpctl/apis/include
.Added
make_Sycl*
C-API functions to createSyclDevice
,SyclQueue
,SyclContext
andSyclEvent
from corresponding opaque reference. Usedget_device_ref
andmake_SyclDevice
to construct pybind11 type caster directly mappingdpctl.SyclDevice
Python object tosycl::device
in pybind11.Modified examples files to use new headers, and use casters.
Verified that all Cython extensions and Pybind11 extensions are building and are running as expected.