-
Notifications
You must be signed in to change notification settings - Fork 10
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
base: main
Are you sure you want to change the base?
Conversation
auto resultType = op.getType().cast<ShapedType>(); | ||
|
||
// Convert constant to tensor, compute log, then convert back to attribute | ||
stablehlo::Tensor inputTen = mlir::stablehlo::constantOp(inputAttr); |
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.
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)
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.
Kind of like here?
if (operandConstant.isSplat() && updateConstant.isSplat() && |
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.
more like this:
if (inp.isSplat()) { |
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.
otherwise we end up iterating through all inputs: https://github.com/openxla/stablehlo/blob/c06b1a10d66069505ccbab72b21f6fa0547c617d/stablehlo/reference/Ops.cpp#L1911
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.
Ah I see so replacement will still be the same, we are just playing around with the tensor type
resolves #212