[XLA/GPU] Migrate all unnested elementwise emitters.
PiperOrigin-RevId: 346716519
This commit is contained in:
parent
65ebd85563
commit
cfcf741932
|
@ -83,6 +83,11 @@ enum ScalarLimit {
|
||||||
// Requires `ty` to be either FloatType or IntegerType.
|
// Requires `ty` to be either FloatType or IntegerType.
|
||||||
DenseElementsAttr GetScalarLimitOfType(Type ty, ScalarLimit limit);
|
DenseElementsAttr GetScalarLimitOfType(Type ty, ScalarLimit limit);
|
||||||
|
|
||||||
|
// Given `op_name` from LMHLO, returns the corresponding op name in MHLO.
|
||||||
|
// Returns empty string if no such op exists.
|
||||||
|
std::string LmhloToMhloOpName(llvm::StringRef op_name,
|
||||||
|
mlir::MLIRContext* context);
|
||||||
|
|
||||||
} // namespace hlo
|
} // namespace hlo
|
||||||
} // namespace mlir
|
} // namespace mlir
|
||||||
|
|
||||||
|
|
|
@ -132,5 +132,13 @@ DenseElementsAttr GetScalarLimitOfType(Type ty, ScalarLimit limit) {
|
||||||
llvm_unreachable("unsupported type");
|
llvm_unreachable("unsupported type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string LmhloToMhloOpName(llvm::StringRef op_name,
|
||||||
|
mlir::MLIRContext *context) {
|
||||||
|
assert(op_name.startswith("lmhlo.") && "Expected an LMHLO op");
|
||||||
|
std::string mhlo_op_name(op_name.drop_front(1));
|
||||||
|
if (context->isOperationRegistered(mhlo_op_name)) return mhlo_op_name;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace hlo
|
} // namespace hlo
|
||||||
} // namespace mlir
|
} // namespace mlir
|
||||||
|
|
Loading…
Reference in New Issue