Skip to content

Cleanup tensor_py #923

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

Closed
wants to merge 19 commits into from
Closed

Cleanup tensor_py #923

wants to merge 19 commits into from

Conversation

oleksandr-pavlyk
Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk commented Oct 7, 2022

This housekeeping PR breaks down the monolithic, single-translation-unit tensor_py.cpp into bunch of individual .cpp files implementing individual Python binding functions.

This separation should improve incremental rebuilding, make it easier to add more functions in separate .hpp and .cpp files.

It also factors out kernel implementations into stand-alone header files which can potentially be reused.

While refactoring, several problems were fixed:

  1. fixed sneaking "static initialization order fiasco" present in the sources but masked by use of the single translation unit.
  2. fixed missing api keyword in _memory.pxd for PyMemoryUSMDevice class
  3. refactored _tensor_imp.default_device_fp_type, et. al. functions.
  • 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?

…es`.

The class is already singleton. Instead create a local variable at
each use site. This local variable is going to be a constant reference
to the singleton.
Use -O1 when compiling tensor_py for now to work around suspected issue
with loading of C-API functions.
dpctl_capi is using `new` to dynamically create instance of the
class which imports dpctl and populates global variables used by
Cython to export its API.
dpctl::tensor::detail::usm_ndarray_types is no longer a singleton, since
it uses dpctl::detail::dpctl_capi to access type constants. Consequentially,
many methods associated with making it singleton are removed, including
method get(). It is now default constructed at use sites like an ordinary
C++ class.
@github-actions
Copy link

github-actions bot commented Oct 7, 2022

@coveralls
Copy link
Collaborator

Coverage Status

Coverage remained the same at 82.001% when pulling e6e7af7 on cleanup-tensor-py into 7b368a1 on master.

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Array API standard conformance tests failed to run for dpctl=0.14.0dev0=py310h8c27c75_160.

@oleksandr-pavlyk
Copy link
Contributor Author

I am going to close this PR, and open smaller PRs for review.

@github-actions
Copy link

github-actions bot commented Oct 8, 2022

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

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.

2 participants