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

const prop for log and logp1 #218

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

const prop for log and logp1 #218

wants to merge 2 commits into from

Conversation

vimarsh6739
Copy link
Member

@vimarsh6739 vimarsh6739 commented Jan 4, 2025

resolves #212

auto resultType = op.getType().cast<ShapedType>();

// Convert constant to tensor, compute log, then convert back to attribute
stablehlo::Tensor inputTen = mlir::stablehlo::constantOp(inputAttr);
Copy link
Member

Choose a reason for hiding this comment

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

Look at some of the other examples, can you add a fast path if the attribute is a splat (so we don’t need to compute the same value for a huge constant of the same inputs)

Copy link
Member Author

Choose a reason for hiding this comment

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

Kind of like here?

if (operandConstant.isSplat() && updateConstant.isSplat() &&

Copy link
Member

Choose a reason for hiding this comment

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

more like this:

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I see so replacement will still be the same, we are just playing around with the tensor type

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.

Missing constprop through stablehlo.log
2 participants