Skip to content

task: add broadcast class implementation#2901

Draft
jharlow-intel wants to merge 1 commit intomasterfrom
task/SAT-7028
Draft

task: add broadcast class implementation#2901
jharlow-intel wants to merge 1 commit intomasterfrom
task/SAT-7028

Conversation

@jharlow-intel
Copy link
Copy Markdown
Collaborator

@jharlow-intel jharlow-intel commented May 6, 2026

Adds a broadcast class implementation

  • 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?

@jharlow-intel jharlow-intel self-assigned this May 6, 2026
@jharlow-intel jharlow-intel added the enhancement New feature or request label May 6, 2026
@jharlow-intel jharlow-intel changed the title task: add boradcast class implementation task: add broadcast class implementation May 6, 2026
@jharlow-intel jharlow-intel marked this pull request as draft May 6, 2026 19:53
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

View rendered docs @ https://intelpython.github.io/dpnp/pull/2901/index.html

Comment thread dpnp/dpnp_broadcast.py
arrays.append(arg)

if len(arrays) == 0:
raise TypeError("broadcast() requires at least one array")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the reason to raise the error here? I see that numpy accept that.

Comment thread dpnp/dpnp_broadcast.py
arrays = []
for arg in args:
if not isinstance(arg, dpnp.ndarray):
# Convert array-like to dpnp.ndarray
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Conversion might be a costly operation, why do we need that?
Also, we have to allocate new arrays only on the same SYCL queue and with coerced USM type to comply with Compute follows data.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We will probably need a conversion logic only when iterator is implemented

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Btw, we need to check that input dpnp arrays are on the same queue, something like:

exec_q = dpt.get_execution_queue(...)
if exec_q is None:
    raise ExecutionPlacementError()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And also we need to check that every arg in args has .shape attribute

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Array API standard conformance tests for dpnp=0.21.0dev0=py313h509198e_12 ran successfully.
Passed: 1356
Failed: 4
Skipped: 16

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.

2 participants