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

ENH: Data management update to support SUA ifaces for Homogen OneDAL tables #2045

Merged

Conversation

samir-nasibli
Copy link
Contributor

@samir-nasibli samir-nasibli commented Sep 11, 2024

Description

Data management update. Update to_table and from_table primitives to support SUA ifaces with zero-copy.

image

Detailed

Major updates

  • Support of __sycl_usm_array_interface__ implemented without dpctl as a build dependency.
  • DPC backend homogen tables enhanced to support __sycl_usm_array_interface__ protocol.
    • several primitives added to support __sycl_usm_array_interface__ protocol for the onedal tables.
      • now to_table uses input's __sycl_usm_array_interface__ attr to create a onedal table on the device
      • from_table add to the table __sycl_usm_array_interface__ attr to follow sycl usm zero-copy conversion to the required dpnp.ndarray or dpctl.tensor.usm_ndarray datatype.
        • Since OneDAL returns tables without sycl context for CPU sycl queue inputs and this breaks the compute-follows-data execution. Workaround were added for creating numpy.drarray from onedal tables-> usm_ndarray/dpnp.ndarrays with using input sycl queue. Currently not throwing runtime exception and __sycl_usm_array_interface__["syclobj"]==None. Requires of fixing the flow on backend OneDAL lib first. Ticket is created.
  • refactored datatypes module: moved helpers and common srcs into datatypes.utils
  • Covered by tests:
    • tests are documented in the code base and commented in where it is required.
      • onedal/datatypes/tests/test_data.py::test_input_sua_iface_zero_copy
      • onedal/datatypes/tests/test_data.py::test_table_conversions
      • sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks to check mem leaks with table conversions
      • several primitives to check/compare __sycl_usm_array_interface__ or SUA tensors

Minor

  • refactored onedal/utils/_array_api.py file.
  • updated take primitive in sklearnex/tests/test_memory_usage.py.

Benchmark numbers are shared.

Test statistics

New test cases 164++ .
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float32-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float32-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float32-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float32-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float32-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float32-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float32-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float32-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float64-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float64-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float64-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float64-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float64-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float64-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float64-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[float64-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int32-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int32-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int32-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int32-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int32-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int32-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int32-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int32-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int64-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int64-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int64-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int64-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int64-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int64-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int64-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_input_sua_iface_zero_copy[int64-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1000, 100)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1000, 100)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1000, 100)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1000, 100)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1000, 100)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1000, 100)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1000, 100)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1000, 100)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(2000, 50)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(2000, 50)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(2000, 50)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(2000, 50)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(2000, 50)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(2000, 50)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(2000, 50)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(2000, 50)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50, 1)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50, 1)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50, 1)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50, 1)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50, 1)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50, 1)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50, 1)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50, 1)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1, 50)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1, 50)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1, 50)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1, 50)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1, 50)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1, 50)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1, 50)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(1, 50)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50,)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50,)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50,)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50,)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50,)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50,)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50,)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float32-(50,)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1000, 100)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1000, 100)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1000, 100)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1000, 100)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1000, 100)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1000, 100)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1000, 100)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1000, 100)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(2000, 50)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(2000, 50)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(2000, 50)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(2000, 50)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(2000, 50)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(2000, 50)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(2000, 50)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(2000, 50)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50, 1)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50, 1)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50, 1)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50, 1)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50, 1)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50, 1)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50, 1)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50, 1)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1, 50)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1, 50)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1, 50)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1, 50)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1, 50)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1, 50)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1, 50)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(1, 50)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50,)-F-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50,)-F-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50,)-F-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50,)-F-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50,)-C-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50,)-C-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50,)-C-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_table_conversions[float64-(50,)-C-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_invalid_shape[(2, 3, 4)-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_invalid_shape[(2, 3, 4)-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_invalid_shape[(2, 3, 4)-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_invalid_shape[(2, 3, 4)-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_invalid_shape[(2, 3, 4, 5)-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_invalid_shape[(2, 3, 4, 5)-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_invalid_shape[(2, 3, 4, 5)-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_invalid_shape[(2, 3, 4, 5)-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint16-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint16-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint16-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint16-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint32-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint32-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint32-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint32-dpnp-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint64-dpctl-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint64-dpctl-SyclQueue_GPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint64-dpnp-SyclQueue_CPU] PASSED
onedal/tests/test_data.py::test_sua_iface_interop_unsupported_dtypes[uint64-dpnp-SyclQueue_GPU] PASSED
...
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(1000, 100)-F-dpctl-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(1000, 100)-F-dpctl-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(1000, 100)-F-dpnp-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(1000, 100)-F-dpnp-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(1000, 100)-C-dpctl-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(1000, 100)-C-dpctl-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(1000, 100)-C-dpnp-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(1000, 100)-C-dpnp-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(2000, 50)-F-dpctl-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(2000, 50)-F-dpctl-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(2000, 50)-F-dpnp-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(2000, 50)-F-dpnp-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(2000, 50)-C-dpctl-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(2000, 50)-C-dpctl-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(2000, 50)-C-dpnp-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float32-(2000, 50)-C-dpnp-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(1000, 100)-F-dpctl-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(1000, 100)-F-dpctl-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(1000, 100)-F-dpnp-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(1000, 100)-F-dpnp-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(1000, 100)-C-dpctl-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(1000, 100)-C-dpctl-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(1000, 100)-C-dpnp-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(1000, 100)-C-dpnp-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(2000, 50)-F-dpctl-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(2000, 50)-F-dpctl-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(2000, 50)-F-dpnp-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(2000, 50)-F-dpnp-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(2000, 50)-C-dpctl-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(2000, 50)-C-dpctl-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(2000, 50)-C-dpnp-SyclQueue_CPU] PASSED
sklearnex/tests/test_memory_usage.py::test_table_conversions_memory_leaks[float64-(2000, 50)-C-dpnp-SyclQueue_GPU] SKIPPED (SYCL device memory leak check requires the level zero sysman)

Documentation:


Checklist to comply with before moving PR from draft:

PR completeness and readability

  • I have reviewed my changes thoroughly before submitting this pull request.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes or created a separate PR with update and provided its number in the description, if necessary.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have added a respective label(s) to PR if I have a permission for that.
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • The unit tests pass successfully.
  • I have run it locally and tested the changes extensively.

Performance

  • I have measured performance for affected algorithms using scikit-learn_bench and provided at least summary table with measured data, if performance change is expected.
  • I have provided justification why performance has changed or why changes are not expected.

@samir-nasibli samir-nasibli added the enhancement New feature or request label Sep 12, 2024
@samir-nasibli
Copy link
Contributor Author

/intelci: run

@samir-nasibli
Copy link
Contributor Author

/intelci: run

@samir-nasibli samir-nasibli changed the title ENH: Data management update to support SUA ifaces ENH: Data management update to support SUA ifaces for Homogen OneDAL tables Oct 2, 2024
@samir-nasibli
Copy link
Contributor Author

/intelci: run

@samir-nasibli
Copy link
Contributor Author

Copy link
Contributor

@icfaust icfaust left a comment

Choose a reason for hiding this comment

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

Will continue my review at 8:15.

# of the compute-follows-data execution.
# Host tables first converted into numpy.narrays and then to array from xp
# namespace.
return xp.asarray(
Copy link
Contributor

Choose a reason for hiding this comment

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

This will open the possibility that we will store non-numpy arrays as stored estimator attributes (we can store USM, not array api compliant values). This is going to complicate things when a computation falls back to sklearn in a fit step, the results could be of a completely different type. How will this be handled with fit attributes which fallback, do we iterate on and convert all instance attributes? At minimum please make a ticket into an investigation into this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is shouldn't be a follow up ticket of this PR. I don't think that without any input it is needed to create any ticket.
Potentially this could be raised on DBSCAN via Array API enabling with this PR changes integration, since stock scikit-learn doesn't support non-numpy array inputs.

onedal/datatypes/_data_conversion.py Outdated Show resolved Hide resolved
onedal/datatypes/_data_conversion.py Outdated Show resolved Hide resolved
)
@pytest.mark.parametrize("order", ["F", "C"])
@pytest.mark.parametrize("data_shape", data_shapes)
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
Copy link
Contributor

Choose a reason for hiding this comment

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

You aren't using dtype in the test, even though you've modified the kfold template for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See 8eca500

sklearnex/tests/test_memory_usage.py Show resolved Hide resolved
onedal/datatypes/utils/sua_iface_helpers.cpp Show resolved Hide resolved
onedal/datatypes/utils/sua_iface_helpers.cpp Show resolved Hide resolved
Copy link
Contributor

@icfaust icfaust left a comment

Choose a reason for hiding this comment

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

Some additional comments about heterogeneous inputs and failures, as well as a question about std::decay_t use (as I thought this only was to handle arrays/functions).

and sycl_queue.sycl_device.is_cpu
and table.__sycl_usm_array_interface__["syclobj"] is None
):
# oneDAL returns tables with None sycl queue for CPU sycl queue inputs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for the comment, it helped a lot. I guess is this a problem in oneDAL? I guess if someone was insistent on trying to use the same queue throughout, this would cause them problems as this would generate a new CPU queue. Not a blocker, just something for us to think about.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, there no new queue will be created, the queue will be used to copy host data to the usm allocation

onedal/datatypes/_data_conversion.py Outdated Show resolved Hide resolved
onedal/datatypes/utils/sua_iface_helpers.cpp Show resolved Hide resolved
onedal/datatypes/utils/sua_iface_helpers.cpp Outdated Show resolved Hide resolved
@samir-nasibli
Copy link
Contributor Author

@icfaust why we are talking about on potential support of hetrogenous tables of oneDal here? And how this should be covered by the scope of the PR ENH: Data management update to support SUA ifaces for Homogen OneDAL tables ???
I am not against this discussion, but I think we can do it in proper place and more productive. Currently this discussion shouldn't be blocker for the PR.

I will address some minor refactoring comments, that shouldn't affect perf, but still think this is good to go.

@icfaust
Copy link
Contributor

icfaust commented Oct 25, 2024

@icfaust why we are talking about on potential support of hetrogenous tables of oneDal here? And how this should be covered by the scope of the PR ENH: Data management update to support SUA ifaces for Homogen OneDAL tables ??? I am not against this discussion, but I think we can do it in proper place and more productive. Currently this discussion shouldn't be blocker for the PR.

I will address some minor refactoring comments, that shouldn't affect perf, but still think this is good to go.

Can you guarantee that a non-sliced homogeneous USM nd_array will not be encountered by to_table at this moment? Maybe an offline discussion is warranted.

@samir-nasibli
Copy link
Contributor Author

@icfaust why we are talking about on potential support of hetrogenous tables of oneDal here? And how this should be covered by the scope of the PR ENH: Data management update to support SUA ifaces for Homogen OneDAL tables ??? I am not against this discussion, but I think we can do it in proper place and more productive. Currently this discussion shouldn't be blocker for the PR.
I will address some minor refactoring comments, that shouldn't affect perf, but still think this is good to go.

Can you guarantee that a non-sliced homogeneous USM nd_array will not be encountered by to_table at this moment? Maybe an offline discussion is warranted.

@icfaust It is planned that all these implenmetation will be used after array validation. Currently we have primitives for numpy ndarrays, on scikit-learn side supported such checks for Array API inputs, that will be used for usm_ndarrays (dpctl). On #2096 already checked some stock scikit-learn's array api primitievs, and there also will be added check_array or validate_array for dpctl array api inputs.

These changes for to_table, from_table only have meaning for already pre-validated input data, the same flow as for numpy ndarrays currently.

sklearnex/_device_offload.py Show resolved Hide resolved
sklearnex/tests/test_memory_usage.py Outdated Show resolved Hide resolved
@samir-nasibli samir-nasibli mentioned this pull request Oct 27, 2024
13 tasks
Copy link
Contributor

@icfaust icfaust left a comment

Choose a reason for hiding this comment

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

Looks good to merge.

@samir-nasibli samir-nasibli merged commit 18d199a into uxlfoundation:main Oct 28, 2024
27 checks passed
@samir-nasibli samir-nasibli deleted the enh/sua_data_management branch October 28, 2024 14:52
ethanglaser added a commit to ethanglaser/scikit-learn-intelex that referenced this pull request Oct 29, 2024
ethanglaser added a commit that referenced this pull request Oct 29, 2024
david-cortes-intel pushed a commit to david-cortes-intel/scikit-learn-intelex that referenced this pull request Oct 31, 2024
…tables (uxlfoundation#2045)

* ENH: Data management update to support SUA ifaces

* TEST: added memory leak tests

* TEST: enabled tests for the dpnp/dpctl inputs

* Support of __sycl_usm_array_interface__ implemented without dpctl as a build dependency.

* Covered by tests:

* refactored onedal/utils/_array_api.py file.

* updated take primitive in sklearnex/tests/test_memory_usage.py.

* Documented code
david-cortes-intel pushed a commit to david-cortes-intel/scikit-learn-intelex that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants