Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: Add ufunc flag to request contiguous buffers for SIMD loops#30449

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Aniketsy wants to merge2 commits intonumpy:main
base:main
Choose a base branch
Loading
fromAniketsy:fix-30413

Conversation

@Aniketsy
Copy link
Contributor

fix#30413

  • AddNPY_UFUNC_REQUIRE_CONTIGUOUS flag and a flags field to PyUFuncObject.
  • Update code generation to set this flag for SIMD optimizedufuncs (sin, cos).
  • Change the iterator setup so it gives contiguous buffers to these ufuncs.
  • Simplify the SIMD loops for sin andcos to always expect contiguous data.
  • Add tests

Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.
Thank you !

@AniketsyAniketsy marked this pull request as draftDecember 16, 2025 17:18
@seberg
Copy link
Member

Thanks for looking into this. But this is not the right abstraction layer to start with. We should handle this in theArrayMethod instead. And yes, thatwill make it awkward to use it for existing sin/cos implementations, because setting the flag there may not be straight-forward (something like this here may still be needed/useful).

But, I think we need to start at theArrayMethod integration. Also, as you can see just using the flag in the one iterator path is not sufficient, ufuncs have multiple paths and all of them need to ensure this.
(Including things likenp.add.reduce, etc.)
This shouldn't be extremely complicated, but there is quite a bit more ground to cover.

Aniketsy reacted with thumbs up emoji

@Aniketsy
Copy link
ContributorAuthor

Thanks for the detailed explanation, I’ll go with your suggestion and look into handling this at theArrayMethod integration. I’ll reach out here if I get stuck or need clarification.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

ENH: Allow ufuncs to request the iterator to provide contiguous arrays

2 participants

@Aniketsy@seberg

[8]ページ先頭

©2009-2025 Movatter.jp