-
Notifications
You must be signed in to change notification settings - Fork 87
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
#0: added api for generating corerangeset from given subcoregrid #15841
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
tt_metal/common/work_split.cpp
Outdated
CoreRangeSet num_cores_to_corerangeset_in_subcoregrids( | ||
const CoreCoord start_core, | ||
const uint32_t target_num_cores, | ||
const CoreRangeSet subcoregrids, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the const qualified parameter subcoregrids
is copied for each invocation; consider making it a reference
const CoreRangeSet subcoregrids, | |
const CoreRangeSet& subcoregrids, |
tt_metal/common/work_split.cpp
Outdated
uint32_t subcoregrid_height = subcoregrid.grid_size().y; | ||
|
||
if (row_wise) { | ||
for (uint32_t y = current_start_core.y; y <= subcoregrid.end_coord.y; ++y) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you split this function into two subfunctions? row_wise and col_wise. this for loop is very large.
YOu simple can create two lambdas at least and call on of them in the cycle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmakoviichuk-tt converted them to lambdas now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one comment.
48716a0
to
c4ac298
Compare
tt_metal/common/work_split.cpp
Outdated
CoreRangeSet num_cores_to_corerangeset_in_subcoregrids( | ||
const CoreCoord start_core, | ||
const uint32_t target_num_cores, | ||
const CoreRangeSet subcoregrids, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. Can we name as sub_core_grids to make it similar to naming of other args? Should also be const ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
# SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. Can you rename the file to match the function name. ex num_cores instead of numcores
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
e395f08
to
ea9f9cb
Compare
Problem description
To address the need for generating a CoreRangeSet from non-rectangular subcoregrids (e.g., grids of sizes [3x10, 2x10]), I added a new API
ttnn.numcores_to_corerangeset_in_subcoregrids
that can handle multiple disjoint or irregular core regions, unlike the existingttnn.numcores_to_corerangeset
function, which assumes a single rectangular core grid.Input Parameters
start_core: The starting coordinate (CoreCoord) for selecting cores.
target_num_cores: The desired number of cores to include in the resulting CoreRangeSet.
subcoregrids: A CoreRangeSet representing disjoint or irregular sub-core grids within which cores can be selected.
row_wise: A boolean indicating whether to prioritize selecting cores row by row (True) or column by column (False).
Output
A CoreRangeSet that contains a compact selection of cores starting from start_core and spanning up to target_num_cores cores within the given subcoregrids.
Checklist