Skip to content

Return tuple instead of list from device and platform collection APIs#2322

Open
vlad-perevezentsev wants to merge 6 commits into
masterfrom
use_return_tuple
Open

Return tuple instead of list from device and platform collection APIs#2322
vlad-perevezentsev wants to merge 6 commits into
masterfrom
use_return_tuple

Conversation

@vlad-perevezentsev

Copy link
Copy Markdown
Collaborator

Initially the goal was to change dpctl.get_devices() to return a tuple instead of a list to align with the Python Array API specification where info.devices is defined as a tuple

While implementing this change it became clear that the same behavior should be applied consistently across other APIs that return collections of devices or platforms.
This PR also updates get_platforms, get_composite_devices, SyclContext.get_devices, SyclPlatform.get_devices, SyclPlatform.get_composite_devices, SyclDevice.create_sub_devices, SyclDevice.component_devices, and SyclDevice.sub_group_sizes to return tuples instead of lists

  • 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?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 75.39%. remained the same — use_return_tuple into master

Comment thread dpctl/_sycl_platform.pyx
Comment on lines +604 to +605
Tuple[:class:`.SyclPlatform`]:
A tuple of SYCL platforms on the system.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

while we're at it, can we adjust the other docstrings to use the Tuple[:class:] return format? It's a bit more readable

@ndgrigorian ndgrigorian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

other than that small adjustment lgtm

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