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

Add Matrix::subPipeline{,Const} #898

Merged
merged 4 commits into from
Jul 7, 2023

Conversation

msimberg
Copy link
Collaborator

@msimberg msimberg commented Jun 6, 2023

Fixes part of #868.

This adds the naive, non-optimized, version of getting a Matrix from another Matrix with tiles in a sub-pipeline, i.e. tile accesses from the sub-pipelined Matrix are sequenced after all previous tile accesses to the original Matrix and before all later tile accesses to the original Matrix.

The missing optimization is merging of read-only accesses between the parent Matrix and the sub-pipelined Matrix. Creating a sub-pipelined Matrix currently implies one "hidden" read-write access to the parent Matrix. Releasing the sub-pipelined Matrix releases all subsequent accesses from the parent Matrix.

In the end this naive version required very few changes to Matrix, and did not require a separate type. I think this is a good thing. One of the open questions from this is if Matrix should have a done method? As far as I can tell RetiledMatrix should be possible to refactor into Matrix in exactly the same way and that would also introduce done into Matrix.

This can already now be used in conjunction with Views to access a sub-matrix with sub-pipelines. To have sub-matrices with sub-pipelines we first need to update Distribution.

Are the names subPipeline and subPipelineConst understandable? I'd like to avoid subMatrixPipeline since this doesn't yet handle sub-matrices. "nest" is a word that I'm thinking could fit well to the "sub-pipeline" aspect of the access but not sure yet. nest/nestRead/nestConst/nested*. In order to allow optimizing access to only a sub-matrix in the future I'd imagine the function signature would be expanded in the future to look like: subPipeline/nested/whatever(SubTileMatrixSpec/SubElementMatrixSpec const& = full_matrix) and then it'd be nice if the name would cleanly cover the future use cases as well but this future version could of course simply get a new name. Suggestions welcome.

@msimberg msimberg added this to the API refactoring milestone Jun 6, 2023
@msimberg msimberg requested review from rasolca and albestro June 6, 2023 14:36
@msimberg msimberg self-assigned this Jun 6, 2023
@msimberg
Copy link
Collaborator Author

msimberg commented Jun 6, 2023

cscs-ci run

@msimberg
Copy link
Collaborator Author

msimberg commented Jun 6, 2023

cscs-ci run

@msimberg msimberg marked this pull request as ready for review June 8, 2023 11:51
@msimberg msimberg changed the title Add Matrix::subPipeline(Const) Add Matrix::subPipeline{,Const} Jun 9, 2023
include/dlaf/matrix/matrix_const.tpp Show resolved Hide resolved
test/unit/matrix/test_matrix.cpp Show resolved Hide resolved
Copy link
Collaborator

@albestro albestro left a comment

Choose a reason for hiding this comment

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

Nice job!

About naming, it is a bit difficult to give better suggestions. An issue is that we are acting on a Matrix, which is a set of Tiles each one with its own pipeline. And with mat.subPipeline() we are actually getting a sub-pipeline for each tile in the matrix (or for a subset of them in the future). Plural? But it is not given that a matrix have multiple tiles.

Probably I would start thinking in terms of scopes (along the lines of what you suggested with "nested") mat.createNestedScope/mat.createNestedConstScope?

test/unit/matrix/test_matrix.cpp Outdated Show resolved Hide resolved
test/unit/matrix/test_matrix.cpp Outdated Show resolved Hide resolved
@msimberg
Copy link
Collaborator Author

msimberg commented Jul 4, 2023

cscs-ci run

@msimberg
Copy link
Collaborator Author

msimberg commented Jul 4, 2023

cscs-ci run

@rasolca rasolca merged commit 4fd48c2 into eth-cscs:master Jul 7, 2023
github-actions bot pushed a commit that referenced this pull request Jul 7, 2023
@msimberg msimberg deleted the matrix-sub-pipeline branch July 10, 2023 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants