Use location instead of unknown loc
Follow up on TODO as placeholder has been added to rewriter. PiperOrigin-RevId: 331488583
This commit is contained in:
parent
fb321bee7d
commit
8cc6cddf9f
|
@ -48,7 +48,8 @@ class HloClientDialect : public Dialect {
|
||||||
#include "mlir-hlo/Dialect/mhlo/IR/chlo_ops.h.inc"
|
#include "mlir-hlo/Dialect/mhlo/IR/chlo_ops.h.inc"
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static Value getConstantLike(OpBuilder& b, T constant, Value val) {
|
static Value getConstantLike(OpBuilder& b, Location loc, T constant,
|
||||||
|
Value val) {
|
||||||
Type ty = getElementTypeOrSelf(val.getType());
|
Type ty = getElementTypeOrSelf(val.getType());
|
||||||
|
|
||||||
auto getAttr = [&]() -> Attribute {
|
auto getAttr = [&]() -> Attribute {
|
||||||
|
@ -56,8 +57,7 @@ static Value getConstantLike(OpBuilder& b, T constant, Value val) {
|
||||||
if (ty.isa<FloatType>()) return b.getFloatAttr(ty, constant);
|
if (ty.isa<FloatType>()) return b.getFloatAttr(ty, constant);
|
||||||
llvm_unreachable("unhandled element type");
|
llvm_unreachable("unhandled element type");
|
||||||
};
|
};
|
||||||
// TODO(jpienaar): Add ability to pass loc via native call and update.
|
return b.create<ConstantLikeOp>(loc, getAttr(), val);
|
||||||
return b.create<ConstantLikeOp>(b.getUnknownLoc(), getAttr(), val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace chlo
|
} // namespace chlo
|
||||||
|
|
|
@ -28,7 +28,7 @@ class ConstantSplat<string value> : NativeCodeCall<
|
||||||
"hlo::getSplat(&$_builder, $0, " # value # ")">;
|
"hlo::getSplat(&$_builder, $0, " # value # ")">;
|
||||||
|
|
||||||
class HLO_ConstantLike<string value> : NativeCodeCall<
|
class HLO_ConstantLike<string value> : NativeCodeCall<
|
||||||
"chlo::getConstantLike($_builder, " # value # ", $0)">;
|
"chlo::getConstantLike($_builder, $_loc, " # value # ", $0)">;
|
||||||
|
|
||||||
def NullDenseIntElementsAttr : NativeCodeCall<"DenseIntElementsAttr()">;
|
def NullDenseIntElementsAttr : NativeCodeCall<"DenseIntElementsAttr()">;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue