Skip to content
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

Enable Gemm (distributed) to be used with MatrixRef #1022

Merged
merged 16 commits into from
Dec 1, 2023

Conversation

albestro
Copy link
Collaborator

@albestro albestro commented Oct 27, 2023

Implementation has been copied from the GeneralSub case, but it has been refined and cleaned up (thanks to MatrixRef functionalities). More importantly, the GeneralSub implementation was constrained to just work with square sub-matrices, while now this constraint has been removed.

TODO

@albestro albestro added the Type:New Feature New feature or request label Oct 27, 2023
@albestro albestro added this to the Optimizations milestone Oct 27, 2023
@albestro albestro requested a review from rasolca October 27, 2023 15:12
@albestro albestro self-assigned this Oct 27, 2023
@albestro
Copy link
Collaborator Author

Currently, "empty" test-cases are not working: this is probably due to alignSubRankIndex that does not consider this edge case.

Base automatically changed from alby/gemm-sub to master November 24, 2023 16:27
@albestro albestro marked this pull request as ready for review November 27, 2023 17:04
Comment on lines 90 to 92
DLAF_ASSERT(matrix::equal_process_grid(mat_a, grid), mat_a, grid);
DLAF_ASSERT(matrix::equal_process_grid(mat_b, grid), mat_a, grid);
DLAF_ASSERT(matrix::equal_process_grid(mat_c, grid), mat_a, grid);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these not simply:

Suggested change
DLAF_ASSERT(matrix::equal_process_grid(mat_a, grid), mat_a, grid);
DLAF_ASSERT(matrix::equal_process_grid(mat_b, grid), mat_a, grid);
DLAF_ASSERT(matrix::equal_process_grid(mat_c, grid), mat_a, grid);
DLAF_ASSERT(matrix::same_process_grid(mat_a, mat_b), mat_a, mat_b);
DLAF_ASSERT(matrix::same_process_grid(mat_b, mat_c), mat_b, mat_c);

? I guess the grid kind of additionally acts as a tag here to say that this is a distributed matrix multiplication? But then the pipelines already kind of do that as well...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point! Just updated in 4f9514d

Moreover, if I'm not mistaken, the requirement could be even slightly more relaxed (at least for the current implementation of the case we support).

@rasolca what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

About the slightly more relaxed requirement, I was wrong.

About the check, as soon as we will get #993 we can add the check about the "matching" between matrices grid and pipelines.

For what concerns this PR, I think this change is enough 😉

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should I update something in #993 now that this is merged or would you do the change you're talking about separately?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is it the only place where it applies? we can check/discuss at/after the meeting today how to proceed 😉

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably not... however, for this particular case, see 4726236.

/// @param mat_c On entry it contains the input matrix C. On exit matrix tiles in the range will be
/// overwritten with the result, while others are left untouched.
///
/// @pre @p mat_a, @p mat_b and @p mat_c are distributed the same way,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you mean?
What I read -> same distribution
what should be -> same grid

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see 92bd701

include/dlaf/multiplication/general.h Show resolved Hide resolved
@albestro
Copy link
Collaborator Author

cscs-ci run

@rasolca rasolca merged commit e311f6a into master Dec 1, 2023
4 checks passed
@rasolca rasolca deleted the alby/matrix-ref-gemm-dist branch December 1, 2023 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:High Type:New Feature New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants