[Mlir-commits] [mlir] [mlir][linalg] Type conversion of operands in new elementwise-op. (PR #131542)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Fri Mar 21 04:50:52 PDT 2025
================
@@ -4250,17 +4250,36 @@ void ElementwiseOp::regionBuilder(ImplicitLocOpBuilder &b, Block &block,
SmallVector<Value> yields;
Value result;
+ TypeFn castVal = TypeFn::cast_signed;
+ auto castIter = llvm::find_if(attrs, [&](const NamedAttribute &attr) {
+ return attr.getName() == "cast";
+ });
+
+ if (castIter != attrs.end()) {
+ if (auto attr = llvm::dyn_cast<TypeFnAttr>(castIter->getValue()))
+ castVal = attr.getValue();
+ }
+
if (arityGroup == ElementwiseArityGroup::Unary) {
- result = helper.buildUnaryFn(kind.unaryFn, block.getArgument(0));
+ Value val0 = helper.buildTypeFn(castVal, block.getArgument(1).getType(),
----------------
banach-space wrote:
These `val0` and `val1` are quite enigmatic. I don't quite see what these mean. Could you use more descriptive names? Thanks!
https://github.com/llvm/llvm-project/pull/131542
More information about the Mlir-commits
mailing list