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

Read-Only Tile View #59

Open
wavefunction91 opened this issue Jun 6, 2023 · 1 comment
Open

Read-Only Tile View #59

wavefunction91 opened this issue Jun 6, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@wavefunction91
Copy link

Describe the problem you are solving

Currently, the Tile accessor in BaseMatrix is not const-accessible.

Tile<scalar_t> operator()( int64_t i, int64_t j, int device=HostNum );

It would be highly desirable to expose a read-only, const compatible overload of this function for appropriate const-correct contexts.

Describe your proposed solution

I am unfamiliar with the shallow Tile interface, but one would generally want to return a Tile which wraps immutable data, e.g.

const Tile<scalar_t> MatrixBase::operator()(int64_t,  int64_t, int64_t) const;
// or
const Tile<const scalar_t> MatrixBase::operator()(int64_t,  int64_t, int64_t) const;

The latter precludes mutation downstream

@mgates3
Copy link
Collaborator

mgates3 commented Jun 7, 2023

I understand the desire for this.

Because of dealing with remote memory and CPU and GPU memory spaces, we almost never have const Matrix objects. E.g.,

gemm( scalar_t alpha, Matrix& A, Matrix& B, scalar_t beta, Matrix& C )

with no const on A or B, even though they are logically const. This is because we need to move or copy tiles from CPU to GPU memory, and also to insert temporary remote tiles from other MPI processes. So while the numerical data of A and B isn't changing, their Matrix objects change quite a lot during gemm.

@mgates3 mgates3 added the enhancement New feature or request label Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants