8000 MAINT: Split einsum into multiple files by eric-wieser · Pull Request #17109 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Split einsum into multiple files #17109

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 1 commit into from
Aug 21, 2020
Merged

Conversation

eric-wieser
Copy link
Member
@eric-wieser eric-wieser commented Aug 19, 2020

Putting the sumprod stuff in a separate file makes a handful of open PRs easier to review.

The only changes to the large diffs here are:

  • Some defines and typedefs moved to headers
  • NPY_NO_EXPORT was added to the one function used from sumprod

This is split from #17107 and #17049, which mixed this copy-paste with other review-worthy code changes.

@eric-wieser
Copy link
Member Author

@seiko2plus: I named the file einsum_sumprod because that's what it contains, instead of einsum.dispatch. If there's something special about the suffix dispatch, then feel free to rename it in a follow-up PR that uses the new dispatch mechanism. The point of this PR is to make that follow-up PR possible to review.

@seiko2plus
Copy link
Member
seiko2plus commented Aug 19, 2020

@eric-wieser, *.dispatch.c is used by the new CPU dispatcher to mark the dispatch-able sources, please check this doc section.

@eric-wieser
Copy link
Member Author

Thanks! That confirms to me that the file shouldn't be renamed until your follow-up PR which enables dispatching.

Copy link
Member
@seiko2plus seiko2plus left a comment

Choose a reason for hiding this comment

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

there's no need for two pull-requests, the following changes should add support for runtime CPU dispatching. few extra changes will need to be done by #17049 during the rebase.

@@ -0,0 +1,1897 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

rename it to einsum.dispatch.c.src

*
* See LICENSE.txt for the license.
*/

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/* @targets baseline sse2 */

Copy link
Member

Choose a reason for hiding this comment

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

should be updated by #17049

/* None of the above specializations caught it, general loops */
return _unspecialized_table[type_num][nop <= 3 ? nop : 0];
}
#include "einsum_sumprod.h"
Copy link
Member
@seiko2plus seiko2plus Aug 20, 2020

Choose a reason for hiding this comment

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

just combine the two headers into a one
EDIT: it's okay to keep them as-is I just don't see a reason for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

One header describes what is in the sumprod.c file, the other is unrelated debug macros that we should probably just remove in future.

@eric-wieser
Copy link
Member Author

there's no need for two pull-requests

In my mind there is - the point is to review code changes seperately to code moves. Doling both at the same time results in unreviewable PRs.

@eric-wieser eric-wieser requested a review from seberg August 20, 2020 06:45
@seiko2plus
8000 Copy link
Member

@eric-wieser, I mean having this pr and #17107.

Putting the sumprod stuff in a separate file makes a handful of open PRs easier to review.

The only changes to the large diffs here are:

* Some defines and typedefs moved to headers
* `NPY_VISIBILITY_HIDDEN` was added to the one function used from `sumprod`
@seberg
Copy link
Member
seberg commented Aug 21, 2020

Splitting up is definitely nicer, I admit I often struggle with breaking up changes that are interconnected into steps, but here it is indeed a clear first step.
Lets do that debug header, its probably good anyway and if we have a better idea it is a trivial change.

Thanks Eric!

@seberg seberg merged commit 4cba2d9 into numpy:master Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0