Skip to content

Adds and implements utilities for validating array size and writable flag #1547

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

Merged
merged 3 commits into from
Feb 14, 2024

Conversation

ndgrigorian
Copy link
Collaborator

This pull request refactors Python API functions to use new utilities for validating output arrays. These utilities validate that an array is sufficiently ample for a given number of elements (i.e., not the result of broadcasting) and that the array's writable flag is set.

  • 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?
  • If this PR is a work in progress, are you opening the PR as a draft?

These checks are implemented through a new CheckWritable struct, which has a static method throw_if_not_writable, which throws if an array is read-only
@ndgrigorian ndgrigorian changed the title Adds and implements utilities for validating size and writable flag before writing Adds and implements utilities for validating array size and writable flag Feb 13, 2024
Copy link

github-actions bot commented Feb 13, 2024

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

The check for sufficiently ample memory was performed with the incorrect operand
Copy link

Array API standard conformance tests for dpctl=0.16.0dev0=py310h15de555_7 ran successfully.
Passed: 817
Failed: 92
Skipped: 86

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 91.138%. remained the same
when pulling 05d1a63 on output-validation-refactor
into 275138b on master.

Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

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

Great change. Thank you, @ndgrigorian !

Copy link

Array API standard conformance tests for dpctl=0.16.0dev0=py310h15de555_8 ran successfully.
Passed: 908
Failed: 1
Skipped: 86

@ndgrigorian ndgrigorian merged commit ed93ec1 into master Feb 14, 2024
@ndgrigorian ndgrigorian deleted the output-validation-refactor branch February 14, 2024 02:41
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