diff options
Diffstat (limited to 'mlir/lib/Dialect')
20 files changed, 65 insertions, 71 deletions
diff --git a/mlir/lib/Dialect/AffineOps/AffineOps.cpp b/mlir/lib/Dialect/AffineOps/AffineOps.cpp index e58f6f8d6ed..8c8c67d1595 100644 --- a/mlir/lib/Dialect/AffineOps/AffineOps.cpp +++ b/mlir/lib/Dialect/AffineOps/AffineOps.cpp @@ -616,9 +616,8 @@ AffineApplyOp mlir::makeComposedAffineApply(OpBuilder &b, Location loc, // A symbol may appear as a dim in affine.apply operations. This function // canonicalizes dims that are valid symbols into actual symbols. template <class MapOrSet> -static void -canonicalizePromotedSymbols(MapOrSet *mapOrSet, - llvm::SmallVectorImpl<Value *> *operands) { +static void canonicalizePromotedSymbols(MapOrSet *mapOrSet, + SmallVectorImpl<Value *> *operands) { if (!mapOrSet || operands->empty()) return; @@ -662,7 +661,7 @@ canonicalizePromotedSymbols(MapOrSet *mapOrSet, template <class MapOrSet> static void canonicalizeMapOrSetAndOperands(MapOrSet *mapOrSet, - llvm::SmallVectorImpl<Value *> *operands) { + SmallVectorImpl<Value *> *operands) { static_assert(std::is_same<MapOrSet, AffineMap>::value || std::is_same<MapOrSet, IntegerSet>::value, "Argument must be either of AffineMap or IntegerSet type"); @@ -738,13 +737,13 @@ canonicalizeMapOrSetAndOperands(MapOrSet *mapOrSet, *operands = resultOperands; } -void mlir::canonicalizeMapAndOperands( - AffineMap *map, llvm::SmallVectorImpl<Value *> *operands) { +void mlir::canonicalizeMapAndOperands(AffineMap *map, + SmallVectorImpl<Value *> *operands) { canonicalizeMapOrSetAndOperands<AffineMap>(map, operands); } -void mlir::canonicalizeSetAndOperands( - IntegerSet *set, llvm::SmallVectorImpl<Value *> *operands) { +void mlir::canonicalizeSetAndOperands(IntegerSet *set, + SmallVectorImpl<Value *> *operands) { canonicalizeMapOrSetAndOperands<IntegerSet>(set, operands); } diff --git a/mlir/lib/Dialect/FxpMathOps/Transforms/UniformKernelUtils.h b/mlir/lib/Dialect/FxpMathOps/Transforms/UniformKernelUtils.h index f0eeba0891a..955e2ecc88c 100644 --- a/mlir/lib/Dialect/FxpMathOps/Transforms/UniformKernelUtils.h +++ b/mlir/lib/Dialect/FxpMathOps/Transforms/UniformKernelUtils.h @@ -35,7 +35,7 @@ inline quant::UniformQuantizedType getUniformElementType(Type t) { } inline bool hasStorageBitWidth(quant::QuantizedType t, - llvm::ArrayRef<unsigned> checkWidths) { + ArrayRef<unsigned> checkWidths) { unsigned w = t.getStorageType().getIntOrFloatBitWidth(); for (unsigned checkWidth : checkWidths) { if (w == checkWidth) diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp index 1c20be6a453..7324b96a7e1 100644 --- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp +++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp @@ -237,7 +237,7 @@ KernelDim3 LaunchOp::getBlockSizeOperandValues() { return KernelDim3{getOperand(3), getOperand(4), getOperand(5)}; } -llvm::iterator_range<Block::args_iterator> LaunchOp::getKernelArguments() { +iterator_range<Block::args_iterator> LaunchOp::getKernelArguments() { auto args = body().getBlocks().front().getArguments(); return llvm::drop_begin(args, LaunchOp::kNumConfigRegionAttributes); } diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp index 416a37b3270..0a6a5915633 100644 --- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp @@ -69,7 +69,7 @@ static gpu::LaunchFuncOp inlineBeneficiaryOps(gpu::GPUFuncOp kernelFunc, gpu::LaunchFuncOp launch) { OpBuilder kernelBuilder(kernelFunc.getBody()); auto &firstBlock = kernelFunc.getBody().front(); - llvm::SmallVector<Value *, 8> newLaunchArgs; + SmallVector<Value *, 8> newLaunchArgs; BlockAndValueMapping map; for (int i = 0, e = launch.getNumKernelOperands(); i < e; ++i) { map.map(launch.getKernelOperand(i), kernelFunc.getArgument(i)); @@ -195,7 +195,7 @@ private: SymbolTable symbolTable(kernelModule); symbolTable.insert(kernelFunc); - llvm::SmallVector<Operation *, 8> symbolDefWorklist = {kernelFunc}; + SmallVector<Operation *, 8> symbolDefWorklist = {kernelFunc}; while (!symbolDefWorklist.empty()) { if (Optional<SymbolTable::UseRange> symbolUses = SymbolTable::getSymbolUses(symbolDefWorklist.pop_back_val())) { diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp index 9ac564599db..abbc4e0ae45 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -1227,7 +1227,7 @@ static ParseResult parseLLVMFuncOp(OpAsmParser &parser, auto *body = result.addRegion(); return parser.parseOptionalRegion( - *body, entryArgs, entryArgs.empty() ? llvm::ArrayRef<Type>() : argTypes); + *body, entryArgs, entryArgs.empty() ? ArrayRef<Type>() : argTypes); } // Print the LLVMFuncOp. Collects argument and result types and passes them to @@ -1499,7 +1499,7 @@ LLVMType LLVMType::get(MLIRContext *context, llvm::Type *llvmType) { /// Get an LLVMType with an llvm type that may cause changes to the underlying /// llvm context when constructed. LLVMType LLVMType::getLocked(LLVMDialect *dialect, - llvm::function_ref<llvm::Type *()> typeBuilder) { + function_ref<llvm::Type *()> typeBuilder) { // Lock access to the llvm context and build the type. llvm::sys::SmartScopedLock<true> lock(dialect->impl->mutex); return get(dialect->getContext(), typeBuilder()); diff --git a/mlir/lib/Dialect/Linalg/EDSC/Builders.cpp b/mlir/lib/Dialect/Linalg/EDSC/Builders.cpp index 77e3a1e392f..ba96186da38 100644 --- a/mlir/lib/Dialect/Linalg/EDSC/Builders.cpp +++ b/mlir/lib/Dialect/Linalg/EDSC/Builders.cpp @@ -44,7 +44,7 @@ static void getMaxDimIndex(ArrayRef<StructuredIndexed> structuredIndices, Operation *mlir::edsc::makeLinalgGenericOp( ArrayRef<IterType> iteratorTypes, ArrayRef<StructuredIndexed> inputs, ArrayRef<StructuredIndexed> outputs, - llvm::function_ref<void(ArrayRef<BlockArgument *>)> regionBuilder, + function_ref<void(ArrayRef<BlockArgument *>)> regionBuilder, ArrayRef<Value *> otherValues, ArrayRef<Attribute> otherAttributes) { auto &builder = edsc::ScopedContext::getBuilder(); auto *ctx = builder.getContext(); diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp index 6adfeb592ef..0fd29cdc6e0 100644 --- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp @@ -632,7 +632,7 @@ namespace linalg { } // namespace linalg } // namespace mlir -static AffineMap extractOrIdentityMap(llvm::Optional<AffineMap> maybeMap, +static AffineMap extractOrIdentityMap(Optional<AffineMap> maybeMap, unsigned rank, MLIRContext *context) { if (maybeMap) return maybeMap.getValue(); diff --git a/mlir/lib/Dialect/Linalg/Transforms/LinalgTransforms.cpp b/mlir/lib/Dialect/Linalg/Transforms/LinalgTransforms.cpp index 74000212373..f4364928af8 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/LinalgTransforms.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/LinalgTransforms.cpp @@ -100,7 +100,7 @@ LogicalResult mlir::linalg::tileAndFuseLinalgOpAndSetMarker( bool mlir::linalg::detail::isProducedByOpOfTypeImpl( Operation *consumerOp, Value *consumedView, - llvm::function_ref<bool(Operation *)> isaOpType) { + function_ref<bool(Operation *)> isaOpType) { LinalgOp consumer = dyn_cast<LinalgOp>(consumerOp); if (!consumer) return false; diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp index 435aa7245ba..4d8a24cb6cb 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp @@ -315,7 +315,7 @@ makeTiledViews(OpBuilder &b, Location loc, LinalgOp linalgOp, return res; } -llvm::Optional<TiledLinalgOp> mlir::linalg::tileLinalgOp( +Optional<TiledLinalgOp> mlir::linalg::tileLinalgOp( OpBuilder &b, LinalgOp op, ArrayRef<Value *> tileSizes, ArrayRef<unsigned> permutation, OperationFolder *folder) { // 1. Enforce the convention that "tiling by zero" skips tiling a particular @@ -389,7 +389,7 @@ llvm::Optional<TiledLinalgOp> mlir::linalg::tileLinalgOp( return TiledLinalgOp{res, loops}; } -llvm::Optional<TiledLinalgOp> mlir::linalg::tileLinalgOp( +Optional<TiledLinalgOp> mlir::linalg::tileLinalgOp( OpBuilder &b, LinalgOp op, ArrayRef<int64_t> tileSizes, ArrayRef<unsigned> permutation, OperationFolder *folder) { if (tileSizes.empty()) diff --git a/mlir/lib/Dialect/SDBM/SDBM.cpp b/mlir/lib/Dialect/SDBM/SDBM.cpp index ec3c7f3433a..510e13e8028 100644 --- a/mlir/lib/Dialect/SDBM/SDBM.cpp +++ b/mlir/lib/Dialect/SDBM/SDBM.cpp @@ -88,11 +88,11 @@ namespace { struct SDBMBuilderResult { // Positions in the matrix of the variables taken with the "+" sign in the // difference expression, 0 if it is a constant rather than a variable. - llvm::SmallVector<unsigned, 2> positivePos; + SmallVector<unsigned, 2> positivePos; // Positions in the matrix of the variables taken with the "-" sign in the // difference expression, 0 if it is a constant rather than a variable. - llvm::SmallVector<unsigned, 2> negativePos; + SmallVector<unsigned, 2> negativePos; // Constant value in the difference expression. int64_t value = 0; @@ -184,13 +184,12 @@ public: return lhs; } - SDBMBuilder(llvm::DenseMap<SDBMExpr, llvm::SmallVector<unsigned, 2>> - &pointExprToStripe, - llvm::function_ref<unsigned(SDBMInputExpr)> callback) + SDBMBuilder(DenseMap<SDBMExpr, SmallVector<unsigned, 2>> &pointExprToStripe, + function_ref<unsigned(SDBMInputExpr)> callback) : pointExprToStripe(pointExprToStripe), linearPosition(callback) {} - llvm::DenseMap<SDBMExpr, llvm::SmallVector<unsigned, 2>> &pointExprToStripe; - llvm::function_ref<unsigned(SDBMInputExpr)> linearPosition; + DenseMap<SDBMExpr, SmallVector<unsigned, 2>> &pointExprToStripe; + function_ref<unsigned(SDBMInputExpr)> linearPosition; }; } // namespace @@ -239,7 +238,7 @@ SDBM SDBM::get(ArrayRef<SDBMExpr> inequalities, ArrayRef<SDBMExpr> equalities) { // expression. Keep track of those in pointExprToStripe. // There may also be multiple stripe expressions equal to the same variable. // Introduce a temporary variable for each of those. - llvm::DenseMap<SDBMExpr, llvm::SmallVector<unsigned, 2>> pointExprToStripe; + DenseMap<SDBMExpr, SmallVector<unsigned, 2>> pointExprToStripe; unsigned numTemporaries = 0; auto updateStripePointMaps = [&numTemporaries, &result, &pointExprToStripe, @@ -512,7 +511,7 @@ void SDBM::getSDBMExpressions(SDBMDialect *dialect, } } -void SDBM::print(llvm::raw_ostream &os) { +void SDBM::print(raw_ostream &os) { unsigned numVariables = getNumVariables(); // Helper function that prints the name of the variable given its linearized diff --git a/mlir/lib/Dialect/SDBM/SDBMExpr.cpp b/mlir/lib/Dialect/SDBM/SDBMExpr.cpp index 8f6b59d8e45..8cdd9c8566e 100644 --- a/mlir/lib/Dialect/SDBM/SDBMExpr.cpp +++ b/mlir/lib/Dialect/SDBM/SDBMExpr.cpp @@ -89,7 +89,7 @@ public: : subExprs(exprs.begin(), exprs.end()) {} AffineExprMatcherStorage(AffineExprMatcher &a, AffineExprMatcher &b) : subExprs({a, b}) {} - llvm::SmallVector<AffineExprMatcher, 0> subExprs; + SmallVector<AffineExprMatcher, 0> subExprs; AffineExpr matched; }; } // namespace @@ -311,7 +311,7 @@ AffineExpr SDBMExpr::getAsAffineExpr() const { // LHS if the constant becomes zero. Otherwise, construct a sum expression. template <typename Result> Result addConstantAndSink(SDBMDirectExpr expr, int64_t constant, bool negated, - llvm::function_ref<Result(SDBMDirectExpr)> builder) { + function_ref<Result(SDBMDirectExpr)> builder) { SDBMDialect *dialect = expr.getDialect(); if (auto sumExpr = expr.dyn_cast<SDBMSumExpr>()) { if (negated) diff --git a/mlir/lib/Dialect/SPIRV/LayoutUtils.cpp b/mlir/lib/Dialect/SPIRV/LayoutUtils.cpp index e2d5332777d..5db478d388b 100644 --- a/mlir/lib/Dialect/SPIRV/LayoutUtils.cpp +++ b/mlir/lib/Dialect/SPIRV/LayoutUtils.cpp @@ -33,10 +33,9 @@ VulkanLayoutUtils::decorateType(spirv::StructType structType, return structType; } - llvm::SmallVector<Type, 4> memberTypes; - llvm::SmallVector<VulkanLayoutUtils::Size, 4> layoutInfo; - llvm::SmallVector<spirv::StructType::MemberDecorationInfo, 4> - memberDecorations; + SmallVector<Type, 4> memberTypes; + SmallVector<VulkanLayoutUtils::Size, 4> layoutInfo; + SmallVector<spirv::StructType::MemberDecorationInfo, 4> memberDecorations; VulkanLayoutUtils::Size structMemberOffset = 0; VulkanLayoutUtils::Size maxMemberAlignment = 1; diff --git a/mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp b/mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp index c99e7ca8b20..def8ee810fe 100644 --- a/mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp @@ -149,7 +149,7 @@ Optional<uint64_t> parseAndVerify<uint64_t>(SPIRVDialect const &dialect, DialectAsmParser &parser); static bool isValidSPIRVIntType(IntegerType type) { - return llvm::is_contained(llvm::ArrayRef<unsigned>({1, 8, 16, 32, 64}), + return llvm::is_contained(ArrayRef<unsigned>({1, 8, 16, 32, 64}), type.getWidth()); } diff --git a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp index 140470b8df8..0df4525bac6 100644 --- a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp @@ -80,7 +80,7 @@ static LogicalResult extractValueFromConstOp(Operation *op, template <typename Ty> static ArrayAttr getStrArrayAttrForEnumList(Builder &builder, ArrayRef<Ty> enumValues, - llvm::function_ref<StringRef(Ty)> stringifyFn) { + function_ref<StringRef(Ty)> stringifyFn) { if (enumValues.empty()) { return nullptr; } @@ -399,7 +399,7 @@ static unsigned getBitWidth(Type type) { /// emits errors with the given loc on failure. static Type getElementType(Type type, ArrayRef<int32_t> indices, - llvm::function_ref<InFlightDiagnostic(StringRef)> emitErrorFn) { + function_ref<InFlightDiagnostic(StringRef)> emitErrorFn) { if (indices.empty()) { emitErrorFn("expected at least one index for spv.CompositeExtract"); return nullptr; @@ -423,7 +423,7 @@ getElementType(Type type, ArrayRef<int32_t> indices, static Type getElementType(Type type, Attribute indices, - llvm::function_ref<InFlightDiagnostic(StringRef)> emitErrorFn) { + function_ref<InFlightDiagnostic(StringRef)> emitErrorFn) { auto indicesArrayAttr = indices.dyn_cast<ArrayAttr>(); if (!indicesArrayAttr) { emitErrorFn("expected a 32-bit integer array attribute for 'indices'"); @@ -2317,7 +2317,7 @@ static LogicalResult verify(spirv::ModuleOp moduleOp) { auto &op = *moduleOp.getOperation(); auto *dialect = op.getDialect(); auto &body = op.getRegion(0).front(); - llvm::DenseMap<std::pair<FuncOp, spirv::ExecutionModel>, spirv::EntryPointOp> + DenseMap<std::pair<FuncOp, spirv::ExecutionModel>, spirv::EntryPointOp> entryPoints; SymbolTable table(moduleOp); diff --git a/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp b/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp index e60805aca1b..df9cb47a562 100644 --- a/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp +++ b/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp @@ -2366,7 +2366,7 @@ Deserializer::processOp<spirv::FunctionCallOp>(ArrayRef<uint32_t> operands) { auto functionName = getFunctionSymbol(functionID); - llvm::SmallVector<Value *, 4> arguments; + SmallVector<Value *, 4> arguments; for (auto operand : llvm::drop_begin(operands, 3)) { auto *value = getValue(operand); if (!value) { diff --git a/mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp b/mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp index 7db7111e086..4baac53b89f 100644 --- a/mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp +++ b/mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp @@ -69,7 +69,7 @@ static LogicalResult encodeInstructionInto(SmallVectorImpl<uint32_t> &binary, /// serialization of the merge block and the continue block, if exists, until /// after all other blocks have been processed. static LogicalResult visitInPrettyBlockOrder( - Block *headerBlock, llvm::function_ref<LogicalResult(Block *)> blockHandler, + Block *headerBlock, function_ref<LogicalResult(Block *)> blockHandler, bool skipHeader = false, ArrayRef<Block *> skipBlocks = {}) { llvm::df_iterator_default_set<Block *, 4> doneBlocks; doneBlocks.insert(skipBlocks.begin(), skipBlocks.end()); @@ -301,7 +301,7 @@ private: /// instruction if this is a SPIR-V selection/loop header block. LogicalResult processBlock(Block *block, bool omitLabel = false, - llvm::function_ref<void()> actionBeforeTerminator = nullptr); + function_ref<void()> actionBeforeTerminator = nullptr); /// Emits OpPhi instructions for the given block if it has block arguments. LogicalResult emitPhiForBlockArguments(Block *block); @@ -457,7 +457,7 @@ private: /// placed inside `functions`) here. And then after emitting all blocks, we /// replace the dummy <id> 0 with the real result <id> by overwriting /// `functions[offset]`. - DenseMap<Value *, llvm::SmallVector<size_t, 1>> deferredPhiValues; + DenseMap<Value *, SmallVector<size_t, 1>> deferredPhiValues; }; } // namespace @@ -1341,7 +1341,7 @@ uint32_t Serializer::getOrCreateBlockID(Block *block) { LogicalResult Serializer::processBlock(Block *block, bool omitLabel, - llvm::function_ref<void()> actionBeforeTerminator) { + function_ref<void()> actionBeforeTerminator) { LLVM_DEBUG(llvm::dbgs() << "processing block " << block << ":\n"); LLVM_DEBUG(block->print(llvm::dbgs())); LLVM_DEBUG(llvm::dbgs() << '\n'); @@ -1773,7 +1773,7 @@ Serializer::processOp<spirv::FunctionCallOp>(spirv::FunctionCallOp op) { auto funcName = op.callee(); uint32_t resTypeID = 0; - llvm::SmallVector<Type, 1> resultTypes(op.getResultTypes()); + SmallVector<Type, 1> resultTypes(op.getResultTypes()); if (failed(processType(op.getLoc(), (resultTypes.empty() ? getVoidType() : resultTypes[0]), resTypeID))) { diff --git a/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp b/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp index 655f559b765..e9b4f23cca4 100644 --- a/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp +++ b/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp @@ -80,7 +80,7 @@ static TranslateToMLIRRegistration fromBinary( // Serialization registration //===----------------------------------------------------------------------===// -LogicalResult serializeModule(ModuleOp module, llvm::raw_ostream &output) { +LogicalResult serializeModule(ModuleOp module, raw_ostream &output) { if (!module) return failure(); @@ -105,7 +105,7 @@ LogicalResult serializeModule(ModuleOp module, llvm::raw_ostream &output) { } static TranslateFromMLIRRegistration - toBinary("serialize-spirv", [](ModuleOp module, llvm::raw_ostream &output) { + toBinary("serialize-spirv", [](ModuleOp module, raw_ostream &output) { return serializeModule(module, output); }); @@ -113,8 +113,8 @@ static TranslateFromMLIRRegistration // Round-trip registration //===----------------------------------------------------------------------===// -LogicalResult roundTripModule(llvm::SourceMgr &sourceMgr, - llvm::raw_ostream &output, MLIRContext *context) { +LogicalResult roundTripModule(llvm::SourceMgr &sourceMgr, raw_ostream &output, + MLIRContext *context) { // Parse an MLIR module from the source manager. auto srcModule = OwningModuleRef(parseSourceFile(sourceMgr, context)); if (!srcModule) @@ -147,9 +147,8 @@ LogicalResult roundTripModule(llvm::SourceMgr &sourceMgr, return mlir::success(); } -static TranslateRegistration - roundtrip("test-spirv-roundtrip", - [](llvm::SourceMgr &sourceMgr, llvm::raw_ostream &output, - MLIRContext *context) { - return roundTripModule(sourceMgr, output, context); - }); +static TranslateRegistration roundtrip( + "test-spirv-roundtrip", + [](llvm::SourceMgr &sourceMgr, raw_ostream &output, MLIRContext *context) { + return roundTripModule(sourceMgr, output, context); + }); diff --git a/mlir/lib/Dialect/StandardOps/Ops.cpp b/mlir/lib/Dialect/StandardOps/Ops.cpp index 3189e42d061..b2b3ba5f509 100644 --- a/mlir/lib/Dialect/StandardOps/Ops.cpp +++ b/mlir/lib/Dialect/StandardOps/Ops.cpp @@ -2297,7 +2297,7 @@ static void print(OpAsmPrinter &p, ViewOp op) { Value *ViewOp::getDynamicOffset() { int64_t offset; - llvm::SmallVector<int64_t, 4> strides; + SmallVector<int64_t, 4> strides; auto result = succeeded(mlir::getStridesAndOffset(getType(), strides, offset)); assert(result); @@ -2341,7 +2341,7 @@ static LogicalResult verify(ViewOp op) { // Verify that the result memref type has a strided layout map. int64_t offset; - llvm::SmallVector<int64_t, 4> strides; + SmallVector<int64_t, 4> strides; if (failed(getStridesAndOffset(viewType, strides, offset))) return op.emitError("result type ") << viewType << " is not strided"; @@ -2383,7 +2383,7 @@ struct ViewOpShapeFolder : public OpRewritePattern<ViewOp> { // Get offset from old memref view type 'memRefType'. int64_t oldOffset; - llvm::SmallVector<int64_t, 4> oldStrides; + SmallVector<int64_t, 4> oldStrides; if (failed(getStridesAndOffset(memrefType, oldStrides, oldOffset))) return matchFailure(); @@ -2585,13 +2585,13 @@ static LogicalResult verify(SubViewOp op) { // Verify that the base memref type has a strided layout map. int64_t baseOffset; - llvm::SmallVector<int64_t, 4> baseStrides; + SmallVector<int64_t, 4> baseStrides; if (failed(getStridesAndOffset(baseType, baseStrides, baseOffset))) return op.emitError("base type ") << subViewType << " is not strided"; // Verify that the result memref type has a strided layout map. int64_t subViewOffset; - llvm::SmallVector<int64_t, 4> subViewStrides; + SmallVector<int64_t, 4> subViewStrides; if (failed(getStridesAndOffset(subViewType, subViewStrides, subViewOffset))) return op.emitError("result type ") << subViewType << " is not strided"; @@ -2677,8 +2677,7 @@ static LogicalResult verify(SubViewOp op) { return success(); } -llvm::raw_ostream &mlir::operator<<(llvm::raw_ostream &os, - SubViewOp::Range &range) { +raw_ostream &mlir::operator<<(raw_ostream &os, SubViewOp::Range &range) { return os << "range " << *range.offset << ":" << *range.size << ":" << *range.stride; } @@ -2734,7 +2733,7 @@ static bool hasConstantOffsetSizesAndStrides(MemRefType memrefType) { return false; // Get offset and strides. int64_t offset; - llvm::SmallVector<int64_t, 4> strides; + SmallVector<int64_t, 4> strides; if (failed(getStridesAndOffset(memrefType, strides, offset))) return false; // Return 'false' if any of offset or strides is dynamic. diff --git a/mlir/lib/Dialect/Traits.cpp b/mlir/lib/Dialect/Traits.cpp index 9945b6ae4c2..0ac07c2c4f5 100644 --- a/mlir/lib/Dialect/Traits.cpp +++ b/mlir/lib/Dialect/Traits.cpp @@ -112,8 +112,7 @@ Type OpTrait::util::getBroadcastedType(Type type1, Type type2) { // Returns the type kind if the given type is a vector or ranked tensor type. // Returns llvm::None otherwise. - auto getCompositeTypeKind = - [](Type type) -> llvm::Optional<StandardTypes::Kind> { + auto getCompositeTypeKind = [](Type type) -> Optional<StandardTypes::Kind> { if (type.isa<VectorType>() || type.isa<RankedTensorType>()) return static_cast<StandardTypes::Kind>(type.getKind()); return llvm::None; @@ -122,7 +121,7 @@ Type OpTrait::util::getBroadcastedType(Type type1, Type type2) { // Make sure the composite type, if has, is consistent. auto compositeKind1 = getCompositeTypeKind(type1); auto compositeKind2 = getCompositeTypeKind(type2); - llvm::Optional<StandardTypes::Kind> resultCompositeKind; + Optional<StandardTypes::Kind> resultCompositeKind; if (compositeKind1 && compositeKind2) { // Disallow mixing vector and tensor. diff --git a/mlir/lib/Dialect/VectorOps/VectorTransforms.cpp b/mlir/lib/Dialect/VectorOps/VectorTransforms.cpp index c4d3e9d993d..64cacb28720 100644 --- a/mlir/lib/Dialect/VectorOps/VectorTransforms.cpp +++ b/mlir/lib/Dialect/VectorOps/VectorTransforms.cpp @@ -513,11 +513,11 @@ Value *mlir::vector::unrollSingleResultOpMatchingType( // Generates slices of 'vectorType' according to 'sizes' and 'strides, and // calls 'fn' with linear index and indices for each slice. -static void generateTransferOpSlices( - VectorType vectorType, TupleType tupleType, ArrayRef<int64_t> sizes, - ArrayRef<int64_t> strides, ArrayRef<Value *> indices, - PatternRewriter &rewriter, - llvm::function_ref<void(unsigned, ArrayRef<Value *>)> fn) { +static void +generateTransferOpSlices(VectorType vectorType, TupleType tupleType, + ArrayRef<int64_t> sizes, ArrayRef<int64_t> strides, + ArrayRef<Value *> indices, PatternRewriter &rewriter, + function_ref<void(unsigned, ArrayRef<Value *>)> fn) { // Compute strides w.r.t. to slice counts in each dimension. auto maybeDimSliceCounts = shapeRatio(vectorType.getShape(), sizes); assert(maybeDimSliceCounts.hasValue()); |

