Skip to content

Add dpctl.SyclQueue.fill() method - #2365

Open
vlad-perevezentsev wants to merge 17 commits into
masterfrom
add_sycl_queue_fill
Open

Add dpctl.SyclQueue.fill() method#2365
vlad-perevezentsev wants to merge 17 commits into
masterfrom
add_sycl_queue_fill

Conversation

@vlad-perevezentsev

@vlad-perevezentsev vlad-perevezentsev commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

This PR proposes adding dpctl.SyclQueue.fill and dpctl.SyclQueue.fill_async methods as a Python wrapper over sycl::queue::fill backed by the existing DPCTLQueue_Fill8/16/32/64/128 and new DPCTLQueue_Fill8/16/32/64/128WithEvents C-API functions and adding a new test_sycl_queue_fill.py

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

@vlad-perevezentsev vlad-perevezentsev self-assigned this Aug 18, 2026
@github-actions

Copy link
Copy Markdown

@coveralls

coveralls commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 74.778% (+0.3%) from 74.51% — add_sycl_queue_fill into master

@vlad-perevezentsev
vlad-perevezentsev marked this pull request as ready for review August 18, 2026 15:20
Comment thread dpctl/_sycl_queue.pyx
SyclQueue q,
object dst,
object value,
size_t count,

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.

We need a check for OOB count, I think simply raising would be fine

Comment thread dpctl/_sycl_queue.pyx
cval = complex(value)
return struct.pack("=" + fmt, cval.real, cval.imag)
return struct.pack("=" + fmt, value)
except (struct.error, TypeError, ValueError) as e:

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.

struct.pack("=f", 1e40) raises an OverflowError, not covered here

Comment on lines +1229 to +1230
Val.real = Value[0];
Val.imag = Value[1];

@ndgrigorian ndgrigorian Aug 28, 2026

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.

we need a check here and in the original DPCTLQueue_Fill128 for nullptr Value here, as the try block won't prevent the segfault from a nullptr deref

delete[] host_arr;
}

TEST_P(TestDPCTLQueueMemberFunctions, CheckFill8WithEvents)

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.

need test where Value is nullptr for Fill128 variants

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