diff --git a/mlir/docs/Diagnostics.md b/mlir/docs/Diagnostics.md --- a/mlir/docs/Diagnostics.md +++ b/mlir/docs/Diagnostics.md @@ -155,7 +155,7 @@ example output is shown below: ```shell -test.mlir:3:3: error: 'module_terminator' op expects parent op 'module' +test.mlir:3:3: error: 'module_terminator' op expects parent op 'builtin.module' "module_terminator"() : () -> () ^ test.mlir:3:3: note: see current operation: "module_terminator"() : () -> () @@ -172,7 +172,7 @@ generated certain diagnostics. An example output is shown below: ```shell -test.mlir:3:3: error: 'module_terminator' op expects parent op 'module' +test.mlir:3:3: error: 'module_terminator' op expects parent op 'builtin.module' "module_terminator"() : () -> () ^ test.mlir:3:3: note: diagnostic emitted with trace: diff --git a/mlir/docs/PassManagement.md b/mlir/docs/PassManagement.md --- a/mlir/docs/PassManagement.md +++ b/mlir/docs/PassManagement.md @@ -343,7 +343,7 @@ // explicitly specific, the default is the builtin `module` operation. PassManager pm(ctx); // Note: We could also create the above `PassManager` this way. -PassManager pm(ctx, /*operationName=*/"module"); +PassManager pm(ctx, /*operationName=*/"builtin.module"); // Add a pass on the top-level module operation. pm.addPass(std::make_unique()); @@ -405,7 +405,7 @@ void MyModulePass::runOnOperation() { ModuleOp module = getOperation(); if (hasSomeSpecificProperty(module)) { - OpPassManager dynamicPM("module"); + OpPassManager dynamicPM("builtin.module"); ...; // Build the dynamic pipeline. if (failed(runPipeline(dynamicPM, module))) return signalPassFailure(); @@ -531,12 +531,12 @@ default view: ```shell -$ mlir-opt -pass-pipeline='func(my-pass,my-pass)' foo.mlir -pass-statistics +$ mlir-opt -pass-pipeline='builtin.func(my-pass,my-pass)' foo.mlir -pass-statistics ===-------------------------------------------------------------------------=== ... Pass statistics report ... ===-------------------------------------------------------------------------=== -'func' Pipeline +'builtin.func' Pipeline MyPass (S) 15 exampleStat - An example statistic VerifierPass @@ -550,7 +550,7 @@ together: ```shell -$ mlir-opt -pass-pipeline='func(my-pass, my-pass)' foo.mlir -pass-statistics -pass-statistics-display=list +$ mlir-opt -pass-pipeline='builtin.func(my-pass, my-pass)' foo.mlir -pass-statistics -pass-statistics-display=list ===-------------------------------------------------------------------------=== ... Pass statistics report ... @@ -656,7 +656,7 @@ * `op-name` * This corresponds to the mnemonic name of an operation to run passes on, - e.g. `func` or `module`. + e.g. `builtin.func` or `builtin.module`. * `pass-name` | `pass-pipeline-name` * This corresponds to the argument of a registered pass or pass pipeline, e.g. `cse` or `canonicalize`. @@ -675,7 +675,7 @@ Can also be specified as (via the `-pass-pipeline` flag): ```shell -$ mlir-opt foo.mlir -pass-pipeline='func(cse,canonicalize),convert-std-to-llvm{use-bare-ptr-memref-call-conv=1}' +$ mlir-opt foo.mlir -pass-pipeline='builtin.func(cse,canonicalize),convert-std-to-llvm{use-bare-ptr-memref-call-conv=1}' ``` In order to support round-tripping a pass to the textual representation using @@ -996,7 +996,7 @@ `-mlir-timing-display=list`. ```shell -$ mlir-opt foo.mlir -mlir-disable-threading -pass-pipeline='func(cse,canonicalize)' -convert-std-to-llvm -mlir-timing -mlir-timing-display=list +$ mlir-opt foo.mlir -mlir-disable-threading -pass-pipeline='builtin.func(cse,canonicalize)' -convert-std-to-llvm -mlir-timing -mlir-timing-display=list ===-------------------------------------------------------------------------=== ... Pass execution timing report ... @@ -1021,7 +1021,7 @@ invalidated and recomputed. This is the default display mode. ```shell -$ mlir-opt foo.mlir -mlir-disable-threading -pass-pipeline='func(cse,canonicalize)' -convert-std-to-llvm -mlir-timing +$ mlir-opt foo.mlir -mlir-disable-threading -pass-pipeline='builtin.func(cse,canonicalize)' -convert-std-to-llvm -mlir-timing ===-------------------------------------------------------------------------=== ... Pass execution timing report ... @@ -1029,7 +1029,7 @@ Total Execution Time: 0.0249 seconds ---Wall Time--- --- Name --- - 0.0058 ( 70.8%) 'func' Pipeline + 0.0058 ( 70.8%) 'builtin.func' Pipeline 0.0004 ( 4.3%) CSE 0.0002 ( 2.6%) (A) DominanceInfo 0.0004 ( 4.8%) VerifierPass @@ -1052,7 +1052,7 @@ cpu time. ```shell -$ mlir-opt foo.mlir -pass-pipeline='func(cse,canonicalize)' -convert-std-to-llvm -mlir-timing +$ mlir-opt foo.mlir -pass-pipeline='builtin.func(cse,canonicalize)' -convert-std-to-llvm -mlir-timing ===-------------------------------------------------------------------------=== ... Pass execution timing report ... @@ -1060,7 +1060,7 @@ Total Execution Time: 0.0078 seconds ---User Time--- ---Wall Time--- --- Name --- - 0.0177 ( 88.5%) 0.0057 ( 71.3%) 'func' Pipeline + 0.0177 ( 88.5%) 0.0057 ( 71.3%) 'builtin.func' Pipeline 0.0044 ( 22.0%) 0.0015 ( 18.9%) CSE 0.0029 ( 14.5%) 0.0012 ( 15.2%) (A) DominanceInfo 0.0038 ( 18.9%) 0.0015 ( 18.7%) VerifierPass @@ -1088,7 +1088,7 @@ * Print the IR before every pass in the pipeline. ```shell -$ mlir-opt foo.mlir -pass-pipeline='func(cse)' -print-ir-before=cse +$ mlir-opt foo.mlir -pass-pipeline='builtin.func(cse)' -print-ir-before=cse *** IR Dump Before CSE *** func @simple_constant() -> (i32, i32) { @@ -1104,7 +1104,7 @@ * Print the IR after every pass in the pipeline. ```shell -$ mlir-opt foo.mlir -pass-pipeline='func(cse)' -print-ir-after=cse +$ mlir-opt foo.mlir -pass-pipeline='builtin.func(cse)' -print-ir-after=cse *** IR Dump After CSE *** func @simple_constant() -> (i32, i32) { @@ -1125,7 +1125,7 @@ printing. ```shell -$ mlir-opt foo.mlir -pass-pipeline='func(cse,cse)' -print-ir-after=cse -print-ir-after-change +$ mlir-opt foo.mlir -pass-pipeline='builtin.func(cse,cse)' -print-ir-after=cse -print-ir-after-change *** IR Dump After CSE *** func @simple_constant() -> (i32, i32) { @@ -1140,7 +1140,7 @@ above. ```shell -$ mlir-opt foo.mlir -pass-pipeline='func(cse,bad-pass)' -print-ir-failure +$ mlir-opt foo.mlir -pass-pipeline='builtin.func(cse,bad-pass)' -print-ir-failure *** IR Dump After BadPass Failed *** func @simple_constant() -> (i32, i32) { @@ -1156,9 +1156,9 @@ is disabled(`-mlir-disable-threading`) ```shell -$ mlir-opt foo.mlir -mlir-disable-threading -pass-pipeline='func(cse)' -print-ir-after=cse -print-ir-module-scope +$ mlir-opt foo.mlir -mlir-disable-threading -pass-pipeline='builtin.func(cse)' -print-ir-after=cse -print-ir-module-scope -*** IR Dump After CSE *** ('func' operation: @bar) +*** IR Dump After CSE *** ('builtin.func' operation: @bar) func @bar(%arg0: f32, %arg1: f32) -> f32 { ... } @@ -1169,7 +1169,7 @@ return %c1_i32, %c1_i32_0 : i32, i32 } -*** IR Dump After CSE *** ('func' operation: @simple_constant) +*** IR Dump After CSE *** ('builtin.func' operation: @simple_constant) func @bar(%arg0: f32, %arg1: f32) -> f32 { ... } @@ -1193,7 +1193,7 @@ reproducible may have the form: ```mlir -// configuration: -pass-pipeline='func(cse,canonicalize),inline' -verify-each +// configuration: -pass-pipeline='builtin.func(cse,canonicalize),inline' -verify-each module { func @foo() { @@ -1228,7 +1228,7 @@ the following reproducer will be generated: ```mlir -// configuration: -pass-pipeline='func(canonicalize)' -verify-each -mlir-disable-threading +// configuration: -pass-pipeline='builtin.func(canonicalize)' -verify-each -mlir-disable-threading module { func @foo() { diff --git a/mlir/docs/SymbolsAndSymbolTables.md b/mlir/docs/SymbolsAndSymbolTables.md --- a/mlir/docs/SymbolsAndSymbolTables.md +++ b/mlir/docs/SymbolsAndSymbolTables.md @@ -31,16 +31,16 @@ within the parent `SymbolTable`. This name is semantically similarly to an SSA result value, and may be referred to by other operations to provide a symbolic link, or use, to the symbol. An example of a `Symbol` operation is -[`func`](Dialects/Builtin.md/#func-mlirfuncop). `func` defines a symbol name, which is -[referred to](#referencing-a-symbol) by operations like +[`builtin.func`](Dialects/Builtin.md/#func-mlirfuncop). `builtin.func` defines a +symbol name, which is [referred to](#referencing-a-symbol) by operations like [`std.call`](Dialects/Standard.md/#stdcall-callop). ### Defining or declaring a Symbol A `Symbol` operation should use the `SymbolOpInterface` interface to provide the -necessary verification and accessors; it also supports -operations, such as `module`, that conditionally define a symbol. `Symbol`s must -have the following properties: +necessary verification and accessors; it also supports operations, such as +`builtin.module`, that conditionally define a symbol. `Symbol`s must have the +following properties: * A `StringAttr` attribute named 'SymbolTable::getSymbolAttrName()'(`sym_name`). @@ -77,7 +77,7 @@ Below is an example of how an operation can reference a symbol operation: ```mlir -// This `func` operation defines a symbol named `symbol`. +// This `builtin.func` operation defines a symbol named `symbol`. func @symbol() // Our `foo.user` operation contains a SymbolRefAttr with the name of the @@ -106,7 +106,7 @@ // Here we define another nested symbol table, except this time it also defines // a symbol. module @module_symbol { - // This `func` operation defines a symbol named `nested_symbol`. + // This `builtin.func` operation defines a symbol named `nested_symbol`. func @nested_symbol() } diff --git a/mlir/docs/Tutorials/UnderstandingTheIRStructure.md b/mlir/docs/Tutorials/UnderstandingTheIRStructure.md --- a/mlir/docs/Tutorials/UnderstandingTheIRStructure.md +++ b/mlir/docs/Tutorials/UnderstandingTheIRStructure.md @@ -96,7 +96,7 @@ llvm-project/mlir/test/IR/print-ir-nesting.mlir`: ```mlir -"module"() ( { +"builtin.module"() ( { %0:4 = "dialect.op1"() {"attribute name" = 42 : i32} : () -> (i1, i16, i32, i64) "dialect.op2"() ( { "dialect.innerop1"(%0#0, %0#1) : (i1, i16) -> () @@ -116,7 +116,7 @@ And will yield the following output: ``` -visiting op: 'module' with 0 operands and 0 results +visiting op: 'builtin.module' with 0 operands and 0 results 1 nested regions: Region with 1 blocks: Block with 0 arguments, 0 successors, and 3 operations diff --git a/mlir/include/mlir/IR/BuiltinDialect.td b/mlir/include/mlir/IR/BuiltinDialect.td --- a/mlir/include/mlir/IR/BuiltinDialect.td +++ b/mlir/include/mlir/IR/BuiltinDialect.td @@ -20,7 +20,7 @@ let summary = "A dialect containing the builtin Attributes, Operations, and Types"; - let name = ""; + let name = "builtin"; let cppNamespace = "::mlir"; let extraClassDeclaration = [{ private: diff --git a/mlir/include/mlir/IR/Dialect.h b/mlir/include/mlir/IR/Dialect.h --- a/mlir/include/mlir/IR/Dialect.h +++ b/mlir/include/mlir/IR/Dialect.h @@ -294,7 +294,7 @@ using InterfaceMapTy = DenseMap; public: - explicit DialectRegistry() {} + explicit DialectRegistry(); template void insert() { @@ -367,8 +367,7 @@ void addOpInterface() { StringRef opName = OpTy::getOperationName(); StringRef dialectName = opName.split('.').first; - addObjectInterface(dialectName == opName ? "" : dialectName, - ModelTy::Interface::getInterfaceID(), + addObjectInterface(dialectName, ModelTy::Interface::getInterfaceID(), [](MLIRContext *context) { OpTy::template attachInterface(*context); }); diff --git a/mlir/include/mlir/Pass/PassManager.h b/mlir/include/mlir/Pass/PassManager.h --- a/mlir/include/mlir/Pass/PassManager.h +++ b/mlir/include/mlir/Pass/PassManager.h @@ -172,7 +172,7 @@ /// style. The created pass manager can schedule operations that match /// `operationName`. PassManager(MLIRContext *ctx, Nesting nesting = Nesting::Explicit, - StringRef operationName = "module"); + StringRef operationName = "builtin.module"); PassManager(MLIRContext *ctx, StringRef operationName) : PassManager(ctx, Nesting::Explicit, operationName) {} ~PassManager(); diff --git a/mlir/include/mlir/Transforms/LoopUtils.h b/mlir/include/mlir/Transforms/LoopUtils.h --- a/mlir/include/mlir/Transforms/LoopUtils.h +++ b/mlir/include/mlir/Transforms/LoopUtils.h @@ -278,7 +278,7 @@ void mapLoopToProcessorIds(scf::ForOp forOp, ArrayRef processorId, ArrayRef numProcessors); -/// Gathers all AffineForOps in 'func' grouped by loop depth. +/// Gathers all AffineForOps in 'builtin.func' grouped by loop depth. void gatherLoops(FuncOp func, std::vector> &depthToLoops); diff --git a/mlir/lib/IR/BuiltinDialect.cpp b/mlir/lib/IR/BuiltinDialect.cpp --- a/mlir/lib/IR/BuiltinDialect.cpp +++ b/mlir/lib/IR/BuiltinDialect.cpp @@ -76,8 +76,8 @@ FuncOp FuncOp::create(Location location, StringRef name, FunctionType type, ArrayRef attrs) { - OperationState state(location, "func"); OpBuilder builder(location->getContext()); + OperationState state(location, getOperationName()); FuncOp::build(builder, state, name, type, attrs); return cast(Operation::create(state)); } diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp --- a/mlir/lib/IR/BuiltinTypes.cpp +++ b/mlir/lib/IR/BuiltinTypes.cpp @@ -452,7 +452,7 @@ // element type within that dialect. return type.isa() || - !type.getDialect().getNamespace().empty(); + !llvm::isa(type.getDialect()); } //===----------------------------------------------------------------------===// diff --git a/mlir/lib/IR/Dialect.cpp b/mlir/lib/IR/Dialect.cpp --- a/mlir/lib/IR/Dialect.cpp +++ b/mlir/lib/IR/Dialect.cpp @@ -30,6 +30,8 @@ // DialectRegistry //===----------------------------------------------------------------------===// +DialectRegistry::DialectRegistry() { insert(); } + void DialectRegistry::addDialectInterface( StringRef dialectName, TypeID interfaceTypeID, DialectInterfaceAllocatorFunction allocator) { @@ -59,19 +61,11 @@ StringRef dialectName, TypeID interfaceTypeID, ObjectInterfaceAllocatorFunction allocator) { assert(allocator && "unexpected null interface allocation function"); + auto it = registry.find(dialectName.str()); + assert(it != registry.end() && + "adding an interface for an op from an unregistered dialect"); - // Builtin dialect has an empty prefix and is always registered. - TypeID dialectTypeID; - if (!dialectName.empty()) { - auto it = registry.find(dialectName.str()); - assert(it != registry.end() && - "adding an interface for an op from an unregistered dialect"); - dialectTypeID = it->second.first; - } else { - dialectTypeID = TypeID::get(); - } - - auto &ifaces = interfaces[dialectTypeID]; + auto &ifaces = interfaces[it->second.first]; for (const auto &kvp : ifaces.objectInterfaces) { if (kvp.first == interfaceTypeID) { LLVM_DEBUG(llvm::dbgs() @@ -185,8 +179,6 @@ /// Utility function that returns if the given string is a valid dialect /// namespace. bool Dialect::isValidNamespace(StringRef str) { - if (str.empty()) - return true; llvm::Regex dialectNameRegex("^[a-zA-Z_][a-zA-Z_0-9\\$]*$"); return dialectNameRegex.match(str); } diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp --- a/mlir/lib/IR/Operation.cpp +++ b/mlir/lib/IR/Operation.cpp @@ -38,13 +38,12 @@ StringRef OperationName::getDialectNamespace() const { if (Dialect *dialect = getDialect()) return dialect->getNamespace(); - return representation.get().strref().split('.').first; + return getStringRef().split('.').first; } /// Return the operation name with dialect name stripped, if it has one. StringRef OperationName::stripDialect() const { - auto splitName = getStringRef().split("."); - return splitName.second.empty() ? splitName.first : splitName.second; + return getStringRef().split('.').second; } /// Return the name of this operation. This always succeeds. diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -1857,16 +1857,17 @@ if (!dialect && (dialect = getContext()->getOrLoadDialect(dialectName))) opDefinition = AbstractOperation::lookup(opName, getContext()); } else { - // If the operation name has no namespace prefix we treat it as a standard - // operation and prefix it with "std". - // TODO: Would it be better to just build a mapping of the registered - // operations in the standard dialect? - if (getContext()->getOrLoadDialect("std")) { + // If the operation name has no namespace prefix we treat it as a builtin + // or standard operation and prefix it with "builtin" or "std". + // TODO: Remove the special casing here. + opDefinition = AbstractOperation::lookup(Twine("builtin." + opName).str(), + getContext()); + if (!opDefinition && getContext()->getOrLoadDialect("std")) { opDefinition = AbstractOperation::lookup(Twine("std." + opName).str(), getContext()); - if (opDefinition) - opName = opDefinition->name.strref(); } + if (opDefinition) + opName = opDefinition->name.strref(); } } diff --git a/mlir/lib/Pass/PassRegistry.cpp b/mlir/lib/Pass/PassRegistry.cpp --- a/mlir/lib/Pass/PassRegistry.cpp +++ b/mlir/lib/Pass/PassRegistry.cpp @@ -271,9 +271,9 @@ /// /// A pipeline is defined as a series of names, each of which may in itself /// recursively contain a nested pipeline. A name is either the name of a pass - /// (e.g. "cse") or the name of an operation type (e.g. "func"). If the name - /// is the name of a pass, the InnerPipeline is empty, since passes cannot - /// contain inner pipelines. + /// (e.g. "cse") or the name of an operation type (e.g. "builtin.func"). If + /// the name is the name of a pass, the InnerPipeline is empty, since passes + /// cannot contain inner pipelines. struct PipelineElement { PipelineElement(StringRef name) : name(name), registryEntry(nullptr) {} diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp --- a/mlir/lib/Transforms/Utils/LoopUtils.cpp +++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp @@ -2936,7 +2936,7 @@ } } -/// Gathers all AffineForOps in 'func' grouped by loop depth. +/// Gathers all AffineForOps in 'builtin.func' grouped by loop depth. void mlir::gatherLoops(FuncOp func, std::vector> &depthToLoops) { for (auto &block : func) diff --git a/mlir/test/Analysis/test-alias-analysis-modref.mlir b/mlir/test/Analysis/test-alias-analysis-modref.mlir --- a/mlir/test/Analysis/test-alias-analysis-modref.mlir +++ b/mlir/test/Analysis/test-alias-analysis-modref.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='func(test-alias-analysis-modref)' -split-input-file -allow-unregistered-dialect 2>&1 | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(test-alias-analysis-modref)' -split-input-file -allow-unregistered-dialect 2>&1 | FileCheck %s // CHECK-LABEL: Testing : "no_side_effects" // CHECK: alloc -> func.region0#0: NoModRef diff --git a/mlir/test/Analysis/test-alias-analysis.mlir b/mlir/test/Analysis/test-alias-analysis.mlir --- a/mlir/test/Analysis/test-alias-analysis.mlir +++ b/mlir/test/Analysis/test-alias-analysis.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='func(test-alias-analysis)' -split-input-file -allow-unregistered-dialect 2>&1 | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(test-alias-analysis)' -split-input-file -allow-unregistered-dialect 2>&1 | FileCheck %s // CHECK-LABEL: Testing : "simple" // CHECK-DAG: func.region0#0 <-> func.region0#1: MayAlias diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c --- a/mlir/test/CAPI/ir.c +++ b/mlir/test/CAPI/ir.c @@ -97,8 +97,8 @@ mlirNamedAttributeGet( mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("sym_name")), funcNameAttr)}; - MlirOperationState funcState = - mlirOperationStateGet(mlirStringRefCreateFromCString("func"), location); + MlirOperationState funcState = mlirOperationStateGet( + mlirStringRefCreateFromCString("builtin.func"), location); mlirOperationStateAddAttributes(&funcState, 2, funcAttrs); mlirOperationStateAddOwnedRegions(&funcState, 1, &funcBodyRegion); MlirOperation func = mlirOperationCreate(&funcState); diff --git a/mlir/test/CAPI/pass.c b/mlir/test/CAPI/pass.c --- a/mlir/test/CAPI/pass.c +++ b/mlir/test/CAPI/pass.c @@ -41,7 +41,7 @@ // Run the print-op-stats pass on the top-level module: // CHECK-LABEL: Operations encountered: - // CHECK: func , 1 + // CHECK: builtin.func , 1 // CHECK: std.addi , 1 // CHECK: std.return , 1 { @@ -83,13 +83,13 @@ // Run the print-op-stats pass on functions under the top-level module: // CHECK-LABEL: Operations encountered: - // CHECK: func , 1 + // CHECK: builtin.func , 1 // CHECK: std.addi , 1 // CHECK: std.return , 1 { MlirPassManager pm = mlirPassManagerCreate(ctx); MlirOpPassManager nestedFuncPm = mlirPassManagerGetNestedUnder( - pm, mlirStringRefCreateFromCString("func")); + pm, mlirStringRefCreateFromCString("builtin.func")); MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats(); mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass); MlirLogicalResult success = mlirPassManagerRun(pm, module); @@ -99,15 +99,15 @@ } // Run the print-op-stats pass on functions under the nested module: // CHECK-LABEL: Operations encountered: - // CHECK: func , 1 + // CHECK: builtin.func , 1 // CHECK: std.addf , 1 // CHECK: std.return , 1 { MlirPassManager pm = mlirPassManagerCreate(ctx); MlirOpPassManager nestedModulePm = mlirPassManagerGetNestedUnder( - pm, mlirStringRefCreateFromCString("module")); + pm, mlirStringRefCreateFromCString("builtin.module")); MlirOpPassManager nestedFuncPm = mlirOpPassManagerGetNestedUnder( - nestedModulePm, mlirStringRefCreateFromCString("func")); + nestedModulePm, mlirStringRefCreateFromCString("builtin.func")); MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats(); mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass); MlirLogicalResult success = mlirPassManagerRun(pm, module); @@ -130,21 +130,21 @@ MlirPassManager pm = mlirPassManagerCreate(ctx); // Populate the pass-manager MlirOpPassManager nestedModulePm = mlirPassManagerGetNestedUnder( - pm, mlirStringRefCreateFromCString("module")); + pm, mlirStringRefCreateFromCString("builtin.module")); MlirOpPassManager nestedFuncPm = mlirOpPassManagerGetNestedUnder( - nestedModulePm, mlirStringRefCreateFromCString("func")); + nestedModulePm, mlirStringRefCreateFromCString("builtin.func")); MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats(); mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass); // Print the top level pass manager - // CHECK: Top-level: module(func(print-op-stats)) + // CHECK: Top-level: builtin.module(builtin.func(print-op-stats)) fprintf(stderr, "Top-level: "); mlirPrintPassPipeline(mlirPassManagerGetAsOpPassManager(pm), printToStderr, NULL); fprintf(stderr, "\n"); // Print the pipeline nested one level down - // CHECK: Nested Module: func(print-op-stats) + // CHECK: Nested Module: builtin.func(print-op-stats) fprintf(stderr, "Nested Module: "); mlirPrintPassPipeline(nestedModulePm, printToStderr, NULL); fprintf(stderr, "\n"); @@ -166,7 +166,7 @@ MlirLogicalResult status = mlirParsePassPipeline( mlirPassManagerGetAsOpPassManager(pm), mlirStringRefCreateFromCString( - "module(func(print-op-stats), func(print-op-stats))")); + "builtin.module(builtin.func(print-op-stats), builtin.func(print-op-stats))")); // Expect a failure, we haven't registered the print-op-stats pass yet. if (mlirLogicalResultIsSuccess(status)) { fprintf(stderr, "Unexpected success parsing pipeline without registering the pass\n"); @@ -177,14 +177,14 @@ status = mlirParsePassPipeline( mlirPassManagerGetAsOpPassManager(pm), mlirStringRefCreateFromCString( - "module(func(print-op-stats), func(print-op-stats))")); + "builtin.module(builtin.func(print-op-stats), builtin.func(print-op-stats))")); // Expect a failure, we haven't registered the print-op-stats pass yet. if (mlirLogicalResultIsFailure(status)) { fprintf(stderr, "Unexpected failure parsing pipeline after registering the pass\n"); exit(EXIT_FAILURE); } - // CHECK: Round-trip: module(func(print-op-stats), func(print-op-stats)) + // CHECK: Round-trip: builtin.module(builtin.func(print-op-stats), builtin.func(print-op-stats)) fprintf(stderr, "Round-trip: "); mlirPrintPassPipeline(mlirPassManagerGetAsOpPassManager(pm), printToStderr, NULL); diff --git a/mlir/test/Dialect/Affine/canonicalize.mlir b/mlir/test/Dialect/Affine/canonicalize.mlir --- a/mlir/test/Dialect/Affine/canonicalize.mlir +++ b/mlir/test/Dialect/Affine/canonicalize.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -pass-pipeline='func(canonicalize)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -pass-pipeline='builtin.func(canonicalize)' | FileCheck %s // ----- diff --git a/mlir/test/Dialect/Builtin/invalid.mlir b/mlir/test/Dialect/Builtin/invalid.mlir --- a/mlir/test/Dialect/Builtin/invalid.mlir +++ b/mlir/test/Dialect/Builtin/invalid.mlir @@ -5,7 +5,7 @@ //===----------------------------------------------------------------------===// // expected-error@+1 {{expected at least one result for cast operation}} -"unrealized_conversion_cast"() : () -> () +"builtin.unrealized_conversion_cast"() : () -> () // ----- diff --git a/mlir/test/Dialect/LLVMIR/terminator.mlir b/mlir/test/Dialect/LLVMIR/terminator.mlir --- a/mlir/test/Dialect/LLVMIR/terminator.mlir +++ b/mlir/test/Dialect/LLVMIR/terminator.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -pass-pipeline='func(canonicalize)' %s | FileCheck %s +// RUN: mlir-opt -pass-pipeline='builtin.func(canonicalize)' %s | FileCheck %s // verify that terminators survive the canonicalizer // CHECK-LABEL: @return diff --git a/mlir/test/Dialect/Linalg/fusion-sequence.mlir b/mlir/test/Dialect/Linalg/fusion-sequence.mlir --- a/mlir/test/Dialect/Linalg/fusion-sequence.mlir +++ b/mlir/test/Dialect/Linalg/fusion-sequence.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -pass-pipeline="func(test-linalg-tile-and-fuse{tile-sizes=16,32,64}),resolve-shaped-type-result-dims,canonicalize,cse" -split-input-file %s | FileCheck %s +// RUN: mlir-opt -pass-pipeline="builtin.func(test-linalg-tile-and-fuse{tile-sizes=16,32,64}),resolve-shaped-type-result-dims,canonicalize,cse" -split-input-file %s | FileCheck %s module { func @three_op_fusion(%arg0: memref, %arg1: memref, diff --git a/mlir/test/Dialect/Quant/canonicalize.mlir b/mlir/test/Dialect/Quant/canonicalize.mlir --- a/mlir/test/Dialect/Quant/canonicalize.mlir +++ b/mlir/test/Dialect/Quant/canonicalize.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -pass-pipeline='func(canonicalize)' | FileCheck %s +// RUN: mlir-opt %s -split-input-file -pass-pipeline='builtin.func(canonicalize)' | FileCheck %s // ----- // CHECK-LABEL: redundant_scast diff --git a/mlir/test/Dialect/SCF/canonicalize.mlir b/mlir/test/Dialect/SCF/canonicalize.mlir --- a/mlir/test/Dialect/SCF/canonicalize.mlir +++ b/mlir/test/Dialect/SCF/canonicalize.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='func(canonicalize)' -split-input-file | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(canonicalize)' -split-input-file | FileCheck %s // ----- diff --git a/mlir/test/Dialect/SCF/loop-range.mlir b/mlir/test/Dialect/SCF/loop-range.mlir --- a/mlir/test/Dialect/SCF/loop-range.mlir +++ b/mlir/test/Dialect/SCF/loop-range.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='func(for-loop-range-folding)' -split-input-file | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(for-loop-range-folding)' -split-input-file | FileCheck %s func @fold_one_loop(%arg0: memref, %arg1: index, %arg2: index) { %c0 = constant 0 : index diff --git a/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir b/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir --- a/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir +++ b/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(parallel-loop-fusion)' -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(parallel-loop-fusion)' -split-input-file | FileCheck %s func @fuse_empty_loops() { %c2 = constant 2 : index diff --git a/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir b/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir --- a/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir +++ b/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='func(parallel-loop-tiling{parallel-loop-tile-sizes=1,4})' -split-input-file | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(parallel-loop-tiling{parallel-loop-tile-sizes=1,4})' -split-input-file | FileCheck %s func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, diff --git a/mlir/test/Dialect/SPIRV/Transforms/canonicalize.mlir b/mlir/test/Dialect/SPIRV/Transforms/canonicalize.mlir --- a/mlir/test/Dialect/SPIRV/Transforms/canonicalize.mlir +++ b/mlir/test/Dialect/SPIRV/Transforms/canonicalize.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -pass-pipeline='func(canonicalize)' | FileCheck %s +// RUN: mlir-opt %s -split-input-file -pass-pipeline='builtin.func(canonicalize)' | FileCheck %s //===----------------------------------------------------------------------===// // spv.AccessChain diff --git a/mlir/test/Dialect/Standard/canonicalize-cf.mlir b/mlir/test/Dialect/Standard/canonicalize-cf.mlir --- a/mlir/test/Dialect/Standard/canonicalize-cf.mlir +++ b/mlir/test/Dialect/Standard/canonicalize-cf.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -allow-unregistered-dialect -pass-pipeline='func(canonicalize)' -split-input-file | FileCheck --dump-input-context 20 %s +// RUN: mlir-opt %s -allow-unregistered-dialect -pass-pipeline='builtin.func(canonicalize)' -split-input-file | FileCheck --dump-input-context 20 %s /// Test the folding of BranchOp. diff --git a/mlir/test/Dialect/Vector/canonicalize.mlir b/mlir/test/Dialect/Vector/canonicalize.mlir --- a/mlir/test/Dialect/Vector/canonicalize.mlir +++ b/mlir/test/Dialect/Vector/canonicalize.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='func(canonicalize)' -split-input-file -allow-unregistered-dialect | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(canonicalize)' -split-input-file -allow-unregistered-dialect | FileCheck %s // ----- diff --git a/mlir/test/IR/invalid-ops.mlir b/mlir/test/IR/invalid-ops.mlir --- a/mlir/test/IR/invalid-ops.mlir +++ b/mlir/test/IR/invalid-ops.mlir @@ -815,7 +815,7 @@ func @return_not_in_function() { "foo.region"() ({ - // expected-error@+1 {{'std.return' op expects parent op 'func'}} + // expected-error@+1 {{'std.return' op expects parent op 'builtin.func'}} return }): () -> () return diff --git a/mlir/test/IR/print-ir-defuse.mlir b/mlir/test/IR/print-ir-defuse.mlir --- a/mlir/test/IR/print-ir-defuse.mlir +++ b/mlir/test/IR/print-ir-defuse.mlir @@ -18,7 +18,7 @@ // CHECK: Has 0 results: // CHECK: Visiting op 'dialect.op3' with 0 operands: // CHECK: Has 0 results: -// CHECK: Visiting op 'module' with 0 operands: +// CHECK: Visiting op 'builtin.module' with 0 operands: // CHECK: Has 0 results: %results:4 = "dialect.op1"() : () -> (i1, i16, i32, i64) diff --git a/mlir/test/IR/print-ir-nesting.mlir b/mlir/test/IR/print-ir-nesting.mlir --- a/mlir/test/IR/print-ir-nesting.mlir +++ b/mlir/test/IR/print-ir-nesting.mlir @@ -1,6 +1,6 @@ // RUN: mlir-opt -test-print-nesting -allow-unregistered-dialect %s | FileCheck %s -// CHECK: visiting op: 'module' with 0 operands and 0 results +// CHECK: visiting op: 'builtin.module' with 0 operands and 0 results // CHECK: 1 nested regions: // CHECK: Region with 1 blocks: // CHECK: Block with 0 arguments, 0 successors, and 2 operations diff --git a/mlir/test/IR/print-op-on-diagnostic.mlir b/mlir/test/IR/print-op-on-diagnostic.mlir --- a/mlir/test/IR/print-op-on-diagnostic.mlir +++ b/mlir/test/IR/print-op-on-diagnostic.mlir @@ -3,5 +3,5 @@ // This file tests the functionality of 'mlir-print-op-on-diagnostic'. // CHECK: {{invalid to use 'test.invalid_attr'}} -// CHECK: {{see current operation: "module"()}} +// CHECK: {{see current operation: "builtin.module"()}} module attributes {test.invalid_attr} {} diff --git a/mlir/test/IR/visitors.mlir b/mlir/test/IR/visitors.mlir --- a/mlir/test/IR/visitors.mlir +++ b/mlir/test/IR/visitors.mlir @@ -22,8 +22,8 @@ } // CHECK-LABEL: Op pre-order visit -// CHECK: Visiting op 'module' -// CHECK: Visiting op 'func' +// CHECK: Visiting op 'builtin.module' +// CHECK: Visiting op 'builtin.func' // CHECK: Visiting op 'scf.for' // CHECK: Visiting op 'use0' // CHECK: Visiting op 'scf.if' @@ -33,15 +33,15 @@ // CHECK: Visiting op 'std.return' // CHECK-LABEL: Block pre-order visits -// CHECK: Visiting block ^bb0 from region 0 from operation 'module' -// CHECK: Visiting block ^bb0 from region 0 from operation 'func' +// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.module' +// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.func' // CHECK: Visiting block ^bb0 from region 0 from operation 'scf.for' // CHECK: Visiting block ^bb0 from region 0 from operation 'scf.if' // CHECK: Visiting block ^bb0 from region 1 from operation 'scf.if' // CHECK-LABEL: Region pre-order visits -// CHECK: Visiting region 0 from operation 'module' -// CHECK: Visiting region 0 from operation 'func' +// CHECK: Visiting region 0 from operation 'builtin.module' +// CHECK: Visiting region 0 from operation 'builtin.func' // CHECK: Visiting region 0 from operation 'scf.for' // CHECK: Visiting region 0 from operation 'scf.if' // CHECK: Visiting region 1 from operation 'scf.if' @@ -54,22 +54,22 @@ // CHECK: Visiting op 'use3' // CHECK: Visiting op 'scf.for' // CHECK: Visiting op 'std.return' -// CHECK: Visiting op 'func' -// CHECK: Visiting op 'module' +// CHECK: Visiting op 'builtin.func' +// CHECK: Visiting op 'builtin.module' // CHECK-LABEL: Block post-order visits // CHECK: Visiting block ^bb0 from region 0 from operation 'scf.if' // CHECK: Visiting block ^bb0 from region 1 from operation 'scf.if' // CHECK: Visiting block ^bb0 from region 0 from operation 'scf.for' -// CHECK: Visiting block ^bb0 from region 0 from operation 'func' -// CHECK: Visiting block ^bb0 from region 0 from operation 'module' +// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.func' +// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.module' // CHECK-LABEL: Region post-order visits // CHECK: Visiting region 0 from operation 'scf.if' // CHECK: Visiting region 1 from operation 'scf.if' // CHECK: Visiting region 0 from operation 'scf.for' -// CHECK: Visiting region 0 from operation 'func' -// CHECK: Visiting region 0 from operation 'module' +// CHECK: Visiting region 0 from operation 'builtin.func' +// CHECK: Visiting region 0 from operation 'builtin.module' // CHECK-LABEL: Op pre-order erasures // CHECK: Erasing op 'scf.for' @@ -100,15 +100,15 @@ // CHECK: Erasing op 'use3' // CHECK: Erasing op 'scf.for' // CHECK: Erasing op 'std.return' -// CHECK: Erasing op 'func' -// CHECK: Erasing op 'module' +// CHECK: Erasing op 'builtin.func' +// CHECK: Erasing op 'builtin.module' // CHECK-LABEL: Block post-order erasures (no skip) // CHECK: Erasing block ^bb0 from region 0 from operation 'scf.if' // CHECK: Erasing block ^bb0 from region 1 from operation 'scf.if' // CHECK: Erasing block ^bb0 from region 0 from operation 'scf.for' -// CHECK: Erasing block ^bb0 from region 0 from operation 'func' -// CHECK: Erasing block ^bb0 from region 0 from operation 'module' +// CHECK: Erasing block ^bb0 from region 0 from operation 'builtin.func' +// CHECK: Erasing block ^bb0 from region 0 from operation 'builtin.module' // ----- @@ -127,8 +127,8 @@ } // CHECK-LABEL: Op pre-order visits -// CHECK: Visiting op 'module' -// CHECK: Visiting op 'func' +// CHECK: Visiting op 'builtin.module' +// CHECK: Visiting op 'builtin.func' // CHECK: Visiting op 'regionOp0' // CHECK: Visiting op 'op0' // CHECK: Visiting op 'std.br' @@ -138,15 +138,15 @@ // CHECK: Visiting op 'std.return' // CHECK-LABEL: Block pre-order visits -// CHECK: Visiting block ^bb0 from region 0 from operation 'module' -// CHECK: Visiting block ^bb0 from region 0 from operation 'func' +// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.module' +// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.func' // CHECK: Visiting block ^bb0 from region 0 from operation 'regionOp0' // CHECK: Visiting block ^bb1 from region 0 from operation 'regionOp0' // CHECK: Visiting block ^bb2 from region 0 from operation 'regionOp0' // CHECK-LABEL: Region pre-order visits -// CHECK: Visiting region 0 from operation 'module' -// CHECK: Visiting region 0 from operation 'func' +// CHECK: Visiting region 0 from operation 'builtin.module' +// CHECK: Visiting region 0 from operation 'builtin.func' // CHECK: Visiting region 0 from operation 'regionOp0' // CHECK-LABEL: Op post-order visits @@ -157,20 +157,20 @@ // CHECK: Visiting op 'op2' // CHECK: Visiting op 'regionOp0' // CHECK: Visiting op 'std.return' -// CHECK: Visiting op 'func' -// CHECK: Visiting op 'module' +// CHECK: Visiting op 'builtin.func' +// CHECK: Visiting op 'builtin.module' // CHECK-LABEL: Block post-order visits // CHECK: Visiting block ^bb0 from region 0 from operation 'regionOp0' // CHECK: Visiting block ^bb1 from region 0 from operation 'regionOp0' // CHECK: Visiting block ^bb2 from region 0 from operation 'regionOp0' -// CHECK: Visiting block ^bb0 from region 0 from operation 'func' -// CHECK: Visiting block ^bb0 from region 0 from operation 'module' +// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.func' +// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.module' // CHECK-LABEL: Region post-order visits // CHECK: Visiting region 0 from operation 'regionOp0' -// CHECK: Visiting region 0 from operation 'func' -// CHECK: Visiting region 0 from operation 'module' +// CHECK: Visiting region 0 from operation 'builtin.func' +// CHECK: Visiting region 0 from operation 'builtin.module' // CHECK-LABEL: Op pre-order erasures (skip) // CHECK: Erasing op 'regionOp0' @@ -208,5 +208,5 @@ // CHECK: Erasing block ^bb0 from region 0 from operation 'regionOp0' // CHECK: Erasing block ^bb0 from region 0 from operation 'regionOp0' // CHECK: Erasing block ^bb0 from region 0 from operation 'regionOp0' -// CHECK: Erasing block ^bb0 from region 0 from operation 'func' -// CHECK: Erasing block ^bb0 from region 0 from operation 'module' +// CHECK: Erasing block ^bb0 from region 0 from operation 'builtin.func' +// CHECK: Erasing block ^bb0 from region 0 from operation 'builtin.module' diff --git a/mlir/test/IR/wrapping_op.mlir b/mlir/test/IR/wrapping_op.mlir --- a/mlir/test/IR/wrapping_op.mlir +++ b/mlir/test/IR/wrapping_op.mlir @@ -2,7 +2,7 @@ // RUN: mlir-opt -allow-unregistered-dialect -mlir-print-op-generic -mlir-print-debuginfo -mlir-print-local-scope %s | FileCheck %s --check-prefix=CHECK-GENERIC // CHECK-LABEL: func @wrapping_op -// CHECK-GENERIC: "func" +// CHECK-GENERIC: "builtin.func" func @wrapping_op(%arg0 : i32, %arg1 : f32) -> (i3, i2, i1) { // CHECK: %0:3 = test.wrapping_region wraps "some.op"(%arg1, %arg0) {test.attr = "attr"} : (f32, i32) -> (i1, i2, i3) // CHECK-GENERIC: "test.wrapping_region"() ( { diff --git a/mlir/test/Pass/crash-recovery.mlir b/mlir/test/Pass/crash-recovery.mlir --- a/mlir/test/Pass/crash-recovery.mlir +++ b/mlir/test/Pass/crash-recovery.mlir @@ -1,6 +1,6 @@ -// RUN: mlir-opt %s -pass-pipeline='module(test-module-pass, test-pass-crash)' -pass-pipeline-crash-reproducer=%t -verify-diagnostics +// RUN: mlir-opt %s -pass-pipeline='builtin.module(test-module-pass, test-pass-crash)' -pass-pipeline-crash-reproducer=%t -verify-diagnostics // RUN: cat %t | FileCheck -check-prefix=REPRO %s -// RUN: mlir-opt %s -pass-pipeline='module(test-module-pass, test-pass-crash)' -pass-pipeline-crash-reproducer=%t -verify-diagnostics -pass-pipeline-local-reproducer -mlir-disable-threading +// RUN: mlir-opt %s -pass-pipeline='builtin.module(test-module-pass, test-pass-crash)' -pass-pipeline-crash-reproducer=%t -verify-diagnostics -pass-pipeline-local-reproducer -mlir-disable-threading // RUN: cat %t | FileCheck -check-prefix=REPRO_LOCAL %s // Check that we correctly handle verifiers passes with local reproducer, this used to crash. @@ -17,17 +17,17 @@ module @foo {} } -// REPRO: configuration: -pass-pipeline='module(test-module-pass, test-pass-crash)' +// REPRO: configuration: -pass-pipeline='builtin.module(test-module-pass, test-pass-crash)' // REPRO: module @inner_mod1 // REPRO: module @foo { -// REPRO_LOCAL: configuration: -pass-pipeline='module(test-pass-crash)' +// REPRO_LOCAL: configuration: -pass-pipeline='builtin.module(test-pass-crash)' // REPRO_LOCAL: module @inner_mod1 // REPRO_LOCAL: module @foo { -// REPRO_LOCAL_DYNAMIC: configuration: -pass-pipeline='module(test-pass-crash)' +// REPRO_LOCAL_DYNAMIC: configuration: -pass-pipeline='builtin.module(test-pass-crash)' // REPRO_LOCAL_DYNAMIC: module @inner_mod1 // REPRO_LOCAL_DYNAMIC: module @foo { diff --git a/mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir b/mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir --- a/mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir +++ b/mlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir @@ -1,8 +1,8 @@ -// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{op-name=inner_mod1 run-on-parent=1 dynamic-pipeline=test-patterns})' -split-input-file -verify-diagnostics +// RUN: mlir-opt %s -pass-pipeline='builtin.module(test-dynamic-pipeline{op-name=inner_mod1 run-on-parent=1 dynamic-pipeline=test-patterns})' -split-input-file -verify-diagnostics // Verify that we fail to schedule a dynamic pipeline on the parent operation. -// expected-error @+1 {{'module' op Trying to schedule a dynamic pipeline on an operation that isn't nested under the current operation}} +// expected-error @+1 {{'builtin.module' op Trying to schedule a dynamic pipeline on an operation that isn't nested under the current operation}} module { module @inner_mod1 { "test.symbol"() {sym_name = "foo"} : () -> () diff --git a/mlir/test/Pass/dynamic-pipeline-nested.mlir b/mlir/test/Pass/dynamic-pipeline-nested.mlir --- a/mlir/test/Pass/dynamic-pipeline-nested.mlir +++ b/mlir/test/Pass/dynamic-pipeline-nested.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{op-name=inner_mod1 dynamic-pipeline=cse})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=NOTNESTED --check-prefix=CHECK -// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{op-name=inner_mod1 run-on-nested-operations=1 dynamic-pipeline=cse})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=NESTED --check-prefix=CHECK +// RUN: mlir-opt %s -pass-pipeline='builtin.module(test-dynamic-pipeline{op-name=inner_mod1 dynamic-pipeline=cse})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=NOTNESTED --check-prefix=CHECK +// RUN: mlir-opt %s -pass-pipeline='builtin.module(test-dynamic-pipeline{op-name=inner_mod1 run-on-nested-operations=1 dynamic-pipeline=cse})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=NESTED --check-prefix=CHECK // Verify that we can schedule a dynamic pipeline on a nested operation diff --git a/mlir/test/Pass/dynamic-pipeline.mlir b/mlir/test/Pass/dynamic-pipeline.mlir --- a/mlir/test/Pass/dynamic-pipeline.mlir +++ b/mlir/test/Pass/dynamic-pipeline.mlir @@ -1,7 +1,7 @@ -// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{op-name=inner_mod1, dynamic-pipeline=func(cse,canonicalize)})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD1 --check-prefix=MOD1-ONLY --check-prefix=CHECK -// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{op-name=inner_mod2, dynamic-pipeline=func(cse,canonicalize)})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD2 --check-prefix=MOD2-ONLY --check-prefix=CHECK -// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{op-name=inner_mod1,inner_mod2, dynamic-pipeline=func(cse,canonicalize)})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD1 --check-prefix=MOD2 --check-prefix=CHECK -// RUN: mlir-opt %s -pass-pipeline='module(test-dynamic-pipeline{dynamic-pipeline=func(cse,canonicalize)})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD1 --check-prefix=MOD2 --check-prefix=CHECK +// RUN: mlir-opt %s -pass-pipeline='builtin.module(test-dynamic-pipeline{op-name=inner_mod1, dynamic-pipeline=builtin.func(cse,canonicalize)})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD1 --check-prefix=MOD1-ONLY --check-prefix=CHECK +// RUN: mlir-opt %s -pass-pipeline='builtin.module(test-dynamic-pipeline{op-name=inner_mod2, dynamic-pipeline=builtin.func(cse,canonicalize)})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD2 --check-prefix=MOD2-ONLY --check-prefix=CHECK +// RUN: mlir-opt %s -pass-pipeline='builtin.module(test-dynamic-pipeline{op-name=inner_mod1,inner_mod2, dynamic-pipeline=builtin.func(cse,canonicalize)})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD1 --check-prefix=MOD2 --check-prefix=CHECK +// RUN: mlir-opt %s -pass-pipeline='builtin.module(test-dynamic-pipeline{dynamic-pipeline=builtin.func(cse,canonicalize)})' --mlir-disable-threading -print-ir-before-all 2>&1 | FileCheck %s --check-prefix=MOD1 --check-prefix=MOD2 --check-prefix=CHECK func @f() { diff --git a/mlir/test/Pass/invalid-pass.mlir b/mlir/test/Pass/invalid-pass.mlir --- a/mlir/test/Pass/invalid-pass.mlir +++ b/mlir/test/Pass/invalid-pass.mlir @@ -1,6 +1,6 @@ -// RUN: not mlir-opt %s -pass-pipeline='module(test-module-pass{test-option=a})' 2>&1 | FileCheck %s +// RUN: not mlir-opt %s -pass-pipeline='builtin.module(test-module-pass{test-option=a})' 2>&1 | FileCheck %s // CHECK: : no such option test-option // CHECK: failed to add `test-module-pass` with options `test-option=a` -// CHECK: failed to add `module` with options `` to inner pipeline +// CHECK: failed to add `builtin.module` with options `` to inner pipeline module {} diff --git a/mlir/test/Pass/ir-printing.mlir b/mlir/test/Pass/ir-printing.mlir --- a/mlir/test/Pass/ir-printing.mlir +++ b/mlir/test/Pass/ir-printing.mlir @@ -1,10 +1,10 @@ -// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='func(cse,canonicalize)' -print-ir-before=cse -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE %s -// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='func(cse,canonicalize)' -print-ir-before-all -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE_ALL %s -// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='func(cse,canonicalize)' -print-ir-after=cse -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER %s -// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='func(cse,canonicalize)' -print-ir-after-all -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER_ALL %s -// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='func(cse,canonicalize)' -print-ir-before=cse -print-ir-module-scope -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE_MODULE %s -// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='func(cse,cse)' -print-ir-after-all -print-ir-after-change -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER_ALL_CHANGE %s -// RUN: not mlir-opt %s -mlir-disable-threading=true -pass-pipeline='func(cse,test-pass-failure)' -print-ir-after-failure -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER_FAILURE %s +// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='builtin.func(cse,canonicalize)' -print-ir-before=cse -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE %s +// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='builtin.func(cse,canonicalize)' -print-ir-before-all -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE_ALL %s +// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='builtin.func(cse,canonicalize)' -print-ir-after=cse -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER %s +// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='builtin.func(cse,canonicalize)' -print-ir-after-all -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER_ALL %s +// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='builtin.func(cse,canonicalize)' -print-ir-before=cse -print-ir-module-scope -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE_MODULE %s +// RUN: mlir-opt %s -mlir-disable-threading=true -pass-pipeline='builtin.func(cse,cse)' -print-ir-after-all -print-ir-after-change -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER_ALL_CHANGE %s +// RUN: not mlir-opt %s -mlir-disable-threading=true -pass-pipeline='builtin.func(cse,test-pass-failure)' -print-ir-after-failure -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER_FAILURE %s func @foo() { %0 = constant 0 : i32 @@ -49,10 +49,10 @@ // AFTER_ALL: // -----// IR Dump After{{.*}}Canonicalizer //----- // // AFTER_ALL-NEXT: func @bar() -// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSE ('func' operation: @foo) //----- // +// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSE ('builtin.func' operation: @foo) //----- // // BEFORE_MODULE: func @foo() // BEFORE_MODULE: func @bar() -// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSE ('func' operation: @bar) //----- // +// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSE ('builtin.func' operation: @bar) //----- // // BEFORE_MODULE: func @foo() // BEFORE_MODULE: func @bar() diff --git a/mlir/test/Pass/pass-timing.mlir b/mlir/test/Pass/pass-timing.mlir --- a/mlir/test/Pass/pass-timing.mlir +++ b/mlir/test/Pass/pass-timing.mlir @@ -1,7 +1,7 @@ -// RUN: mlir-opt %s -mlir-disable-threading=true -verify-each=true -pass-pipeline='func(cse,canonicalize,cse)' -mlir-timing -mlir-timing-display=list 2>&1 | FileCheck -check-prefix=LIST %s -// RUN: mlir-opt %s -mlir-disable-threading=true -verify-each=true -pass-pipeline='func(cse,canonicalize,cse)' -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck -check-prefix=PIPELINE %s -// RUN: mlir-opt %s -mlir-disable-threading=false -verify-each=true -pass-pipeline='func(cse,canonicalize,cse)' -mlir-timing -mlir-timing-display=list 2>&1 | FileCheck -check-prefix=MT_LIST %s -// RUN: mlir-opt %s -mlir-disable-threading=false -verify-each=true -pass-pipeline='func(cse,canonicalize,cse)' -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck -check-prefix=MT_PIPELINE %s +// RUN: mlir-opt %s -mlir-disable-threading=true -verify-each=true -pass-pipeline='builtin.func(cse,canonicalize,cse)' -mlir-timing -mlir-timing-display=list 2>&1 | FileCheck -check-prefix=LIST %s +// RUN: mlir-opt %s -mlir-disable-threading=true -verify-each=true -pass-pipeline='builtin.func(cse,canonicalize,cse)' -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck -check-prefix=PIPELINE %s +// RUN: mlir-opt %s -mlir-disable-threading=false -verify-each=true -pass-pipeline='builtin.func(cse,canonicalize,cse)' -mlir-timing -mlir-timing-display=list 2>&1 | FileCheck -check-prefix=MT_LIST %s +// RUN: mlir-opt %s -mlir-disable-threading=false -verify-each=true -pass-pipeline='builtin.func(cse,canonicalize,cse)' -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck -check-prefix=MT_PIPELINE %s // RUN: mlir-opt %s -mlir-disable-threading=true -verify-each=false -test-pm-nested-pipeline -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck -check-prefix=NESTED_PIPELINE %s // LIST: Execution time report @@ -16,7 +16,7 @@ // PIPELINE: Total Execution Time: // PIPELINE: Name // PIPELINE-NEXT: Parser -// PIPELINE-NEXT: 'func' Pipeline +// PIPELINE-NEXT: 'builtin.func' Pipeline // PIPELINE-NEXT: CSE // PIPELINE-NEXT: (A) DominanceInfo // PIPELINE-NEXT: Canonicalizer @@ -38,7 +38,7 @@ // MT_PIPELINE: Total Execution Time: // MT_PIPELINE: Name // MT_PIPELINE-NEXT: Parser -// MT_PIPELINE-NEXT: 'func' Pipeline +// MT_PIPELINE-NEXT: 'builtin.func' Pipeline // MT_PIPELINE-NEXT: CSE // MT_PIPELINE-NEXT: (A) DominanceInfo // MT_PIPELINE-NEXT: Canonicalizer @@ -52,12 +52,12 @@ // NESTED_PIPELINE: Total Execution Time: // NESTED_PIPELINE: Name // NESTED_PIPELINE-NEXT: Parser -// NESTED_PIPELINE-NEXT: Pipeline Collection : ['func', 'module'] -// NESTED_PIPELINE-NEXT: 'func' Pipeline +// NESTED_PIPELINE-NEXT: Pipeline Collection : ['builtin.func', 'builtin.module'] +// NESTED_PIPELINE-NEXT: 'builtin.func' Pipeline // NESTED_PIPELINE-NEXT: TestFunctionPass -// NESTED_PIPELINE-NEXT: 'module' Pipeline +// NESTED_PIPELINE-NEXT: 'builtin.module' Pipeline // NESTED_PIPELINE-NEXT: TestModulePass -// NESTED_PIPELINE-NEXT: 'func' Pipeline +// NESTED_PIPELINE-NEXT: 'builtin.func' Pipeline // NESTED_PIPELINE-NEXT: TestFunctionPass // NESTED_PIPELINE-NEXT: Output // NESTED_PIPELINE-NEXT: Rest diff --git a/mlir/test/Pass/pipeline-options-parsing.mlir b/mlir/test/Pass/pipeline-options-parsing.mlir --- a/mlir/test/Pass/pipeline-options-parsing.mlir +++ b/mlir/test/Pass/pipeline-options-parsing.mlir @@ -1,11 +1,11 @@ -// RUN: not mlir-opt %s -pass-pipeline='module(test-module-pass{)' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_1 %s -// RUN: not mlir-opt %s -pass-pipeline='module(test-module-pass{test-option=3})' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_2 %s -// RUN: not mlir-opt %s -pass-pipeline='module(func(test-options-pass{list=3}), test-module-pass{invalid-option=3})' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_3 %s +// RUN: not mlir-opt %s -pass-pipeline='builtin.module(test-module-pass{)' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_1 %s +// RUN: not mlir-opt %s -pass-pipeline='builtin.module(test-module-pass{test-option=3})' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_2 %s +// RUN: not mlir-opt %s -pass-pipeline='builtin.module(builtin.func(test-options-pass{list=3}), test-module-pass{invalid-option=3})' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_3 %s // RUN: not mlir-opt %s -pass-pipeline='test-options-pass{list=3 list=notaninteger}' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_4 %s -// RUN: not mlir-opt %s -pass-pipeline='func(test-options-pass{list=1,2,3,4 list=5 string=value1 string=value2})' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_5 %s -// RUN: mlir-opt %s -verify-each=false -pass-pipeline='func(test-options-pass{string-list=a list=1,2,3,4 string-list=b,c list=5 string-list=d string=some_value})' -test-dump-pipeline 2>&1 | FileCheck --check-prefix=CHECK_1 %s +// RUN: not mlir-opt %s -pass-pipeline='builtin.func(test-options-pass{list=1,2,3,4 list=5 string=value1 string=value2})' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_5 %s +// RUN: mlir-opt %s -verify-each=false -pass-pipeline='builtin.func(test-options-pass{string-list=a list=1,2,3,4 string-list=b,c list=5 string-list=d string=some_value})' -test-dump-pipeline 2>&1 | FileCheck --check-prefix=CHECK_1 %s // RUN: mlir-opt %s -verify-each=false -test-options-pass-pipeline='list=1 string-list=a,b' -test-dump-pipeline 2>&1 | FileCheck --check-prefix=CHECK_2 %s -// RUN: mlir-opt %s -verify-each=false -pass-pipeline='module(func(test-options-pass{list=3}), func(test-options-pass{list=1,2,3,4}))' -test-dump-pipeline 2>&1 | FileCheck --check-prefix=CHECK_3 %s +// RUN: mlir-opt %s -verify-each=false -pass-pipeline='builtin.module(builtin.func(test-options-pass{list=3}), builtin.func(test-options-pass{list=1,2,3,4}))' -test-dump-pipeline 2>&1 | FileCheck --check-prefix=CHECK_3 %s // CHECK_ERROR_1: missing closing '}' while processing pass options // CHECK_ERROR_2: no such option test-option @@ -15,4 +15,4 @@ // CHECK_1: test-options-pass{list=1,2,3,4,5 string=some_value string-list=a,b,c,d} // CHECK_2: test-options-pass{list=1 string= string-list=a,b} -// CHECK_3: module(func(test-options-pass{list=3 string= }), func(test-options-pass{list=1,2,3,4 string= })) +// CHECK_3: builtin.module(builtin.func(test-options-pass{list=3 string= }), builtin.func(test-options-pass{list=1,2,3,4 string= })) diff --git a/mlir/test/Pass/pipeline-parsing.mlir b/mlir/test/Pass/pipeline-parsing.mlir --- a/mlir/test/Pass/pipeline-parsing.mlir +++ b/mlir/test/Pass/pipeline-parsing.mlir @@ -1,16 +1,16 @@ -// RUN: mlir-opt %s -mlir-disable-threading -pass-pipeline='module(test-module-pass,func(test-function-pass)),func(test-function-pass)' -pass-pipeline="func(cse,canonicalize)" -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck %s +// RUN: mlir-opt %s -mlir-disable-threading -pass-pipeline='builtin.module(test-module-pass,builtin.func(test-function-pass)),builtin.func(test-function-pass)' -pass-pipeline="builtin.func(cse,canonicalize)" -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck %s // RUN: mlir-opt %s -mlir-disable-threading -test-textual-pm-nested-pipeline -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 | FileCheck %s --check-prefix=TEXTUAL_CHECK -// RUN: not mlir-opt %s -pass-pipeline='module(test-module-pass' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_1 %s -// RUN: not mlir-opt %s -pass-pipeline='module(test-module-pass))' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_2 %s -// RUN: not mlir-opt %s -pass-pipeline='module()(' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_3 %s +// RUN: not mlir-opt %s -pass-pipeline='builtin.module(test-module-pass' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_1 %s +// RUN: not mlir-opt %s -pass-pipeline='builtin.module(test-module-pass))' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_2 %s +// RUN: not mlir-opt %s -pass-pipeline='builtin.module()(' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_3 %s // RUN: not mlir-opt %s -pass-pipeline=',' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_4 %s -// RUN: not mlir-opt %s -pass-pipeline='func(test-module-pass)' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_5 %s +// RUN: not mlir-opt %s -pass-pipeline='builtin.func(test-module-pass)' 2>&1 | FileCheck --check-prefix=CHECK_ERROR_5 %s // CHECK_ERROR_1: encountered unbalanced parentheses while parsing pipeline // CHECK_ERROR_2: encountered extra closing ')' creating unbalanced parentheses while parsing pipeline // CHECK_ERROR_3: expected ',' after parsing pipeline // CHECK_ERROR_4: does not refer to a registered pass or pass pipeline -// CHECK_ERROR_5: Can't add pass '{{.*}}TestModulePass' restricted to 'module' on a PassManager intended to run on 'func', did you intend to nest? +// CHECK_ERROR_5: Can't add pass '{{.*}}TestModulePass' restricted to 'builtin.module' on a PassManager intended to run on 'builtin.func', did you intend to nest? func @foo() { return } @@ -21,21 +21,21 @@ } } -// CHECK: Pipeline Collection : ['func', 'module'] -// CHECK-NEXT: 'func' Pipeline +// CHECK: Pipeline Collection : ['builtin.func', 'builtin.module'] +// CHECK-NEXT: 'builtin.func' Pipeline // CHECK-NEXT: TestFunctionPass // CHECK-NEXT: CSE // CHECK-NEXT: DominanceInfo // CHECK-NEXT: Canonicalizer -// CHECK-NEXT: 'module' Pipeline +// CHECK-NEXT: 'builtin.module' Pipeline // CHECK-NEXT: TestModulePass -// CHECK-NEXT: 'func' Pipeline +// CHECK-NEXT: 'builtin.func' Pipeline // CHECK-NEXT: TestFunctionPass -// TEXTUAL_CHECK: Pipeline Collection : ['func', 'module'] -// TEXTUAL_CHECK-NEXT: 'func' Pipeline +// TEXTUAL_CHECK: Pipeline Collection : ['builtin.func', 'builtin.module'] +// TEXTUAL_CHECK-NEXT: 'builtin.func' Pipeline // TEXTUAL_CHECK-NEXT: TestFunctionPass -// TEXTUAL_CHECK-NEXT: 'module' Pipeline +// TEXTUAL_CHECK-NEXT: 'builtin.module' Pipeline // TEXTUAL_CHECK-NEXT: TestModulePass -// TEXTUAL_CHECK-NEXT: 'func' Pipeline +// TEXTUAL_CHECK-NEXT: 'builtin.func' Pipeline // TEXTUAL_CHECK-NEXT: TestFunctionPass diff --git a/mlir/test/Pass/pipeline-stats.mlir b/mlir/test/Pass/pipeline-stats.mlir --- a/mlir/test/Pass/pipeline-stats.mlir +++ b/mlir/test/Pass/pipeline-stats.mlir @@ -1,6 +1,6 @@ // REQUIRES: asserts -// RUN: mlir-opt %s -verify-each=true -pass-pipeline='func(test-stats-pass,test-stats-pass)' -pass-statistics -pass-statistics-display=list 2>&1 | FileCheck -check-prefix=LIST %s -// RUN: mlir-opt %s -verify-each=true -pass-pipeline='func(test-stats-pass,test-stats-pass)' -pass-statistics -pass-statistics-display=pipeline 2>&1 | FileCheck -check-prefix=PIPELINE %s +// RUN: mlir-opt %s -verify-each=true -pass-pipeline='builtin.func(test-stats-pass,test-stats-pass)' -pass-statistics -pass-statistics-display=list 2>&1 | FileCheck -check-prefix=LIST %s +// RUN: mlir-opt %s -verify-each=true -pass-pipeline='builtin.func(test-stats-pass,test-stats-pass)' -pass-statistics -pass-statistics-display=pipeline 2>&1 | FileCheck -check-prefix=PIPELINE %s // LIST: Pass statistics report // LIST: TestStatisticPass @@ -8,7 +8,7 @@ // LIST-NOT: Verifier // PIPELINE: Pass statistics report -// PIPELINE: 'func' Pipeline +// PIPELINE: 'builtin.func' Pipeline // PIPELINE-NEXT: TestStatisticPass // PIPELINE-NEXT: (S) {{0|4}} num-ops - Number of operations counted // PIPELINE-NEXT: TestStatisticPass diff --git a/mlir/test/Pass/run-reproducer.mlir b/mlir/test/Pass/run-reproducer.mlir --- a/mlir/test/Pass/run-reproducer.mlir +++ b/mlir/test/Pass/run-reproducer.mlir @@ -1,4 +1,4 @@ -// configuration: -mlir-disable-threading=true -pass-pipeline='func(cse,canonicalize)' -print-ir-before=cse +// configuration: -mlir-disable-threading=true -pass-pipeline='builtin.func(cse,canonicalize)' -print-ir-before=cse // Test of the reproducer run option. The first line has to be the // configuration (matching what is produced by reproducer). diff --git a/mlir/test/Transforms/canonicalize-block-merge.mlir b/mlir/test/Transforms/canonicalize-block-merge.mlir --- a/mlir/test/Transforms/canonicalize-block-merge.mlir +++ b/mlir/test/Transforms/canonicalize-block-merge.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(canonicalize)' -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(canonicalize)' -split-input-file | FileCheck %s // Check the simple case of single operation blocks with a return. diff --git a/mlir/test/Transforms/canonicalize-dce.mlir b/mlir/test/Transforms/canonicalize-dce.mlir --- a/mlir/test/Transforms/canonicalize-dce.mlir +++ b/mlir/test/Transforms/canonicalize-dce.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -pass-pipeline='func(canonicalize)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -pass-pipeline='builtin.func(canonicalize)' | FileCheck %s // Test case: Simple case of deleting a dead pure op. diff --git a/mlir/test/Transforms/canonicalize-td.mlir b/mlir/test/Transforms/canonicalize-td.mlir --- a/mlir/test/Transforms/canonicalize-td.mlir +++ b/mlir/test/Transforms/canonicalize-td.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(canonicalize{top-down=true})' | FileCheck %s --check-prefix=TD -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(canonicalize)' | FileCheck %s --check-prefix=BU +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(canonicalize{top-down=true})' | FileCheck %s --check-prefix=TD +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(canonicalize)' | FileCheck %s --check-prefix=BU // BU-LABEL: func @default_insertion_position diff --git a/mlir/test/Transforms/canonicalize.mlir b/mlir/test/Transforms/canonicalize.mlir --- a/mlir/test/Transforms/canonicalize.mlir +++ b/mlir/test/Transforms/canonicalize.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(canonicalize)' -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(canonicalize)' -split-input-file | FileCheck %s // CHECK-LABEL: func @test_subi_zero func @test_subi_zero(%arg0: i32) -> i32 { diff --git a/mlir/test/Transforms/cse.mlir b/mlir/test/Transforms/cse.mlir --- a/mlir/test/Transforms/cse.mlir +++ b/mlir/test/Transforms/cse.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(cse)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(cse)' | FileCheck %s // CHECK-DAG: #[[$MAP:.*]] = affine_map<(d0) -> (d0 mod 2)> #map0 = affine_map<(d0) -> (d0 mod 2)> diff --git a/mlir/test/Transforms/parallel-loop-collapsing.mlir b/mlir/test/Transforms/parallel-loop-collapsing.mlir --- a/mlir/test/Transforms/parallel-loop-collapsing.mlir +++ b/mlir/test/Transforms/parallel-loop-collapsing.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(parallel-loop-collapsing{collapsed-indices-0=0,3 collapsed-indices-1=1,4 collapsed-indices-2=2}, canonicalize)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(parallel-loop-collapsing{collapsed-indices-0=0,3 collapsed-indices-1=1,4 collapsed-indices-2=2}, canonicalize)' | FileCheck %s // CHECK-LABEL: func @parallel_many_dims() { func @parallel_many_dims() { diff --git a/mlir/test/Transforms/sccp-callgraph.mlir b/mlir/test/Transforms/sccp-callgraph.mlir --- a/mlir/test/Transforms/sccp-callgraph.mlir +++ b/mlir/test/Transforms/sccp-callgraph.mlir @@ -1,5 +1,5 @@ // RUN: mlir-opt -allow-unregistered-dialect %s -sccp -split-input-file | FileCheck %s -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="module(sccp)" -split-input-file | FileCheck %s --check-prefix=NESTED +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="builtin.module(sccp)" -split-input-file | FileCheck %s --check-prefix=NESTED /// Check that a constant is properly propagated through the arguments and /// results of a private function. diff --git a/mlir/test/Transforms/sccp-structured.mlir b/mlir/test/Transforms/sccp-structured.mlir --- a/mlir/test/Transforms/sccp-structured.mlir +++ b/mlir/test/Transforms/sccp-structured.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="func(sccp)" -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="builtin.func(sccp)" -split-input-file | FileCheck %s /// Check that a constant is properly propagated when only one edge is taken. diff --git a/mlir/test/Transforms/sccp.mlir b/mlir/test/Transforms/sccp.mlir --- a/mlir/test/Transforms/sccp.mlir +++ b/mlir/test/Transforms/sccp.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="func(sccp)" -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="builtin.func(sccp)" -split-input-file | FileCheck %s /// Check simple forward constant propagation without any control flow. diff --git a/mlir/test/Transforms/single-parallel-loop-collapsing.mlir b/mlir/test/Transforms/single-parallel-loop-collapsing.mlir --- a/mlir/test/Transforms/single-parallel-loop-collapsing.mlir +++ b/mlir/test/Transforms/single-parallel-loop-collapsing.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(parallel-loop-collapsing{collapsed-indices-0=0,1}, canonicalize)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(parallel-loop-collapsing{collapsed-indices-0=0,1}, canonicalize)' | FileCheck %s func @collapse_to_single() { %c0 = constant 3 : index diff --git a/mlir/test/Transforms/test-canonicalize-filter.mlir b/mlir/test/Transforms/test-canonicalize-filter.mlir --- a/mlir/test/Transforms/test-canonicalize-filter.mlir +++ b/mlir/test/Transforms/test-canonicalize-filter.mlir @@ -1,6 +1,6 @@ -// RUN: mlir-opt %s -pass-pipeline='func(canonicalize)' | FileCheck %s --check-prefix=NO_FILTER -// RUN: mlir-opt %s -pass-pipeline='func(canonicalize{enable-patterns=TestRemoveOpWithInnerOps})' | FileCheck %s --check-prefix=FILTER_ENABLE -// RUN: mlir-opt %s -pass-pipeline='func(canonicalize{disable-patterns=TestRemoveOpWithInnerOps})' | FileCheck %s --check-prefix=FILTER_DISABLE +// RUN: mlir-opt %s -pass-pipeline='builtin.func(canonicalize)' | FileCheck %s --check-prefix=NO_FILTER +// RUN: mlir-opt %s -pass-pipeline='builtin.func(canonicalize{enable-patterns=TestRemoveOpWithInnerOps})' | FileCheck %s --check-prefix=FILTER_ENABLE +// RUN: mlir-opt %s -pass-pipeline='builtin.func(canonicalize{disable-patterns=TestRemoveOpWithInnerOps})' | FileCheck %s --check-prefix=FILTER_DISABLE // NO_FILTER-LABEL: func @remove_op_with_inner_ops_pattern // NO_FILTER-NEXT: return diff --git a/mlir/test/Transforms/test-canonicalize.mlir b/mlir/test/Transforms/test-canonicalize.mlir --- a/mlir/test/Transforms/test-canonicalize.mlir +++ b/mlir/test/Transforms/test-canonicalize.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='func(canonicalize)' | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(canonicalize)' | FileCheck %s // CHECK-LABEL: func @remove_op_with_inner_ops_pattern func @remove_op_with_inner_ops_pattern() { diff --git a/mlir/test/Transforms/test-legalizer-analysis.mlir b/mlir/test/Transforms/test-legalizer-analysis.mlir --- a/mlir/test/Transforms/test-legalizer-analysis.mlir +++ b/mlir/test/Transforms/test-legalizer-analysis.mlir @@ -1,7 +1,7 @@ // RUN: mlir-opt -allow-unregistered-dialect -test-legalize-patterns -verify-diagnostics -test-legalize-mode=analysis %s | FileCheck %s -// expected-remark@-2 {{op 'module' is legalizable}} +// expected-remark@-2 {{op 'builtin.module' is legalizable}} -// expected-remark@+1 {{op 'func' is legalizable}} +// expected-remark@+1 {{op 'builtin.func' is legalizable}} func @test(%arg0: f32) { // expected-remark@+1 {{op 'test.illegal_op_a' is legalizable}} %result = "test.illegal_op_a"() : () -> (i32) diff --git a/mlir/test/Transforms/test-symbol-dce.mlir b/mlir/test/Transforms/test-symbol-dce.mlir --- a/mlir/test/Transforms/test-symbol-dce.mlir +++ b/mlir/test/Transforms/test-symbol-dce.mlir @@ -1,5 +1,5 @@ // RUN: mlir-opt -allow-unregistered-dialect %s -symbol-dce -split-input-file -verify-diagnostics | FileCheck %s -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="module(symbol-dce)" -split-input-file | FileCheck %s --check-prefix=NESTED +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline="builtin.module(symbol-dce)" -split-input-file | FileCheck %s --check-prefix=NESTED // Check that trivially dead and trivially live non-nested cases are handled. diff --git a/mlir/test/mlir-lsp-server/diagnostics.test b/mlir/test/mlir-lsp-server/diagnostics.test --- a/mlir/test/mlir-lsp-server/diagnostics.test +++ b/mlir/test/mlir-lsp-server/diagnostics.test @@ -12,7 +12,7 @@ // CHECK-NEXT: "diagnostics": [ // CHECK-NEXT: { // CHECK-NEXT: "category": "Parse Error", -// CHECK-NEXT: "message": "custom op 'func' expected valid '@'-identifier for symbol name", +// CHECK-NEXT: "message": "custom op 'builtin.func' expected valid '@'-identifier for symbol name", // CHECK-NEXT: "range": { // CHECK-NEXT: "end": { // CHECK-NEXT: "character": 7, diff --git a/mlir/test/mlir-lsp-server/document-symbols.test b/mlir/test/mlir-lsp-server/document-symbols.test --- a/mlir/test/mlir-lsp-server/document-symbols.test +++ b/mlir/test/mlir-lsp-server/document-symbols.test @@ -42,7 +42,7 @@ // CHECK-NEXT: } // CHECK-NEXT: ], // CHECK-NEXT: "kind": 3, -// CHECK-NEXT: "name": "", +// CHECK-NEXT: "name": "", // CHECK-NEXT: "range": { // CHECK-NEXT: "end": { // CHECK-NEXT: "character": {{.*}}, diff --git a/mlir/test/mlir-lsp-server/hover.test b/mlir/test/mlir-lsp-server/hover.test --- a/mlir/test/mlir-lsp-server/hover.test +++ b/mlir/test/mlir-lsp-server/hover.test @@ -66,7 +66,7 @@ // CHECK-NEXT: "result": { // CHECK-NEXT: "contents": { // CHECK-NEXT: "kind": "markdown", -// CHECK-NEXT: "value": "Operation: \"func\"\n\nBlock #1\n\nPredecessors: \n\n" +// CHECK-NEXT: "value": "Operation: \"builtin.func\"\n\nBlock #1\n\nPredecessors: \n\n" // CHECK-NEXT: }, // CHECK-NEXT: "range": { // CHECK-NEXT: "end": { @@ -90,7 +90,7 @@ // CHECK-NEXT: "result": { // CHECK-NEXT: "contents": { // CHECK-NEXT: "kind": "markdown", -// CHECK-NEXT: "value": "Operation: \"func\"\n\nBlock: \n\nArgument #0\n\nType: `i1`\n\n" +// CHECK-NEXT: "value": "Operation: \"builtin.func\"\n\nBlock: \n\nArgument #0\n\nType: `i1`\n\n" // CHECK-NEXT: }, // CHECK-NEXT: "range": { // CHECK-NEXT: "end": { @@ -114,7 +114,7 @@ // CHECK-NEXT: "result": { // CHECK-NEXT: "contents": { // CHECK-NEXT: "kind": "markdown", -// CHECK-NEXT: "value": "\"func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"func\"() ( {\n}) {sym_name = \"foo\", type = (i1) -> ()} : () -> ()\n```\n" +// CHECK-NEXT: "value": "\"builtin.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"builtin.func\"() ( {\n}) {sym_name = \"foo\", type = (i1) -> ()} : () -> ()\n```\n" // CHECK-NEXT: }, // CHECK-NEXT: "range": { // CHECK-NEXT: "end": { @@ -138,7 +138,7 @@ // CHECK-NEXT: "result": { // CHECK-NEXT: "contents": { // CHECK-NEXT: "kind": "markdown", -// CHECK-NEXT: "value": "\"func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"func\"() ( {\n}) {sym_name = \"foo\", type = (i1) -> ()} : () -> ()\n```\n" +// CHECK-NEXT: "value": "\"builtin.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"builtin.func\"() ( {\n}) {sym_name = \"foo\", type = (i1) -> ()} : () -> ()\n```\n" // CHECK-NEXT: }, // CHECK-NEXT: "range": { // CHECK-NEXT: "end": { diff --git a/mlir/test/mlir-opt/commandline.mlir b/mlir/test/mlir-opt/commandline.mlir --- a/mlir/test/mlir-opt/commandline.mlir +++ b/mlir/test/mlir-opt/commandline.mlir @@ -6,6 +6,7 @@ // CHECK-NEXT: arm_neon // CHECK-NEXT: arm_sve // CHECK-NEXT: async +// CHECK-NEXT: builtin // CHECK-NEXT: complex // CHECK-NEXT: dlti // CHECK-NEXT: emitc diff --git a/mlir/test/python/dialects/linalg/opsrun.py b/mlir/test/python/dialects/linalg/opsrun.py --- a/mlir/test/python/dialects/linalg/opsrun.py +++ b/mlir/test/python/dialects/linalg/opsrun.py @@ -115,9 +115,9 @@ mod = Module.parse( str(module.operation.regions[0].blocks[0].operations[0].operation) + boilerplate) - pm = PassManager.parse("func(convert-linalg-to-loops, lower-affine, " + - "convert-scf-to-std), convert-vector-to-llvm," + - "convert-std-to-llvm") + pm = PassManager.parse( + "builtin.func(convert-linalg-to-loops, lower-affine, " + + "convert-scf-to-std), convert-vector-to-llvm," + "convert-std-to-llvm") pm.run(mod) return mod diff --git a/mlir/test/python/ir/operation.py b/mlir/test/python/ir/operation.py --- a/mlir/test/python/ir/operation.py +++ b/mlir/test/python/ir/operation.py @@ -580,7 +580,7 @@ def testPrintInvalidOperation(): ctx = Context() with Location.unknown(ctx): - module = Operation.create("module", regions=2) + module = Operation.create("builtin.module", regions=2) # This module has two region and is invalid verify that we fallback # to the generic printer for safety. block = module.regions[0].blocks.append() @@ -598,22 +598,22 @@ ctx = Context() with Location.unknown(ctx): try: - Operation.create("module", attributes={None:StringAttr.get("name")}) + Operation.create("builtin.module", attributes={None:StringAttr.get("name")}) except Exception as e: # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module" print(e) try: - Operation.create("module", attributes={42:StringAttr.get("name")}) + Operation.create("builtin.module", attributes={42:StringAttr.get("name")}) except Exception as e: # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module" print(e) try: - Operation.create("module", attributes={"some_key":ctx}) + Operation.create("builtin.module", attributes={"some_key":ctx}) except Exception as e: # CHECK: Invalid attribute value for the key "some_key" when attempting to create the operation "module" print(e) try: - Operation.create("module", attributes={"some_key":None}) + Operation.create("builtin.module", attributes={"some_key":None}) except Exception as e: # CHECK: Found an invalid (`None`?) attribute value for the key "some_key" when attempting to create the operation "module" print(e) diff --git a/mlir/test/python/pass_manager.py b/mlir/test/python/pass_manager.py --- a/mlir/test/python/pass_manager.py +++ b/mlir/test/python/pass_manager.py @@ -36,19 +36,19 @@ # A first import is expected to fail because the pass isn't registered # until we import mlir.transforms try: - pm = PassManager.parse("module(func(print-op-stats))") + pm = PassManager.parse("builtin.module(builtin.func(print-op-stats))") # TODO: this error should be propagate to Python but the C API does not help right now. # CHECK: error: 'print-op-stats' does not refer to a registered pass or pass pipeline except ValueError as e: - # CHECK: ValueError exception: invalid pass pipeline 'module(func(print-op-stats))'. + # CHECK: ValueError exception: invalid pass pipeline 'builtin.module(builtin.func(print-op-stats))'. log("ValueError exception:", e) else: log("Exception not produced") # This will register the pass and round-trip should be possible now. import mlir.transforms - pm = PassManager.parse("module(func(print-op-stats))") - # CHECK: Roundtrip: module(func(print-op-stats)) + pm = PassManager.parse("builtin.module(builtin.func(print-op-stats))") + # CHECK: Roundtrip: builtin.module(builtin.func(print-op-stats)) log("Roundtrip: ", pm) run(testParseSuccess) @@ -71,10 +71,10 @@ def testInvalidNesting(): with Context(): try: - pm = PassManager.parse("func(view-op-graph)") + pm = PassManager.parse("builtin.func(view-op-graph)") except ValueError as e: - # CHECK: Can't add pass 'ViewOpGraphPass' restricted to 'module' on a PassManager intended to run on 'func', did you intend to nest? - # CHECK: ValueError exception: invalid pass pipeline 'func(view-op-graph)'. + # CHECK: Can't add pass 'ViewOpGraphPass' restricted to 'builtin.module' on a PassManager intended to run on 'builtin.func', did you intend to nest? + # CHECK: ValueError exception: invalid pass pipeline 'builtin.func(view-op-graph)'. log("ValueError exception:", e) else: log("Exception not produced") @@ -89,7 +89,7 @@ module = Module.parse(r"""func @successfulParse() { return }""") pm.run(module) # CHECK: Operations encountered: -# CHECK: func , 1 -# CHECK: module , 1 +# CHECK: builtin.func , 1 +# CHECK: builtin.module , 1 # CHECK: std.return , 1 run(testRunPipeline) diff --git a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp --- a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp +++ b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp @@ -724,9 +724,6 @@ os << llvm::formatv(fileHeader, clDialectName.getValue()); os << llvm::formatv(dialectClassTemplate, clDialectName.getValue()); - if (clDialectName == "builtin") - clDialectName = ""; - for (const llvm::Record *rec : records.getAllDerivedDefinitions("Op")) { Operator op(rec); if (op.getDialectName() == clDialectName.getValue()) diff --git a/mlir/unittests/IR/InterfaceAttachmentTest.cpp b/mlir/unittests/IR/InterfaceAttachmentTest.cpp --- a/mlir/unittests/IR/InterfaceAttachmentTest.cpp +++ b/mlir/unittests/IR/InterfaceAttachmentTest.cpp @@ -298,10 +298,10 @@ ModuleOp::attachInterface(context); auto iface = dyn_cast(moduleOp.getOperation()); ASSERT_TRUE(iface != nullptr); - EXPECT_EQ(iface.getNameLengthPlusArg(10), 16u); - EXPECT_EQ(iface.getNameLengthTimesArg(3), 18u); - EXPECT_EQ(iface.getNameLengthPlusArgTwice(18), 42u); - EXPECT_EQ(iface.getNameLengthMinusArg(5), 1u); + EXPECT_EQ(iface.getNameLengthPlusArg(10), 24u); + EXPECT_EQ(iface.getNameLengthTimesArg(3), 42u); + EXPECT_EQ(iface.getNameLengthPlusArgTwice(18), 50u); + EXPECT_EQ(iface.getNameLengthMinusArg(5), 9u); // Default implementation can be overridden. auto funcOp = FuncOp::create(UnknownLoc::get(&context), "function", @@ -310,9 +310,9 @@ FuncOp::attachInterface(context); iface = dyn_cast(funcOp.getOperation()); ASSERT_TRUE(iface != nullptr); - EXPECT_EQ(iface.getNameLengthPlusArg(10), 14u); + EXPECT_EQ(iface.getNameLengthPlusArg(10), 22u); EXPECT_EQ(iface.getNameLengthTimesArg(0), 42u); - EXPECT_EQ(iface.getNameLengthPlusArgTwice(8), 20u); + EXPECT_EQ(iface.getNameLengthPlusArgTwice(8), 28u); EXPECT_EQ(iface.getNameLengthMinusArg(1000), 21u); // Another context doesn't have the interfaces registered.