Skip to content
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

Decouple pybind11 and kernels #1516

Merged
merged 3 commits into from
Jan 31, 2024
Merged

Conversation

oleksandr-pavlyk
Copy link
Collaborator

Moved all uses of pybind11 types and functions out of libtensor/include/kernels.

  • Uses of py::object and casters were moved to respective *.cpp files.
  • dpctl::tensor::ssize_t was defined
  • Uses of py::ssize_t in function signatures replaced with of library's ssize_t type
  • #include "pybind11/pybind11.h" removed (speeding up compilation time)
  • Added static_assert(std::is_same_v(py::ssize_t, dpctl::tensor:;ssize_t>) in aome *.cpp files
  • #include <CL/sycl.hpp> has been replaced with #include <sycl/sycl.hpp>.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • If this PR is a work in progress, are you opening the PR as a draft?

This change affected linspace, arange, and full constructors. This
change causes no user visible changes.
Removed uses of `#include <pybind11/pybind11.h>` from header files in
libtensor/include/kernels folder

Replaced `#include <CL/sycl.hpp>` with `#include <sycl/sycl.hpp>`.

Introduced "kernels/dpctl_tensor_types.hpp" which defines the type,
and included it in header files.

Added static_assert in some CPP files to ensure that `py::ssize_t` is
the same as `dpctl::tensor::ssize_t`.
Copy link

github-actions bot commented Jan 30, 2024

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

@coveralls
Copy link
Collaborator

coveralls commented Jan 30, 2024

Coverage Status

coverage: 91.065%. remained the same
when pulling 069b8a8 on decouple-pybind11-and-kernels
into 11a933e on master.

Copy link

Array API standard conformance tests for dpctl=0.15.1dev3=py310h15de555_51 ran successfully.
Passed: 909
Failed: 0
Skipped: 86

@ndgrigorian
Copy link
Collaborator

@oleksandr-pavlyk
Do you see any reason to replace py::ssize_t in the offset utils or in memory_overlap.hpp?

@oleksandr-pavlyk
Copy link
Collaborator Author

I deliberately left "libtensor/include/utils" untouched, since some of those files work with dpctl4pybind11 and with pybind11 itself.

Files in the kernel subfolder do not, so I think we should leave memory_overlap as is.

Since utils headers are used in kernels, to make kernels/ independent
of pybind11, it is necessary to ensure that all depedent header files
also do not include pybind11.

Changed offset_utils to use dpctl::tensor::ssize_t instead of py::ssize_t.

Factored out pybind11 independent components of type_dispatch.hpp header
into type_dispatch_building.hpp . What remains uses dpctl4pybind11 and hence
genuinely depends on pybind11.
Copy link

Array API standard conformance tests for dpctl=0.15.1dev3=py310h15de555_52 ran successfully.
Passed: 909
Failed: 0
Skipped: 86

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for tackling this @oleksandr-pavlyk !

@oleksandr-pavlyk oleksandr-pavlyk merged commit 17b934a into master Jan 31, 2024
46 of 47 checks passed
@oleksandr-pavlyk oleksandr-pavlyk deleted the decouple-pybind11-and-kernels branch January 31, 2024 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants