-
Notifications
You must be signed in to change notification settings - Fork 182
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
[enhancement] Refactor onedal/datatypes
in preparation for dlpack support
#2195
Conversation
Introducing dlpack first requires refactoring the datatypes directory in order to reduce tech debt and simplify reviewing. This PR will drop dlpack support to a second PR and will focus on refactoring directory. |
18a9d4d
to
058372f
Compare
onedal/datatypes
in preparation for dlpack support
/intelci: run |
Codecov ReportAttention: Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
|
onedal/datatypes
in preparation for dlpack supportonedal/datatypes
in preparation for dlpack support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like pure refactoring. Let's wait for a green CI and LGTM.
/intelci: run |
* start from #2195 * add apache license * add files from #1568 * start converting over * attempts to fix copyright checker * remove table_metadata * merge * weird merge * renaming * change location * will implement these elsewhere * move files to follow naming * change headers further * interim standpoint which will fail * interim changes * helper -> utils * move macro to a central spot * remove whitespace * commit before merge * current status * interim * remove and format * more fixes * add fixes * add fixes * more fixes * add fixes * more fixes * more fixes * updates * updates * more fixes * formatting * formatting * formatting * changes * move header include * fix tensor issue * type change * move literals to see if it helps * status * remove inline * move ordering in table.cpp * missing whitespace * change macro section * add some commentary * attempt to shorten with a macro * first fixes for array_api_strict * formatting * remove unneeded code * remove unneeded code * oops * make better logic * attempt to include byte_offset * convert to static_cast entirely * back to reinterpret_cast * add initial tests * remove array api from contiguous test * hide behind if statement, definite a TODO * working on test case failures * switch to length_error * Update test_data.py * Update test_data.py * Update test_data.py * retest with dpnp and dpctl * fix stride counting * begin testing strategy change * add tests * fix mistakes in test * move class out of if statement * Update test_validation.py * remove pandas * missing change * add initial memory leak checking * remove get_namespace * remove dpc backend skip * fix issue in get_namespace change * further fixes * attempt again * address changes * add recursion block on suggestion * Update doc/third-party-programs-sklearnex.txt Co-authored-by: Alexander Andreev <[email protected]> * add testing for emptys and simple types * rewrite test * attempt to solve empty and dlpack scalars * deal with odd scenario * fix some tests * attempt at making things consistent * oops * try again * try to swap * Update test_data.py * Update dlpack_utils.cpp * Update test_data.py * Update test_data.py * Update test_data.py * Update data_conversion.cpp * Update data_conversion.cpp * try again * bad logic correction * make consistent * std -> py * missing bracket * additional fixes * further homogenation * try again * fix dlpack again * set a ticket up to solve this edge case * Update test_data.py * Update test_data.py * Update dtype_conversion.cpp * Update data_conversion.cpp * Update data_conversion.cpp * Update data_conversion.cpp * Update dtype_conversion.cpp * Update data_conversion.cpp * Update test_data.py * Update test_data.py * Update test_data.py * Update onedal/datatypes/dlpack/dlpack_utils.cpp Co-authored-by: Victoriya Fedotova <[email protected]> * Update onedal/datatypes/dlpack/data_conversion.cpp Co-authored-by: Victoriya Fedotova <[email protected]> * Update onedal/datatypes/sycl_usm/dtype_conversion.cpp Co-authored-by: Victoriya Fedotova <[email protected]> * Update test_data.py * Update test_data.py * Update test_data.py * Update test_data.py * Update dlpack_utils.cpp * Update dlpack_utils.cpp * Update data_conversion.cpp * Update data_conversion.cpp * Update data_conversion.cpp * Update data_conversion.cpp * clang formatting * fight segfault with dpctl * Update data_conversion.cpp * formatting * Update test_data.py * Update test_data.py * formatting' * Update dlpack_utils.cpp --------- Co-authored-by: Alexander Andreev <[email protected]> Co-authored-by: Victoriya Fedotova <[email protected]>
Description
PR #1568 is too large and too out of date to use for refactoring the onedal
table
object. Subsequent PRs which introduced sycl_usm_array support mixed in additional C++ code in an unsustainable/ poorly extensible manner. This PR tries to find an intermediate solution which does not rewriteonedal/datatypes
but only shifts the code in a way which is clearer and better separated following #1568 in spirit. This way adding dlpack support totable
will be separated cleanly fromnumpy
andsycl_usm_array
. It defines additional namespaces so that it is clear in the code which conversion mechanism is being used where. It begins standardization of the naming schemes of functions and files for simple extensibility in the future (say supporting other array or possibly dataframe types).Therefore, because it is only namespace definitions and file movements, performance benchmarks aren't necessary.
NOTE: The
SET_CTYPE_FROM_DAL_TYPE
macro is moved out of the sycl_usm folder because of its generality and re-use within dlpack.NOTE: A function
convert_from_sua_iface
is renamedconvert_to_table
in thesycl_usm
namespace.NOTE: changes to pickling for incremental algorithms must also be done. It is clear with the changes what types of inputs/outputs are expected for
__getstate__
and__setstate__
, which will default to numpy (not explicitly discussed in those PRs, but may be important in future array_api discussions).NOTE: there are definitely inconsistencies between the sycl_usm and numpy implementations, and changes to those implementations in any functional manner should be done in a follow-up PR/ticket. They are likely to be time-intensive and require benchmarking.
PR should start as a draft, then move to ready for review state after CI is passed and all applicable checkboxes are closed.
This approach ensures that reviewers don't spend extra time asking for regular requirements.
You can remove a checkbox as not applicable only if it doesn't relate to this PR in any way.
For example, PR with docs update doesn't require checkboxes for performance while PR with any change in actual code should have checkboxes and justify how this code change is expected to affect performance (or justification should be self-evident).
Checklist to comply with before moving PR from draft:
PR completeness and readability
Testing
Performance