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

Global Coordinate Awareness in Tile #82

Open
wavefunction91 opened this issue Aug 2, 2023 · 2 comments
Open

Global Coordinate Awareness in Tile #82

wavefunction91 opened this issue Aug 2, 2023 · 2 comments

Comments

@wavefunction91
Copy link

Describe the problem you are solving

For applications which manually specify the tiling of a matrix, it would be desirable for Tile to carry (or to be able to resolve) information pertaining to its locale relative to a global matrix. This is useful in matrix generation when the starting indices of a tile cannot be simply computed (i.e. non-uniform tiling)

Describe your proposed solution

One potential solution would be to have Tile store it's global row/column starting indices relative to its owning matrix (and defaulting to 0)

@mgates3
Copy link
Collaborator

mgates3 commented Aug 12, 2023

Do you mean the block row & block col? For instance:

  T = A( i, j )
  T.block_row() == i
  T.block_col() == j

That would be fairly trivial to do, but I'm not sure how beneficial it is. Obviously the function that just got the tile A( i, j ) knows what i, j are.

Or do you mean the actual row & col? For instance, for a matrix with fixed tile size mb x nb:

    T = A( i, j );
    T.first_row() == i * A.mb();
    T.first_col() == j * A.nb();

That would be easy for a fixed tile size, and rather hard & expensive for a variable tile size. We would basically have to iterate over the tileMb() and tileNb() functions to compute what the row & col are.

Thinking more on this — we could do use an alternate representation using the first row / col of each tile, then tileMb = row[ i+1 ] - row[ i ], and tileNb = col[ i+1 ] - col[ i ]. That would have some other benefits like making A.m() and A.n() easier to compute. Whereas currently, we would have to compute row = sum_{0..i} mb[ i ].

@wavefunction91
Copy link
Author

Thinking more on this

This is essentially what TiledArray does (by introducing the concept of TiledRange), however, the individual tiles also carry information pertaining to their global location (i.e. a tile can be passed around external to its owner and one can still resolve its global location).

Expanding on this, you could also remove the need for user tileMb/tileNb functors if you internally populate row/col bounds to look up dimensions. tileRank/Dev should probably still exist since to store them requires $O(N^2)$ storage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants