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

[luci/pass] Introduce ArrayIndex helper #14565

Merged
merged 8 commits into from
Jan 21, 2025
Merged

Conversation

dayo09
Copy link
Contributor

@dayo09 dayo09 commented Jan 20, 2025

Let's introduce Array4DIndex to help calculating 4D array index.

ONE-DCO-Signed-off-by: Dayoung Lee [email protected]


For #14552
Dr #14564

To extend the funtionality of extend broadcast const pass, I introduce this helper.

Let's introduce Array4DIndex to help calculating 4D array index.

ONE-DCO-Signed-off-by: Dayoung Lee <[email protected]>
@dayo09 dayo09 requested a review from seanshpark January 20, 2025 08:04
@dayo09 dayo09 added the PR/NO MERGE Please don't merge. I'm still working on this :) label Jan 20, 2025
@dayo09

This comment was marked as outdated.

@dayo09 dayo09 added PR/ready for review It is ready to review. Please review it. and removed PR/NO MERGE Please don't merge. I'm still working on this :) labels Jan 20, 2025
return i0 * _strides[0] + i1 * _strides[1] + i2 * _strides[2] + i3 * _strides[3];
}

uint32_t Array4DIndex::size(void) const { return _dim[0] * _dim[1] * _dim[2] * _dim[3]; }
Copy link
Contributor

@seanshpark seanshpark Jan 20, 2025

Choose a reason for hiding this comment

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

this assumes all elements should be positive numbers.
you have assert(_strides[i] > 0); in ctor but this is only for debug version.
how about using throw as zero or negative seems to be invalid numbers.

Copy link
Contributor

Choose a reason for hiding this comment

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

if we can change to throw, we can add one more negative test something like invalid_array_4d_NEG

Copy link
Contributor

Choose a reason for hiding this comment

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

_dim is unsigned, so exception seems to be redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jinevening It's right. I'll just add exception to check whether they are zero or not.

dayo09 and others added 2 commits January 21, 2025 15:57
Co-authored-by: Hyukjin Jeong <[email protected]>
Co-authored-by: SaeHie Park <[email protected]>
Copy link
Contributor

@jinevening jinevening left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@seanshpark seanshpark left a comment

Choose a reason for hiding this comment

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

LGTM thank you!

@seanshpark seanshpark merged commit c305c84 into Samsung:master Jan 21, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR/ready for review It is ready to review. Please review it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants