Skip to content

Conversation

KateBlueSky
Copy link

@KateBlueSky KateBlueSky commented Jul 31, 2025

Raise AttributeError for non-homogen tables in sycl_usm_array_interface to comply with Python interop expectations

This PR updates the behavior of the sycl_usm_array_interface property for oneDAL table objects to improve compatibility with Python SYCL-aware libraries (e.g. dpctl, dpnp, numba-dpex).

Previously, the property handler used report_problem_to_sua_iface(": only homogen tables are supported");
to signal unsupported table types (e.g., sparse or non-homogen tables). However, this results in a non attribute related error being raised, which breaks compatibility with Python’s hasattr() behavior, and can surface as runtime errors in downstream libraries that probe for SYCL USM compatibility.

The fix aligns with Python data protocol conventions (e.g., array_interface, cuda_array_interface), which require AttributeError to signal absence.

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

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
  • I have extended testing suite if new functionality was introduced in this PR.

@KateBlueSky KateBlueSky changed the title [Fix] [Array API] Fixed for adding _sycl_usm_array_interface [Fix] [Array API] Raise AttributeError for non-homogen tables in __sycl_usm_array_interface__ to comply with Python interop expectations Jul 31, 2025
@icfaust
Copy link
Contributor

icfaust commented Jul 31, 2025

@KateBlueSky Good catch! Does this mean that csr_tables would fail hasattr calls previously?

@KateBlueSky
Copy link
Author

KateBlueSky commented Jul 31, 2025

@KateBlueSky Good catch! Does this mean that csr_tables would fail hasattr calls previously?

yes, it would throw a runtime error in the original code.

@icfaust
Copy link
Contributor

icfaust commented Jul 31, 2025

/intelci: run

Copy link

codecov bot commented Jul 31, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
onedal/datatypes/sycl_usm/data_conversion.cpp 0.00% 1 Missing ⚠️
Flag Coverage Δ
azure 80.81% <ø> (?)
github 73.24% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
onedal/datatypes/sycl_usm/data_conversion.cpp 33.33% <0.00%> (ø)

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KateBlueSky KateBlueSky marked this pull request as ready for review July 31, 2025 19:49
@KateBlueSky
Copy link
Author

/intelci: run

1 similar comment
@KateBlueSky
Copy link
Author

/intelci: run

@KateBlueSky KateBlueSky merged commit 3a91f2a into uxlfoundation:main Aug 4, 2025
30 checks passed
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