-
Notifications
You must be signed in to change notification settings - Fork 536
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
drt: getNestedIdx explicit output and curr_idx name changes #5862
base: master
Are you sure you want to change the base?
drt: getNestedIdx explicit output and curr_idx name changes #5862
Conversation
Signed-off-by: bernardo <[email protected]>
clang-tidy review says "All clean, LGTM! 👍" |
const int idx_1 = flat_idx / idx_2_dim - 1; | ||
const int idx_2 = flat_idx % idx_2_dim; | ||
return {idx_1, idx_2}; |
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.
Any idea where there is a '-1' here? It seems non-idiomatic.
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.
Yes. This function is the reciprocal to getFlatIdx
:
int FlexPA::getFlatIdx(const int idx_1, const int idx_2, const int idx_2_dim)
{
return ((idx_1 + 1) * idx_2_dim + idx_2);
}
The -1
inverts the +1
applied to idx_1
. The +1
, in turn, is there because the minimal value for idx_1
is -1
, not 0
. So the returned value will be always positive.
-1
is used as an argument for this function at genPatterns_reset
, genPatternsInit
and genInstRowPatternInit
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.
I actually don't like how the code keeps flattening and nesting these indexes, it happens a lot and some times one right after the other. If I find a way to eliminate it and keep a single representation for these indexes I will implement it.
Just understood what |
Signed-off-by: bernardo <[email protected]>
clang-tidy review says "All clean, LGTM! 👍" |
Signed-off-by: bernardo <[email protected]>
clang-tidy review says "All clean, LGTM! 👍" |
Signed-off-by: bernardo <[email protected]>
clang-tidy review says "All clean, LGTM! 👍" |
Similar to #5778.
Changes
getNestedIdx()
so its outputs are actual outputs instead of inputs passed by reference to be changed.Also changes instances of
curr_idx_1
,curr_idx_2
to eithercurr_pin_idx
,curr_acc_point_idx
orcurr_inst_idx
,curr_acc_pattern_idx
depending on the appropriate use.
Similar changes were applied to variables with the same format that have
prev
orprev_prev
instead ofcurr
.