diff --git a/mlir/include/mlir/IR/MLIRContext.h b/mlir/include/mlir/IR/MLIRContext.h --- a/mlir/include/mlir/IR/MLIRContext.h +++ b/mlir/include/mlir/IR/MLIRContext.h @@ -49,6 +49,12 @@ return static_cast(getRegisteredDialect(T::getDialectNamespace())); } + /// Return true if we allow to create operation for unregistered dialects. + bool isAllowingUnregisteredDialect(); + + /// Enables creating operations in unregistered dialects. + void setAllowingUnregisteredDialect(bool allowing = true); + /// Return information about all registered operations. This isn't very /// efficient: typically you should ask the operations about their properties /// directly. diff --git a/mlir/include/mlir/Support/MlirOptMain.h b/mlir/include/mlir/Support/MlirOptMain.h --- a/mlir/include/mlir/Support/MlirOptMain.h +++ b/mlir/include/mlir/Support/MlirOptMain.h @@ -26,6 +26,6 @@ std::unique_ptr buffer, const PassPipelineCLParser &passPipeline, bool splitInputFile, bool verifyDiagnostics, - bool verifyPasses); + bool verifyPasses, bool allowUnregisteredDialect); } // end namespace mlir diff --git a/mlir/lib/Analysis/Verifier.cpp b/mlir/lib/Analysis/Verifier.cpp --- a/mlir/lib/Analysis/Verifier.cpp +++ b/mlir/lib/Analysis/Verifier.cpp @@ -187,6 +187,12 @@ if (opInfo) return success(); + if (!op.getContext()->isAllowingUnregisteredDialect() && !op.getDialect()) + return op.emitOpError() + << "created with unregistered dialect. If this is " + "intended, please call setAllowingUnregisteredDialect() on the " + "MLIRContext, or use -allow-unregistered-dialect with mlir-opt"; + // Otherwise, verify that the parent dialect allows un-registered operations. auto dialectPrefix = op.getName().getDialect(); diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -161,6 +161,15 @@ //===--------------------------------------------------------------------===// DiagnosticEngine diagEngine; + //===--------------------------------------------------------------------===// + // Options + //===--------------------------------------------------------------------===// + + // In most cases, creating operation in unregistered dialect is not desired + // and indicate a misconfiguration of the compiler. This option enables to + // detect such use cases + bool allowUnregisteredDialect = false; + //===--------------------------------------------------------------------===// // Other //===--------------------------------------------------------------------===// @@ -349,6 +358,14 @@ impl.dialects.insert(insertPt, std::move(dialect)); } +bool MLIRContext::isAllowingUnregisteredDialect() { + return impl->allowUnregisteredDialect; +} + +void MLIRContext::setAllowingUnregisteredDialect(bool allowing) { + impl->allowUnregisteredDialect = allowing; +} + /// Return information about all registered operations. This isn't very /// efficient, typically you should ask the operations about their properties /// directly. diff --git a/mlir/lib/Support/MlirOptMain.cpp b/mlir/lib/Support/MlirOptMain.cpp --- a/mlir/lib/Support/MlirOptMain.cpp +++ b/mlir/lib/Support/MlirOptMain.cpp @@ -67,6 +67,7 @@ static LogicalResult processBuffer(raw_ostream &os, std::unique_ptr ownedBuffer, bool verifyDiagnostics, bool verifyPasses, + bool allowUnregisteredDialect, const PassPipelineCLParser &passPipeline) { // Tell sourceMgr about this buffer, which is what the parser will pick up. SourceMgr sourceMgr; @@ -74,6 +75,8 @@ // Parse the input file. MLIRContext context; + if (allowUnregisteredDialect) + context.setAllowingUnregisteredDialect(); // If we are in verify diagnostics mode then we have a lot of work to do, // otherwise just perform the actions without worrying about it. @@ -100,7 +103,8 @@ std::unique_ptr buffer, const PassPipelineCLParser &passPipeline, bool splitInputFile, bool verifyDiagnostics, - bool verifyPasses) { + bool verifyPasses, + bool allowUnregisteredDialect) { // The split-input-file mode is a very specific mode that slices the file // up into small pieces and checks each independently. if (splitInputFile) @@ -108,10 +112,11 @@ std::move(buffer), [&](std::unique_ptr chunkBuffer, raw_ostream &os) { return processBuffer(os, std::move(chunkBuffer), verifyDiagnostics, - verifyPasses, passPipeline); + verifyPasses, allowUnregisteredDialect, + passPipeline); }, os); return processBuffer(os, std::move(buffer), verifyDiagnostics, verifyPasses, - passPipeline); + allowUnregisteredDialect, passPipeline); } diff --git a/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp b/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp --- a/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp +++ b/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp @@ -446,7 +446,7 @@ // We don't expect to see instructions in dominator order. If we haven't seen // this instruction yet, create an unknown op and remap it later. if (isa(value)) { - OperationState state(UnknownLoc::get(context), "unknown"); + OperationState state(UnknownLoc::get(context), "llvm.unknown"); LLVMType type = processType(value->getType()); if (!type) return nullptr; diff --git a/mlir/test/Conversion/GPUToCUDA/lower-launch-func-to-cuda.mlir b/mlir/test/Conversion/GPUToCUDA/lower-launch-func-to-cuda.mlir --- a/mlir/test/Conversion/GPUToCUDA/lower-launch-func-to-cuda.mlir +++ b/mlir/test/Conversion/GPUToCUDA/lower-launch-func-to-cuda.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s --launch-func-to-cuda | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s --launch-func-to-cuda | FileCheck %s module attributes {gpu.container_module} { diff --git a/mlir/test/Conversion/GPUToNVVM/memory-attrbution.mlir b/mlir/test/Conversion/GPUToNVVM/memory-attrbution.mlir --- a/mlir/test/Conversion/GPUToNVVM/memory-attrbution.mlir +++ b/mlir/test/Conversion/GPUToNVVM/memory-attrbution.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt --convert-gpu-to-nvvm --split-input-file %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect --convert-gpu-to-nvvm --split-input-file %s | FileCheck %s gpu.module @kernel { // CHECK-LABEL: llvm.func @private diff --git a/mlir/test/Conversion/GPUToSPIRV/simple.mlir b/mlir/test/Conversion/GPUToSPIRV/simple.mlir --- a/mlir/test/Conversion/GPUToSPIRV/simple.mlir +++ b/mlir/test/Conversion/GPUToSPIRV/simple.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics %s -o - | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -convert-gpu-to-spirv -verify-diagnostics %s -o - | FileCheck %s module attributes {gpu.container_module} { gpu.module @kernels { diff --git a/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir b/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir --- a/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir +++ b/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -convert-std-to-llvm -split-input-file -verify-diagnostics | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -convert-std-to-llvm -split-input-file -verify-diagnostics | FileCheck %s // CHECK-LABEL: func @address_space( // CHECK-SAME: !llvm<"float addrspace(7)*"> diff --git a/mlir/test/Conversion/StandardToSPIRV/std-to-spirv.mlir b/mlir/test/Conversion/StandardToSPIRV/std-to-spirv.mlir --- a/mlir/test/Conversion/StandardToSPIRV/std-to-spirv.mlir +++ b/mlir/test/Conversion/StandardToSPIRV/std-to-spirv.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -split-input-file -convert-std-to-spirv %s -o - | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -convert-std-to-spirv %s -o - | FileCheck %s //===----------------------------------------------------------------------===// // std arithmetic ops diff --git a/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir b/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir --- a/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -affine-super-vectorizer-test -compose-maps 2>&1 | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-super-vectorizer-test -compose-maps 2>&1 | FileCheck %s // For all these cases, the test traverses the `test_affine_map` ops and // composes them in order one-by-one. 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 %s -split-input-file -pass-pipeline='func(canonicalize)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -pass-pipeline='func(canonicalize)' | FileCheck %s // Affine maps for test case: compose_affine_maps_1dto2d_no_symbols // CHECK-DAG: [[MAP0:#map[0-9]+]] = affine_map<(d0) -> (d0 - 1)> diff --git a/mlir/test/Dialect/Affine/dma-generate.mlir b/mlir/test/Dialect/Affine/dma-generate.mlir --- a/mlir/test/Dialect/Affine/dma-generate.mlir +++ b/mlir/test/Dialect/Affine/dma-generate.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -split-input-file -affine-data-copy-generate -affine-data-copy-generate-dma -affine-data-copy-generate-fast-mem-space=2 -affine-data-copy-generate-skip-non-unit-stride-loops -verify-diagnostics | FileCheck %s -// RUN: mlir-opt %s -split-input-file -affine-data-copy-generate -affine-data-copy-generate-dma -affine-data-copy-generate-fast-mem-capacity=16 -affine-data-copy-generate-fast-mem-space=2 | FileCheck %s --check-prefix FAST-MEM-16KB +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-data-copy-generate -affine-data-copy-generate-dma -affine-data-copy-generate-fast-mem-space=2 -affine-data-copy-generate-skip-non-unit-stride-loops -verify-diagnostics | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-data-copy-generate -affine-data-copy-generate-dma -affine-data-copy-generate-fast-mem-capacity=16 -affine-data-copy-generate-fast-mem-space=2 | FileCheck %s --check-prefix FAST-MEM-16KB // We run most test cases with -copy-skip-non-unit-stride-loops to allow testing // DMA generation at inner levels easily - since the DMA generation would diff --git a/mlir/test/Dialect/Affine/inlining.mlir b/mlir/test/Dialect/Affine/inlining.mlir --- a/mlir/test/Dialect/Affine/inlining.mlir +++ b/mlir/test/Dialect/Affine/inlining.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -inline -mlir-disable-inline-simplify | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -inline -mlir-disable-inline-simplify | FileCheck %s // Basic test that functions within affine operations are inlined. func @func_with_affine_ops(%N: index) { diff --git a/mlir/test/Dialect/Affine/invalid.mlir b/mlir/test/Dialect/Affine/invalid.mlir --- a/mlir/test/Dialect/Affine/invalid.mlir +++ b/mlir/test/Dialect/Affine/invalid.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -verify-diagnostics +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics // ----- diff --git a/mlir/test/Dialect/Affine/loop-tiling.mlir b/mlir/test/Dialect/Affine/loop-tiling.mlir --- a/mlir/test/Dialect/Affine/loop-tiling.mlir +++ b/mlir/test/Dialect/Affine/loop-tiling.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -split-input-file -affine-loop-tile -affine-tile-size=32 | FileCheck %s -// RUN: mlir-opt %s -split-input-file -affine-loop-tile -affine-tile-cache-size=512 | FileCheck %s --check-prefix=MODEL +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-loop-tile -affine-tile-size=32 | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-loop-tile -affine-tile-cache-size=512 | FileCheck %s --check-prefix=MODEL // ----- diff --git a/mlir/test/Dialect/Affine/ops.mlir b/mlir/test/Dialect/Affine/ops.mlir --- a/mlir/test/Dialect/Affine/ops.mlir +++ b/mlir/test/Dialect/Affine/ops.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt -split-input-file %s | FileCheck %s -// RUN: mlir-opt %s -mlir-print-op-generic | FileCheck -check-prefix=GENERIC %s +// RUN: mlir-opt -allow-unregistered-dialect -split-input-file %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -mlir-print-op-generic | FileCheck -check-prefix=GENERIC %s // Check that the attributes for the affine operations are round-tripped. // Check that `affine.terminator` is visible in the generic form. diff --git a/mlir/test/Dialect/Affine/parallelism-detection.mlir b/mlir/test/Dialect/Affine/parallelism-detection.mlir --- a/mlir/test/Dialect/Affine/parallelism-detection.mlir +++ b/mlir/test/Dialect/Affine/parallelism-detection.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -test-detect-parallel -split-input-file -verify-diagnostics | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -test-detect-parallel -split-input-file -verify-diagnostics | FileCheck %s // CHECK-LABEL: func @loop_nest_3d_outer_two_parallel func @loop_nest_3d_outer_two_parallel(%N : index) { diff --git a/mlir/test/Dialect/Affine/simplify-affine-structures.mlir b/mlir/test/Dialect/Affine/simplify-affine-structures.mlir --- a/mlir/test/Dialect/Affine/simplify-affine-structures.mlir +++ b/mlir/test/Dialect/Affine/simplify-affine-structures.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -simplify-affine-structures | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -simplify-affine-structures | FileCheck %s // CHECK-DAG: [[SET_EMPTY_2D:#set[0-9]+]] = affine_set<(d0, d1) : (1 == 0)> // CHECK-DAG: #set1 = affine_set<(d0, d1) : (d0 - 100 == 0, d1 - 10 == 0, -d0 + 100 >= 0, d1 >= 0)> diff --git a/mlir/test/Dialect/Affine/slicing-utils.mlir b/mlir/test/Dialect/Affine/slicing-utils.mlir --- a/mlir/test/Dialect/Affine/slicing-utils.mlir +++ b/mlir/test/Dialect/Affine/slicing-utils.mlir @@ -1,6 +1,6 @@ -// RUN: mlir-opt %s -affine-super-vectorizer-test -forward-slicing=true 2>&1 | FileCheck %s --check-prefix=FWD -// RUN: mlir-opt %s -affine-super-vectorizer-test -backward-slicing=true 2>&1 | FileCheck %s --check-prefix=BWD -// RUN: mlir-opt %s -affine-super-vectorizer-test -slicing=true 2>&1 | FileCheck %s --check-prefix=FWDBWD +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-super-vectorizer-test -forward-slicing=true 2>&1 | FileCheck %s --check-prefix=FWD +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-super-vectorizer-test -backward-slicing=true 2>&1 | FileCheck %s --check-prefix=BWD +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-super-vectorizer-test -slicing=true 2>&1 | FileCheck %s --check-prefix=FWDBWD /// 1 2 3 4 /// |_______| |______| diff --git a/mlir/test/Dialect/Affine/unroll-jam.mlir b/mlir/test/Dialect/Affine/unroll-jam.mlir --- a/mlir/test/Dialect/Affine/unroll-jam.mlir +++ b/mlir/test/Dialect/Affine/unroll-jam.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -affine-loop-unroll-jam -unroll-jam-factor=2 | FileCheck %s -// RUN: mlir-opt %s -affine-loop-unroll-jam -unroll-jam-factor=4 | FileCheck --check-prefix=UJAM-FOUR %s +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll-jam -unroll-jam-factor=2 | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll-jam -unroll-jam-factor=4 | FileCheck --check-prefix=UJAM-FOUR %s // CHECK-DAG: [[MAP_PLUS_1:#map[0-9]+]] = affine_map<(d0) -> (d0 + 1)> // CHECK-DAG: [[MAP_DIV_OFFSET:#map[0-9]+]] = affine_map<()[s0] -> (((s0 - 1) floordiv 2) * 2 + 1)> diff --git a/mlir/test/Dialect/Affine/unroll.mlir b/mlir/test/Dialect/Affine/unroll.mlir --- a/mlir/test/Dialect/Affine/unroll.mlir +++ b/mlir/test/Dialect/Affine/unroll.mlir @@ -1,7 +1,7 @@ -// RUN: mlir-opt %s -affine-loop-unroll -unroll-full | FileCheck %s --check-prefix UNROLL-FULL -// RUN: mlir-opt %s -affine-loop-unroll -unroll-full -unroll-full-threshold=2 | FileCheck %s --check-prefix SHORT -// RUN: mlir-opt %s -affine-loop-unroll -unroll-factor=4 | FileCheck %s --check-prefix UNROLL-BY-4 -// RUN: mlir-opt %s -affine-loop-unroll -unroll-factor=1 | FileCheck %s --check-prefix UNROLL-BY-1 +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll -unroll-full | FileCheck %s --check-prefix UNROLL-FULL +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll -unroll-full -unroll-full-threshold=2 | FileCheck %s --check-prefix SHORT +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll -unroll-factor=4 | FileCheck %s --check-prefix UNROLL-BY-4 +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll -unroll-factor=1 | FileCheck %s --check-prefix UNROLL-BY-1 // UNROLL-FULL-DAG: [[MAP0:#map[0-9]+]] = affine_map<(d0) -> (d0 + 1)> // UNROLL-FULL-DAG: [[MAP1:#map[0-9]+]] = affine_map<(d0) -> (d0 + 2)> diff --git a/mlir/test/Dialect/GPU/ops.mlir b/mlir/test/Dialect/GPU/ops.mlir --- a/mlir/test/Dialect/GPU/ops.mlir +++ b/mlir/test/Dialect/GPU/ops.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s | FileCheck %s module attributes {gpu.container_module} { diff --git a/mlir/test/Dialect/GPU/outlining.mlir b/mlir/test/Dialect/GPU/outlining.mlir --- a/mlir/test/Dialect/GPU/outlining.mlir +++ b/mlir/test/Dialect/GPU/outlining.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -gpu-kernel-outlining -split-input-file -verify-diagnostics %s | FileCheck %s -dump-input-on-failure +// RUN: mlir-opt -allow-unregistered-dialect -gpu-kernel-outlining -split-input-file -verify-diagnostics %s | FileCheck %s -dump-input-on-failure // CHECK: module attributes {gpu.container_module} diff --git a/mlir/test/Dialect/GPU/promotion.mlir b/mlir/test/Dialect/GPU/promotion.mlir --- a/mlir/test/Dialect/GPU/promotion.mlir +++ b/mlir/test/Dialect/GPU/promotion.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -test-gpu-memory-promotion -split-input-file %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -test-gpu-memory-promotion -split-input-file %s | FileCheck %s module @foo attributes {gpu.kernel_module} { // Verify that the attribution was indeed introduced diff --git a/mlir/test/Dialect/LLVMIR/invalid.mlir b/mlir/test/Dialect/LLVMIR/invalid.mlir --- a/mlir/test/Dialect/LLVMIR/invalid.mlir +++ b/mlir/test/Dialect/LLVMIR/invalid.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -verify-diagnostics +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics // expected-error@+1{{llvm.noalias argument attribute of non boolean type}} func @invalid_noalias(%arg0: !llvm.i32 {llvm.noalias = 3}) { diff --git a/mlir/test/Dialect/Loops/invalid.mlir b/mlir/test/Dialect/Loops/invalid.mlir --- a/mlir/test/Dialect/Loops/invalid.mlir +++ b/mlir/test/Dialect/Loops/invalid.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -verify-diagnostics +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics func @loop_for_lb(%arg0: f32, %arg1: index) { // expected-error@+1 {{operand #0 must be index}} diff --git a/mlir/test/Dialect/Loops/parallel-loop-fusion.mlir b/mlir/test/Dialect/Loops/parallel-loop-fusion.mlir --- a/mlir/test/Dialect/Loops/parallel-loop-fusion.mlir +++ b/mlir/test/Dialect/Loops/parallel-loop-fusion.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='func(parallel-loop-fusion)' -split-input-file | FileCheck %s --dump-input-on-failure +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(parallel-loop-fusion)' -split-input-file | FileCheck %s --dump-input-on-failure func @fuse_empty_loops() { %c2 = constant 2 : index diff --git a/mlir/test/Dialect/Quant/parse-any.mlir b/mlir/test/Dialect/Quant/parse-any.mlir --- a/mlir/test/Dialect/Quant/parse-any.mlir +++ b/mlir/test/Dialect/Quant/parse-any.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file | FileCheck %s // ----- // CHECK-LABEL: parseFullySpecified diff --git a/mlir/test/Dialect/Quant/parse-ops-invalid.mlir b/mlir/test/Dialect/Quant/parse-ops-invalid.mlir --- a/mlir/test/Dialect/Quant/parse-ops-invalid.mlir +++ b/mlir/test/Dialect/Quant/parse-ops-invalid.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -verify-diagnostics +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics // ----- func @invalidStatisticsMismatchedLayerType(%arg0: tensor<8x4x3xf32>) -> diff --git a/mlir/test/Dialect/Quant/parse-uniform.mlir b/mlir/test/Dialect/Quant/parse-uniform.mlir --- a/mlir/test/Dialect/Quant/parse-uniform.mlir +++ b/mlir/test/Dialect/Quant/parse-uniform.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file | FileCheck %s // ----- // All per-layer params specified: diff --git a/mlir/test/Dialect/Quant/quant_region.mlir b/mlir/test/Dialect/Quant/quant_region.mlir --- a/mlir/test/Dialect/Quant/quant_region.mlir +++ b/mlir/test/Dialect/Quant/quant_region.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics %s | FileCheck %s // CHECK-LABEL: @source func @source(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>, %arg2: tensor<4xf32>) -> (tensor<4xf32>) { diff --git a/mlir/test/Dialect/SPIRV/control-flow-ops.mlir b/mlir/test/Dialect/SPIRV/control-flow-ops.mlir --- a/mlir/test/Dialect/SPIRV/control-flow-ops.mlir +++ b/mlir/test/Dialect/SPIRV/control-flow-ops.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics %s | FileCheck %s //===----------------------------------------------------------------------===// // spv.Branch diff --git a/mlir/test/Dialect/SPIRV/ops.mlir b/mlir/test/Dialect/SPIRV/ops.mlir --- a/mlir/test/Dialect/SPIRV/ops.mlir +++ b/mlir/test/Dialect/SPIRV/ops.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics %s | FileCheck %s //===----------------------------------------------------------------------===// // spv.AccessChain diff --git a/mlir/test/Dialect/SPIRV/structure-ops.mlir b/mlir/test/Dialect/SPIRV/structure-ops.mlir --- a/mlir/test/Dialect/SPIRV/structure-ops.mlir +++ b/mlir/test/Dialect/SPIRV/structure-ops.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics %s | FileCheck %s //===----------------------------------------------------------------------===// // spv._address_of diff --git a/mlir/test/EDSC/builder-api-test.cpp b/mlir/test/EDSC/builder-api-test.cpp --- a/mlir/test/EDSC/builder-api-test.cpp +++ b/mlir/test/EDSC/builder-api-test.cpp @@ -47,6 +47,7 @@ }(); (void)init_once; static thread_local MLIRContext context; + context.setAllowingUnregisteredDialect(); return context; } diff --git a/mlir/test/IR/affine-map.mlir b/mlir/test/IR/affine-map.mlir --- a/mlir/test/IR/affine-map.mlir +++ b/mlir/test/IR/affine-map.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s | FileCheck %s // Identity maps used in trivial compositions in MemRefs are optimized away. // CHECK-NOT: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d1)> diff --git a/mlir/test/IR/core-ops.mlir b/mlir/test/IR/core-ops.mlir --- a/mlir/test/IR/core-ops.mlir +++ b/mlir/test/IR/core-ops.mlir @@ -1,8 +1,8 @@ -// RUN: mlir-opt %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s | FileCheck %s // Verify the printed output can be parsed. -// RUN: mlir-opt %s | mlir-opt | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s | mlir-opt -allow-unregistered-dialect | FileCheck %s // Verify the generic form can be parsed. -// RUN: mlir-opt -mlir-print-op-generic %s | mlir-opt | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -mlir-print-op-generic %s | mlir-opt -allow-unregistered-dialect | FileCheck %s // CHECK: #map0 = affine_map<(d0) -> (d0 + 1)> diff --git a/mlir/test/IR/dense-elements-hex.mlir b/mlir/test/IR/dense-elements-hex.mlir --- a/mlir/test/IR/dense-elements-hex.mlir +++ b/mlir/test/IR/dense-elements-hex.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -verify-diagnostics -split-input-file -mlir-print-elementsattrs-with-hex-if-larger=1 | FileCheck %s --check-prefix=HEX -// RUN: mlir-opt %s -verify-diagnostics -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -verify-diagnostics -split-input-file -mlir-print-elementsattrs-with-hex-if-larger=1 | FileCheck %s --check-prefix=HEX +// RUN: mlir-opt -allow-unregistered-dialect %s -verify-diagnostics -split-input-file | FileCheck %s // HEX: dense<"0x00000000000024400000000000001440"> : tensor<2xf64> "foo.op"() {dense.attr = dense<[10.0, 5.0]> : tensor<2xf64>} : () -> () 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 @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -verify-diagnostics +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics func @dim(tensor<1xf32>) { ^bb(%0: tensor<1xf32>): diff --git a/mlir/test/IR/invalid.mlir b/mlir/test/IR/invalid.mlir --- a/mlir/test/IR/invalid.mlir +++ b/mlir/test/IR/invalid.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -verify-diagnostics +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics // Check different error cases. // ----- diff --git a/mlir/test/IR/locations.mlir b/mlir/test/IR/locations.mlir --- a/mlir/test/IR/locations.mlir +++ b/mlir/test/IR/locations.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -mlir-print-debuginfo | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -mlir-print-debuginfo | FileCheck %s // This test verifies that debug locations are round-trippable. #set0 = affine_set<(d0) : (1 == 0)> diff --git a/mlir/test/IR/module-op.mlir b/mlir/test/IR/module-op.mlir --- a/mlir/test/IR/module-op.mlir +++ b/mlir/test/IR/module-op.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -mlir-print-debuginfo | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -mlir-print-debuginfo | FileCheck %s // CHECK: module { module { diff --git a/mlir/test/IR/op-stats.mlir b/mlir/test/IR/op-stats.mlir --- a/mlir/test/IR/op-stats.mlir +++ b/mlir/test/IR/op-stats.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -print-op-stats %s -o=/dev/null 2>&1 | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -print-op-stats %s -o=/dev/null 2>&1 | FileCheck %s func @main(tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32> { ^bb0(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>): diff --git a/mlir/test/IR/opaque_locations.mlir b/mlir/test/IR/opaque_locations.mlir --- a/mlir/test/IR/opaque_locations.mlir +++ b/mlir/test/IR/opaque_locations.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -test-opaque-loc -mlir-print-debuginfo | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -test-opaque-loc -mlir-print-debuginfo | FileCheck %s // This test verifies that debug opaque locations can be printed. #set0 = affine_set<(d0) : (1 == 0)> diff --git a/mlir/test/IR/pretty-locations.mlir b/mlir/test/IR/pretty-locations.mlir --- a/mlir/test/IR/pretty-locations.mlir +++ b/mlir/test/IR/pretty-locations.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -mlir-print-debuginfo -mlir-pretty-debuginfo | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -mlir-print-debuginfo -mlir-pretty-debuginfo | FileCheck %s #set0 = affine_set<(d0) : (1 == 0)> diff --git a/mlir/test/IR/pretty-region-args.mlir b/mlir/test/IR/pretty-region-args.mlir --- a/mlir/test/IR/pretty-region-args.mlir +++ b/mlir/test/IR/pretty-region-args.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s | FileCheck %s // CHECK-LABEL: func @custom_region_names func @custom_region_names() -> () { diff --git a/mlir/test/IR/print-op-local-scope.mlir b/mlir/test/IR/print-op-local-scope.mlir --- a/mlir/test/IR/print-op-local-scope.mlir +++ b/mlir/test/IR/print-op-local-scope.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -mlir-print-local-scope | FileCheck %s --dump-input-on-failure +// RUN: mlir-opt -allow-unregistered-dialect %s -mlir-print-local-scope | FileCheck %s --dump-input-on-failure // CHECK: "foo.op"() : () -> memref (d0 * 2)>> "foo.op"() : () -> (memref (2*d0)>>) diff --git a/mlir/test/IR/region.mlir b/mlir/test/IR/region.mlir --- a/mlir/test/IR/region.mlir +++ b/mlir/test/IR/region.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics | FileCheck %s //===----------------------------------------------------------------------===// // Test the number of regions diff --git a/mlir/test/IR/test-symbol-dce.mlir b/mlir/test/IR/test-symbol-dce.mlir --- a/mlir/test/IR/test-symbol-dce.mlir +++ b/mlir/test/IR/test-symbol-dce.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -symbol-dce -split-input-file -verify-diagnostics | FileCheck %s -// RUN: mlir-opt %s -pass-pipeline="module(symbol-dce)" -split-input-file | FileCheck %s --check-prefix=NESTED +// 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 // Check that trivially dead and trivially live non-nested cases are handled. diff --git a/mlir/test/IR/test-symbol-rauw.mlir b/mlir/test/IR/test-symbol-rauw.mlir --- a/mlir/test/IR/test-symbol-rauw.mlir +++ b/mlir/test/IR/test-symbol-rauw.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -test-symbol-rauw -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -test-symbol-rauw -split-input-file | FileCheck %s // Symbol references to the module itself don't affect uses of symbols within // its table. diff --git a/mlir/test/IR/test-symbol-uses.mlir b/mlir/test/IR/test-symbol-uses.mlir --- a/mlir/test/IR/test-symbol-uses.mlir +++ b/mlir/test/IR/test-symbol-uses.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -test-symbol-uses -split-input-file -verify-diagnostics +// RUN: mlir-opt -allow-unregistered-dialect %s -test-symbol-uses -split-input-file -verify-diagnostics // Symbol references to the module itself don't affect uses of symbols within // its table. diff --git a/mlir/test/IR/traits.mlir b/mlir/test/IR/traits.mlir --- a/mlir/test/IR/traits.mlir +++ b/mlir/test/IR/traits.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics | FileCheck %s // CHECK: succeededSameOperandsElementType func @succeededSameOperandsElementType(%t10x10 : tensor<10x10xf32>, %t1f: tensor<1xf32>, %v1: vector<1xf32>, %t1i: tensor<1xi32>, %sf: f32) { 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 @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s | FileCheck %s -// RUN: mlir-opt -mlir-print-op-generic -mlir-print-debuginfo %s | FileCheck %s --check-prefix=CHECK-GENERIC +// RUN: mlir-opt -allow-unregistered-dialect %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -mlir-print-op-generic -mlir-print-debuginfo %s | FileCheck %s --check-prefix=CHECK-GENERIC // CHECK-LABEL: func @wrapping_op // CHECK-GENERIC: "func" 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 %s -split-input-file -pass-pipeline='func(canonicalize)' | FileCheck %s --dump-input=fail +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -pass-pipeline='func(canonicalize)' | FileCheck %s --dump-input=fail // Test case: Simple case of deleting a dead pure op. 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 %s -pass-pipeline='func(canonicalize)' -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='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/constant-fold.mlir b/mlir/test/Transforms/constant-fold.mlir --- a/mlir/test/Transforms/constant-fold.mlir +++ b/mlir/test/Transforms/constant-fold.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -test-constant-fold | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -test-constant-fold | FileCheck %s // ----- 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 %s -pass-pipeline='func(cse)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(cse)' | FileCheck %s // CHECK-DAG: #map0 = affine_map<(d0) -> (d0 mod 2)> #map0 = affine_map<(d0) -> (d0 mod 2)> diff --git a/mlir/test/Transforms/inlining-dce.mlir b/mlir/test/Transforms/inlining-dce.mlir --- a/mlir/test/Transforms/inlining-dce.mlir +++ b/mlir/test/Transforms/inlining-dce.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -inline | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -inline | FileCheck %s // This file tests the callgraph dead code elimination performed by the inliner. diff --git a/mlir/test/Transforms/location-snapshot.mlir b/mlir/test/Transforms/location-snapshot.mlir --- a/mlir/test/Transforms/location-snapshot.mlir +++ b/mlir/test/Transforms/location-snapshot.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt -snapshot-op-locations='filename=%/t' -mlir-print-debuginfo %s | FileCheck %s -DFILE=%/t -// RUN: mlir-opt -snapshot-op-locations='filename=%/t tag='tagged'' -mlir-print-debuginfo %s | FileCheck %s --check-prefix=TAG -DFILE=%/t +// RUN: mlir-opt -allow-unregistered-dialect -snapshot-op-locations='filename=%/t' -mlir-print-debuginfo %s | FileCheck %s -DFILE=%/t +// RUN: mlir-opt -allow-unregistered-dialect -snapshot-op-locations='filename=%/t tag='tagged'' -mlir-print-debuginfo %s | FileCheck %s --check-prefix=TAG -DFILE=%/t // CHECK-LABEL: func @function // CHECK-NEXT: loc("[[FILE]]":{{[0-9]+}}:{{[0-9]+}}) diff --git a/mlir/test/Transforms/loop-coalescing.mlir b/mlir/test/Transforms/loop-coalescing.mlir --- a/mlir/test/Transforms/loop-coalescing.mlir +++ b/mlir/test/Transforms/loop-coalescing.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -loop-coalescing %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -loop-coalescing %s | FileCheck %s // CHECK-LABEL: @one_3d_nest func @one_3d_nest() { diff --git a/mlir/test/Transforms/loop-fusion-dependence-check.mlir b/mlir/test/Transforms/loop-fusion-dependence-check.mlir --- a/mlir/test/Transforms/loop-fusion-dependence-check.mlir +++ b/mlir/test/Transforms/loop-fusion-dependence-check.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics | FileCheck %s // ----- diff --git a/mlir/test/Transforms/loop-fusion.mlir b/mlir/test/Transforms/loop-fusion.mlir --- a/mlir/test/Transforms/loop-fusion.mlir +++ b/mlir/test/Transforms/loop-fusion.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -affine-loop-fusion -split-input-file | FileCheck %s -// RUN: mlir-opt %s -affine-loop-fusion -fusion-maximal -split-input-file | FileCheck %s --check-prefix=MAXIMAL +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-fusion -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-fusion -fusion-maximal -split-input-file | FileCheck %s --check-prefix=MAXIMAL // TODO(andydavis) Add more tests: // *) Add nested fusion test cases when non-constant loop bound support is diff --git a/mlir/test/Transforms/memref-dataflow-opt.mlir b/mlir/test/Transforms/memref-dataflow-opt.mlir --- a/mlir/test/Transforms/memref-dataflow-opt.mlir +++ b/mlir/test/Transforms/memref-dataflow-opt.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -memref-dataflow-opt | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -memref-dataflow-opt | FileCheck %s // CHECK-DAG: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> (d1 + 1)> // CHECK-DAG: [[MAP1:#map[0-9]+]] = affine_map<(d0, d1) -> (d0)> 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 %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='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/parametric-mapping.mlir b/mlir/test/Transforms/parametric-mapping.mlir --- a/mlir/test/Transforms/parametric-mapping.mlir +++ b/mlir/test/Transforms/parametric-mapping.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -test-mapping-to-processing-elements %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -test-mapping-to-processing-elements %s | FileCheck %s // CHECK-LABEL: @map1d // CHECK: (%[[lb:.*]]: index, %[[ub:.*]]: index, %[[step:.*]]: index) { diff --git a/mlir/test/Transforms/pipeline-data-transfer.mlir b/mlir/test/Transforms/pipeline-data-transfer.mlir --- a/mlir/test/Transforms/pipeline-data-transfer.mlir +++ b/mlir/test/Transforms/pipeline-data-transfer.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -split-input-file -affine-pipeline-data-transfer | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-pipeline-data-transfer | FileCheck %s // ----- 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 %s -pass-pipeline='func(parallel-loop-collapsing{collapsed-indices-0=0,1}, canonicalize)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='func(parallel-loop-collapsing{collapsed-indices-0=0,1}, canonicalize)' | FileCheck %s // CHECK-LABEL: func @collapse_to_single() { func @collapse_to_single() { diff --git a/mlir/test/Transforms/strip-debuginfo.mlir b/mlir/test/Transforms/strip-debuginfo.mlir --- a/mlir/test/Transforms/strip-debuginfo.mlir +++ b/mlir/test/Transforms/strip-debuginfo.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -mlir-print-debuginfo -strip-debuginfo | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -mlir-print-debuginfo -strip-debuginfo | FileCheck %s // This test verifies that debug locations are stripped. #set0 = affine_set<(d0) : (1 == 0)> 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 -allow-unregistered-dialect %s -pass-pipeline='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-inlining.mlir b/mlir/test/Transforms/test-inlining.mlir --- a/mlir/test/Transforms/test-inlining.mlir +++ b/mlir/test/Transforms/test-inlining.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -test-inline | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -test-inline | FileCheck %s // CHECK-LABEL: func @inline_with_arg func @inline_with_arg(%arg0 : i32) -> i32 { 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,4 +1,4 @@ -// RUN: mlir-opt -test-legalize-patterns -verify-diagnostics -test-legalize-mode=analysis %s | FileCheck %s +// 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@-3 {{op 'module_terminator' is legalizable}} diff --git a/mlir/test/Transforms/test-legalizer-full.mlir b/mlir/test/Transforms/test-legalizer-full.mlir --- a/mlir/test/Transforms/test-legalizer-full.mlir +++ b/mlir/test/Transforms/test-legalizer-full.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics %s | FileCheck %s // CHECK-LABEL: func @multi_level_mapping func @multi_level_mapping() { diff --git a/mlir/test/Transforms/test-legalizer.mlir b/mlir/test/Transforms/test-legalizer.mlir --- a/mlir/test/Transforms/test-legalizer.mlir +++ b/mlir/test/Transforms/test-legalizer.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -split-input-file -test-legalize-patterns -verify-diagnostics %s | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics %s | FileCheck %s // CHECK-LABEL: verifyDirectPattern func @verifyDirectPattern() -> i32 { diff --git a/mlir/test/mlir-tblgen/op-format.mlir b/mlir/test/mlir-tblgen/op-format.mlir --- a/mlir/test/mlir-tblgen/op-format.mlir +++ b/mlir/test/mlir-tblgen/op-format.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s | mlir-opt -verify-diagnostics | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s | mlir-opt -allow-unregistered-dialect -verify-diagnostics | FileCheck %s // CHECK: %[[I64:.*]] = %i64 = "foo.op"() : () -> (i64) diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -83,6 +83,10 @@ cl::desc("Run the verifier after each transformation pass"), cl::init(true)); +static cl::opt allowUnregisteredDialect( + "allow-unregistered-dialect", + cl::desc("Allow operation for unregistered dialects"), cl::init(false)); + void registerTestPasses() { registerConvertToTargetEnvPass(); registerInliner(); @@ -159,5 +163,6 @@ } return failed(MlirOptMain(output->os(), std::move(file), passPipeline, - splitInputFile, verifyDiagnostics, verifyPasses)); + splitInputFile, verifyDiagnostics, verifyPasses, + allowUnregisteredDialect)); } diff --git a/mlir/tools/mlir-translate/mlir-translate.cpp b/mlir/tools/mlir-translate/mlir-translate.cpp --- a/mlir/tools/mlir-translate/mlir-translate.cpp +++ b/mlir/tools/mlir-translate/mlir-translate.cpp @@ -45,6 +45,11 @@ "expected-* lines on the corresponding line"), llvm::cl::init(false)); +static llvm::cl::opt allowUnregisteredDialect( + "allow-unregistered-dialect", + llvm::cl::desc("Allow operation for unregistered dialects"), + llvm::cl::init(true)); + int main(int argc, char **argv) { registerAllDialects(); llvm::InitLLVM y(argc, argv); @@ -73,6 +78,7 @@ auto processBuffer = [&](std::unique_ptr ownedBuffer, raw_ostream &os) { MLIRContext context; + context.setAllowingUnregisteredDialect(); llvm::SourceMgr sourceMgr; sourceMgr.AddNewSourceBuffer(std::move(ownedBuffer), llvm::SMLoc()); diff --git a/mlir/unittests/IR/OperationSupportTest.cpp b/mlir/unittests/IR/OperationSupportTest.cpp --- a/mlir/unittests/IR/OperationSupportTest.cpp +++ b/mlir/unittests/IR/OperationSupportTest.cpp @@ -18,6 +18,7 @@ Operation *createOp(MLIRContext *context, bool resizableOperands, ArrayRef operands = llvm::None, ArrayRef resultTypes = llvm::None) { + context->setAllowingUnregisteredDialect(); return Operation::create( UnknownLoc::get(context), OperationName("foo.bar", context), resultTypes, operands, llvm::None, llvm::None, 0, resizableOperands);