llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-backend-amdgpu Author: Mehdi Amini (joker-eph) <details> <summary>Changes</summary> Pass typed property structs and discardable attributes separately at ODS aggregate builder call sites. Assisted-by: Codex --- Patch is 123.58 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/219195.diff 57 Files Affected: - (modified) mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h (+23-4) - (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td (+10-1) - (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td (+10-1) - (modified) mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td (+5-3) - (modified) mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td (+5-3) - (modified) mlir/include/mlir/TableGen/Operator.h (+15) - (modified) mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp (+35-27) - (modified) mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp (+6-5) - (modified) mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp (+3-2) - (modified) mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp (+7-5) - (modified) mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp (+3-1) - (modified) mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp (+39-26) - (modified) mlir/lib/Conversion/MathToLibm/MathToLibm.cpp (+8-3) - (modified) mlir/lib/Conversion/MathToXeVM/MathToXeVM.cpp (+2-2) - (modified) mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp (+1-1) - (modified) mlir/lib/Conversion/RaiseWasm/RaiseWasmMLIR.cpp (+21-6) - (modified) mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp (+2-1) - (modified) mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp (+71-23) - (modified) mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp (+69-34) - (modified) mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp (+7-7) - (modified) mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp (+3-2) - (modified) mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp (+4-2) - (modified) mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp (+3-3) - (modified) mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp (+2-2) - (modified) mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp (+33-7) - (modified) mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp (+2-1) - (modified) mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp (+2-1) - (modified) mlir/lib/Dialect/Arith/Transforms/UnsignedWhenEquivalent.cpp (+7-2) - (modified) mlir/lib/Dialect/Arith/Utils/Utils.cpp (+7-4) - (modified) mlir/lib/Dialect/GPU/Transforms/DecomposeMemRefs.cpp (+1-1) - (modified) mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp (+2-1) - (modified) mlir/lib/Dialect/Math/Transforms/ExtendToSupportedTypes.cpp (+6-6) - (modified) mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp (+5-2) - (modified) mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp (+9-5) - (modified) mlir/lib/Dialect/MemRef/Transforms/MultiBuffer.cpp (+2) - (modified) mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp (+1-1) - (modified) mlir/lib/Dialect/OpenACC/Transforms/ACCCGToGPU.cpp (+8-6) - (modified) mlir/lib/Dialect/Shape/IR/Shape.cpp (+31-16) - (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp (+16-7) - (modified) mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp (+1-1) - (modified) mlir/lib/Dialect/Tensor/IR/TensorOps.cpp (+5-3) - (modified) mlir/lib/Dialect/Tosa/Transforms/TosaNarrowTypes.cpp (+3-1) - (modified) mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp (+2-1) - (modified) mlir/lib/Dialect/XeGPU/Transforms/XeGPUWgToSgDistribute.cpp (+3-1) - (modified) mlir/lib/TableGen/Operator.cpp (+29) - (modified) mlir/lib/Target/SPIRV/Deserialization/DeserializeOps.cpp (+11-2) - (modified) mlir/lib/Tools/PDLL/CodeGen/MLIRGen.cpp (+2-1) - (modified) mlir/test/Dialect/SPIRV/IR/target-env.mlir (+2-1) - (modified) mlir/test/Dialect/Tosa/tosa-narrow-i64-to-i32.mlir (+2-2) - (modified) mlir/test/lib/Dialect/SPIRV/TestAvailability.cpp (+18-3) - (modified) mlir/test/lib/Dialect/Test/TestPatterns.cpp (+2-1) - (modified) mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp (+2-36) - (modified) mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp (+36-4) - (modified) mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp (+3-2) - (modified) mlir/unittests/Dialect/OpenACC/OpenACCOpsTest.cpp (+19-11) - (modified) mlir/unittests/Dialect/OpenACC/OpenACCUtilsLoopTest.cpp (+12-2) - (modified) mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp (+45-70) ``````````diff diff --git a/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h b/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h index feb74c86e349f..a145fd64aff14 100644 --- a/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h +++ b/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h @@ -51,7 +51,8 @@ getLLVMDefaultFPExceptionBehavior(MLIRContext &context); template <typename SourceOp, typename TargetOp> class AttrConvertFastMathToLLVM { public: - AttrConvertFastMathToLLVM(SourceOp srcOp) { + AttrConvertFastMathToLLVM(SourceOp srcOp) + : context(srcOp.getOperation()->getContext()) { // Copy the source attributes. convertedAttr = NamedAttrList{srcOp->getAttrs()}; // Get the name of the arith fastmath attribute. @@ -61,15 +62,33 @@ class AttrConvertFastMathToLLVM { convertedAttr.erase(arithFMFAttrName)); if (arithFMFAttr) { StringRef targetAttrName = TargetOp::getFastmathAttrName(); - convertedAttr.set(targetAttrName, - convertArithFastMathAttrToLLVM(arithFMFAttr)); + Builder builder(context); + propertiesAttr = builder.getDictionaryAttr(builder.getNamedAttr( + targetAttrName, convertArithFastMathAttrToLLVM(arithFMFAttr))); } } ArrayRef<NamedAttribute> getAttrs() const { return convertedAttr.getAttrs(); } - Attribute getPropAttr() const { return {}; } + Attribute getPropAttr() const { return propertiesAttr; } + + typename TargetOp::Properties getProperties() const { + typename TargetOp::Properties properties{}; + TargetOp::populateDefaultProperties( + OperationName(TargetOp::getOperationName(), context), properties); + if (propertiesAttr) { + LogicalResult result = + TargetOp::setPropertiesFromAttr(properties, propertiesAttr, [&]() { + return emitError(UnknownLoc::get(context)); + }); + assert(succeeded(result) && "failed to convert target properties"); + (void)result; + } + return properties; + } private: + MLIRContext *context; NamedAttrList convertedAttr; + DictionaryAttr propertiesAttr; }; // Attribute converter that populates a NamedAttrList by removing the overflow diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td index f40f3f5ebda93..83f56ba59306c 100644 --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td @@ -501,8 +501,17 @@ class LLVM_ConstrainedIntr<string mnem, int numArgs, $_builder.getNamedAttr($_qualCppClassName::getRoundingModeAttrName(), roundingModeAttr)); }], true : "") # [{ + $_qualCppClassName::Properties properties{}; + $_qualCppClassName::populateDefaultProperties( + OperationName($_qualCppClassName::getOperationName(), + $_builder.getContext()), properties); + if (failed($_qualCppClassName::setPropertiesFromAttr( + properties, $_builder.getDictionaryAttr(mlirAttrs), + [&]() { return emitError($_location); }))) { + return failure(); + } auto op = $_qualCppClassName::create($_builder, $_location, - $_resultType, mlirOperands, mlirAttrs); + $_resultType, mlirOperands, properties, {}); moduleImport.setFastmathFlagsAttr(inst, op); $res = op; }]; diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td index a787840663171..da3036dc3187c 100644 --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td @@ -385,8 +385,17 @@ class LLVM_IntrOpBase<Dialect dialect, string opName, string enumName, } SmallVector<Type> resultTypes = }] # !if(!gt(numResults, 0), "{$_resultType};", "{};") # [{ + $_qualCppClassName::Properties properties{}; + $_qualCppClassName::populateDefaultProperties( + OperationName($_qualCppClassName::getOperationName(), + $_builder.getContext()), properties); + if (failed($_qualCppClassName::setPropertiesFromAttr( + properties, $_builder.getDictionaryAttr(mlirAttrs), + [&]() { return emitError($_location); }))) { + return failure(); + } auto op = $_qualCppClassName::create($_builder, - $_location, resultTypes, mlirOperands, mlirAttrs); + $_location, resultTypes, mlirOperands, properties, {}); }]; string baseMlirBuilderArgAndResultAttrs = [{ moduleImport.convertArgAndResultAttrs( diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td index 810eda17268ac..86e466c46c228 100644 --- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td +++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td @@ -2027,9 +2027,11 @@ def MemRef_CollapseShapeOp : MemRef_ReassociativeReshapeOp<"collapse_shape", [ "ArrayRef<ReassociationIndices>":$reassociation, CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs), [{ - $_state.addAttribute("reassociation", - getReassociationIndicesAttribute($_builder, reassociation)); - build($_builder, $_state, resultType, src, attrs); + buildPropertiesAndDiscardableAttributes($_state, attrs); + $_state.getOrAddProperties<Properties>().reassociation = + getReassociationIndicesAttribute($_builder, reassociation); + $_state.addOperands(src); + $_state.addTypes(resultType); }]>, OpBuilder<(ins "Type":$resultType, "Value":$src, "ArrayRef<ReassociationExprs>":$reassociation, diff --git a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td index a711402609775..beac1e91ee6e3 100644 --- a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td +++ b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td @@ -1218,9 +1218,11 @@ def Tensor_CollapseShapeOp : Tensor_ReassociativeReshapeOp<"collapse_shape"> { "ArrayRef<ReassociationIndices>":$reassociation, CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs), [{ - $_state.addAttribute("reassociation", - getReassociationIndicesAttribute($_builder, reassociation)); - build($_builder, $_state, resultType, src, attrs); + buildPropertiesAndDiscardableAttributes($_state, attrs); + $_state.getOrAddProperties<Properties>().reassociation = + getReassociationIndicesAttribute($_builder, reassociation); + $_state.addOperands(src); + $_state.addTypes(resultType); }]>, OpBuilder<(ins "Type":$resultType, "Value":$src, "ArrayRef<ReassociationExprs>":$reassociation, diff --git a/mlir/include/mlir/TableGen/Operator.h b/mlir/include/mlir/TableGen/Operator.h index 4c0ba2a1db9ec..bb36c077708e9 100644 --- a/mlir/include/mlir/TableGen/Operator.h +++ b/mlir/include/mlir/TableGen/Operator.h @@ -38,6 +38,14 @@ class StringInit; namespace mlir { namespace tblgen { +/// The canonical and legacy names of the implicit segment-size properties. +inline constexpr StringLiteral operandSegmentAttrName = "operandSegmentSizes"; +inline constexpr StringLiteral resultSegmentAttrName = "resultSegmentSizes"; +inline constexpr StringLiteral legacyOperandSegmentAttrName = + "operand_segment_sizes"; +inline constexpr StringLiteral legacyResultSegmentAttrName = + "result_segment_sizes"; + /// This class represents an inferred result type. The result type can be /// inferred from an argument or result type. If it is inferred from another /// result type, that type must be buildable or inferred from yet another type. @@ -209,6 +217,13 @@ class Operator { llvm::iterator_range<property_iterator> getProperties() { return properties; } int getNumCoreAttributes() const { return properties.size(); } + /// Returns whether this operation has any non-empty properties. + bool hasNonEmptyProperties() const; + + /// Returns all accepted attribute spellings for this operation's inherent + /// attributes and properties, including legacy segment-size aliases. + SmallVector<StringRef> getInherentAttrNames() const; + // Op properties accessors. NamedProperty &getProperty(int index) { return properties[index]; } const NamedProperty &getProperty(int index) const { diff --git a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp index 2a846339b562e..c356516131fd8 100644 --- a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp +++ b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp @@ -497,7 +497,7 @@ struct RawBufferOpLowering : public ConvertOpToLLVMPattern<GpuOp> { llvm::SmallVector<Type, 1> resultTypes(gpuOp->getNumResults(), llvmBufferValType); - typename Intrinsic::Properties properties; + typename Intrinsic::Properties properties{}; properties.aux = rewriter.getI32IntegerAttr(0); Operation *lowered = Intrinsic::create(rewriter, loc, resultTypes, args, properties); @@ -2253,7 +2253,8 @@ struct TransposeLoadOpLowering if (numElements != 16) return emitNumElementsError(16, "gfx1250+"); intrinsic = - ROCDL::DsLoadTr4_B64::create(rewriter, loc, rocdlResultType, srcPtr) + ROCDL::DsLoadTr4_B64::create(rewriter, loc, rocdlResultType, srcPtr, + nullptr, nullptr, nullptr) .getResult(); break; } @@ -2261,7 +2262,8 @@ struct TransposeLoadOpLowering if (numElements != 16) return emitNumElementsError(16, "gfx1250+"); intrinsic = - ROCDL::DsLoadTr6_B96::create(rewriter, loc, rocdlResultType, srcPtr) + ROCDL::DsLoadTr6_B96::create(rewriter, loc, rocdlResultType, srcPtr, + nullptr, nullptr, nullptr) .getResult(); break; } @@ -2269,16 +2271,18 @@ struct TransposeLoadOpLowering if (numElements != 8) return emitNumElementsError(8, "gfx1250+"); intrinsic = - ROCDL::DsLoadTr8_B64::create(rewriter, loc, rocdlResultType, srcPtr) + ROCDL::DsLoadTr8_B64::create(rewriter, loc, rocdlResultType, srcPtr, + nullptr, nullptr, nullptr) .getResult(); break; } case 16: { if (numElements != 8) return emitNumElementsError(8, "gfx1250+"); - intrinsic = ROCDL::DsLoadTr16_B128::create(rewriter, loc, - rocdlResultType, srcPtr) - .getResult(); + intrinsic = + ROCDL::DsLoadTr16_B128::create(rewriter, loc, rocdlResultType, + srcPtr, nullptr, nullptr, nullptr) + .getResult(); break; } default: @@ -2289,33 +2293,37 @@ struct TransposeLoadOpLowering case 4: { if (numElements != 16) return emitNumElementsError(16, "gfx950"); - intrinsic = ROCDL::ds_read_tr4_b64::create(rewriter, loc, - rocdlResultType, srcPtr) - .getResult(); + intrinsic = + ROCDL::ds_read_tr4_b64::create(rewriter, loc, rocdlResultType, + srcPtr, nullptr, nullptr, nullptr) + .getResult(); break; } case 6: { if (numElements != 16) return emitNumElementsError(16, "gfx950"); - intrinsic = ROCDL::ds_read_tr6_b96::create(rewriter, loc, - rocdlResultType, srcPtr) - .getResult(); + intrinsic = + ROCDL::ds_read_tr6_b96::create(rewriter, loc, rocdlResultType, + srcPtr, nullptr, nullptr, nullptr) + .getResult(); break; } case 8: { if (numElements != 8) return emitNumElementsError(8, "gfx950"); - intrinsic = ROCDL::ds_read_tr8_b64::create(rewriter, loc, - rocdlResultType, srcPtr) - .getResult(); + intrinsic = + ROCDL::ds_read_tr8_b64::create(rewriter, loc, rocdlResultType, + srcPtr, nullptr, nullptr, nullptr) + .getResult(); break; } case 16: { if (numElements != 4) return emitNumElementsError(4, "gfx950"); - intrinsic = ROCDL::ds_read_tr16_b64::create(rewriter, loc, - rocdlResultType, srcPtr) - .getResult(); + intrinsic = + ROCDL::ds_read_tr16_b64::create(rewriter, loc, rocdlResultType, + srcPtr, nullptr, nullptr, nullptr) + .getResult(); break; } default: @@ -2376,8 +2384,8 @@ struct GlobalTransposeLoadOpLowering assert(numElements == 16); if (chipset < kGfx1250) return op.emitOpError("4-bit global_transpose_load requires gfx1250+"); - auto rocdlOp = ROCDL::GlobalLoadTr4_B64::create(rewriter, loc, - rocdlResultType, srcPtr); + auto rocdlOp = ROCDL::GlobalLoadTr4_B64::create( + rewriter, loc, rocdlResultType, srcPtr, nullptr, nullptr, nullptr); rewriter.replaceOpWithNewOp<LLVM::BitcastOp>(op, llvmResultType, rocdlOp); break; } @@ -2385,22 +2393,22 @@ struct GlobalTransposeLoadOpLowering assert(numElements == 16); if (chipset < kGfx1250) return op.emitOpError("6-bit global_transpose_load requires gfx1250+"); - auto rocdlOp = ROCDL::GlobalLoadTr6_B96::create(rewriter, loc, - rocdlResultType, srcPtr); + auto rocdlOp = ROCDL::GlobalLoadTr6_B96::create( + rewriter, loc, rocdlResultType, srcPtr, nullptr, nullptr, nullptr); rewriter.replaceOpWithNewOp<LLVM::BitcastOp>(op, llvmResultType, rocdlOp); break; } case 8: { assert(numElements == 8); - auto rocdlOp = ROCDL::GlobalLoadTr8_B64::create(rewriter, loc, - rocdlResultType, srcPtr); + auto rocdlOp = ROCDL::GlobalLoadTr8_B64::create( + rewriter, loc, rocdlResultType, srcPtr, nullptr, nullptr, nullptr); rewriter.replaceOpWithNewOp<LLVM::BitcastOp>(op, llvmResultType, rocdlOp); break; } case 16: { assert(numElements == 8); - rewriter.replaceOpWithNewOp<ROCDL::GlobalLoadTr8_B128>(op, llvmResultType, - srcPtr); + rewriter.replaceOpWithNewOp<ROCDL::GlobalLoadTr8_B128>( + op, llvmResultType, srcPtr, nullptr, nullptr, nullptr); break; } default: diff --git a/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp b/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp index cf44c2a0033ac..c584df3513925 100644 --- a/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp +++ b/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp @@ -112,7 +112,7 @@ static Value castF32To(Type desType, Value f32, Location loc, if (elementType.getIntOrFloatBitWidth() < 32) return arith::TruncFOp::create(rewriter, loc, desType, f32); if (elementType.getIntOrFloatBitWidth() > 32) - return arith::ExtFOp::create(rewriter, loc, desType, f32); + return arith::ExtFOp::create(rewriter, loc, desType, f32, nullptr); llvm_unreachable("The only 32-bit float type is f32"); } @@ -152,7 +152,7 @@ ExtFOnFloat8RewritePattern::matchAndRewrite(arith::ExtFOp op, Value scalarIn = vector::ExtractOp::create(rewriter, loc, in, ArrayRef<int64_t>{}); Value scalarExt = - arith::ExtFOp::create(rewriter, loc, outElemType, scalarIn); + arith::ExtFOp::create(rewriter, loc, outElemType, scalarIn, nullptr); Value result = vector::InsertOp::create(rewriter, loc, scalarExt, zerodSplat, ArrayRef<int64_t>{}); rewriter.replaceOp(op, result); @@ -203,7 +203,8 @@ static Value castToF32(Value value, Location loc, PatternRewriter &rewriter) { if (type.isF32()) return value; if (type.getIntOrFloatBitWidth() < 32) - return arith::ExtFOp::create(rewriter, loc, rewriter.getF32Type(), value); + return arith::ExtFOp::create(rewriter, loc, rewriter.getF32Type(), value, + nullptr); if (type.getIntOrFloatBitWidth() > 32) return arith::TruncFOp::create(rewriter, loc, rewriter.getF32Type(), value); llvm_unreachable("The only 32-bit float type is f32"); @@ -472,7 +473,7 @@ ScalingExtFRewritePattern::matchAndRewrite(arith::ScalingExtFOp op, Type scaleF32Type = scaleVecType ? VectorType::get(scaleVecType.getShape(), f32) : f32; if (scaleType.getIntOrFloatBitWidth() < 32) - scale = arith::ExtFOp::create(rewriter, loc, scaleF32Type, scale); + scale = arith::ExtFOp::create(rewriter, loc, scaleF32Type, scale, nullptr); else if (scaleType.getIntOrFloatBitWidth() > 32) scale = arith::TruncFOp::create(rewriter, loc, scaleF32Type, scale); @@ -590,7 +591,7 @@ ScalingTruncFRewritePattern::matchAndRewrite(arith::ScalingTruncFOp op, Type scaleF32Type = scaleVecType ? VectorType::get(scaleVecType.getShape(), f32) : f32; if (scaleType.getIntOrFloatBitWidth() < 32) - scale = arith::ExtFOp::create(rewriter, loc, scaleF32Type, scale); + scale = arith::ExtFOp::create(rewriter, loc, scaleF32Type, scale, nullptr); else if (scaleType.getIntOrFloatBitWidth() > 32) scale = arith::TruncFOp::create(rewriter, loc, scaleF32Type, scale); diff --git a/mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp b/mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp index 91dde9018a288..26fa36b937239 100644 --- a/mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp +++ b/mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp @@ -708,8 +708,9 @@ class FtoICastOpConversion : public OpConversionPattern<CastOp> { /*isSigned=*/false); } - Value result = emitc::CastOp::create( - rewriter, castOp.getLoc(), actualResultType, adaptor.getOperands()); + Value result = + emitc::CastOp::create(rewriter, castOp.getLoc(), actualResultType, + adaptor.getOperands().front(), /*pure=*/false); if (isa<arith::FPToUIOp>(castOp)) { result = diff --git a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp index 185c20ab9bb1c..f5e21d63d20b6 100644 --- a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp +++ b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp @@ -600,17 +600,19 @@ struct CallOpInterfaceLowering : public ConvertOpToLLVMPattern<CallOpType> { auto promoted = this->getTypeConverter()->promoteOperands( callOp.getLoc(), /*opOperands=*/callOp->getOperands(), adaptor.getOperands(), rewriter, useBarePtrCallConv); + LLVM::CallOp::Properties properties{}; + LLVM::CallOp::populateDefaultProperties( + OperationName(LLVM::CallOp::getOperationName(), rewriter.getContext()), + properties); + properties.operandSegmentSizes = {static_cast<int32_t>(promoted.size()), 0}; + properties.op_bundle_sizes = rewriter.getDenseI32ArrayAttr({}); auto newOp = LLVM::CallOp::create( rewriter, callOp.getLoc(), packedResult ? TypeRange(packedResult) : TypeRange(), promoted, - callOp->getDiscardableAttrDictionary().getValue()); + properties, callOp->getDiscardableAttrDictionary().getValue()); if constexpr (std::is_same_v<CallOpType, func::CallOp>) newOp.setCalleeAttr(callOp.getCalleeAttr()); - newOp.getProperties().operandSegmentSizes = { - static_cast<int32_t>(promoted.size()), 0}; - newOp.getProperties().op_bundle_sizes = rewriter.getDenseI32ArrayAttr({}); - // Helper function that extracts an individual result from the return value // of the new call op. llvm.call ops support only 0 or 1 result. In case of // 2 or more results, the results are packed into a structure. diff --git a/mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp b/mli... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/219195 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
