Skip to content

Conversation

mingzheTerapines
Copy link

Co-authored by: [email protected]

Improve usage of static shape information to avoid unnecessary broadcast.

Co-authored by: [email protected]

Improve usage of static shape information to avoid unnecessary broadcast.
Copy link
Collaborator

@zjgarvey zjgarvey left a comment

Choose a reason for hiding this comment

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

Thanks for submitting the PR!

Let me know if you have trouble finding an existing utility function, since it would be better to re-use existing util functions rather than filling the current file with one-off functions.

I'd also prefer if we added a lit test to cover this change.

Comment on lines 79 to 87
static int64_t getDimFromValue(Value dimValue) {
if (auto constOp = dimValue.getDefiningOp<arith::ConstantOp>()) {
if (auto intAttr = dyn_cast<IntegerAttr>(constOp.getValue())) {
return intAttr.getInt();
}
}
return ShapedType::kDynamic;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like this exact function likely already exists in some Utils.cpp file.

There may even be a computeBroadcastShape util function at this point, so I'd take a look and see if we can re-use some of that.

Copy link
Author

Choose a reason for hiding this comment

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

Cool! I will have a look.

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

Successfully merging this pull request may close these issues.

2 participants