llvm/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel

# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("//llvm:lit_test.bzl", "package_path")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "gentbl_sharded_ops", "td_library")

package(
    default_visibility = ["//visibility:public"],
    features = ["layering_check"],
)

licenses(["notice"])

LLVM_LIT_PATH_FUNCTION = " " + \
                         "# Allow generated file to be relocatable.\n" + \
                         "from pathlib import Path\n" + \
                         "def path(p):\n" + \
                         "    if not p: return ''\n" + \
                         "    return str((Path(__file__).parent / p).resolve())\n"

LIT_SITE_CFG_IN_HEADER = "# Autogenerated, do not edit." + LLVM_LIT_PATH_FUNCTION

expand_template(
    name = "lit_site_cfg_py",
    testonly = True,
    out = "lit.site.cfg.py",
    substitutions = {
        "@LIT_SITE_CFG_IN_HEADER@": LIT_SITE_CFG_IN_HEADER,
        "@LLVM_TOOLS_DIR@": package_path("//llvm:BUILD"),
        "@ENABLE_SHARED@": "1",
        "@ENABLE_ASSERTIONS@": "1",
        "@MLIR_SOURCE_DIR@": package_path("//mlir:BUILD"),
        "@MLIR_TOOLS_DIR@": package_path("//mlir:BUILD"),
        "\"@MLIR_BINARY_DIR@\"": "os.environ[\"TEST_UNDECLARED_OUTPUTS_DIR\"]",
        # All disabled, but required to substituted because they are not in quotes.
        "@LLVM_BUILD_EXAMPLES@": "0",
        "@LLVM_HAS_NVPTX_TARGET@": "0",
        "@MLIR_ENABLE_CUDA_RUNNER@": "0",
        "@MLIR_ENABLE_ROCM_CONVERSIONS@": "0",
        "@MLIR_ENABLE_ROCM_RUNNER@": "0",
        "@MLIR_ENABLE_SYCL_RUNNER@": "0",
        "@MLIR_ENABLE_SPIRV_CPU_RUNNER@": "0",
        "@MLIR_ENABLE_VULKAN_RUNNER@": "0",
        "@MLIR_ENABLE_BINDINGS_PYTHON@": "0",
        "@MLIR_RUN_AMX_TESTS@": "0",
        "@MLIR_RUN_ARM_SVE_TESTS@": "0",
        "@MLIR_RUN_ARM_SME_TESTS@": "0",
        "@MLIR_RUN_X86VECTOR_TESTS@": "0",
        "@MLIR_RUN_CUDA_TENSOR_CORE_TESTS@": "0",
        "@MLIR_RUN_CUDA_SM80_TESTS@": "0",
        "@MLIR_RUN_CUDA_SM80_LT_TESTS@": "0",
        "@MLIR_RUN_CUDA_SM90_TESTS@": "0",
        "@MLIR_INCLUDE_INTEGRATION_TESTS@": "0",
        "@SHLIBDIR@": package_path("//llvm:BUILD"),
    },
    template = "lit.site.cfg.py.in",
)

# Common data used by most lit tests.
filegroup(
    name = "lit_data",
    testonly = True,
    data = [
        "lit.cfg.py",
        "lit.site.cfg.py",
        "//llvm:FileCheck",
        "//llvm:count",
        "//llvm:not",
    ],
)

cc_library(
    name = "IRProducingAPITest",
    hdrs = ["APITest.h"],
    includes = ["."],
)

cc_library(
    name = "TestAnalysis",
    srcs = glob(
        [
            "lib/Analysis/*.cpp",
            "lib/Analysis/*.h",
            "lib/Analysis/DataFlow/*.cpp",
            "lib/Analysis/DataFlow/*.h",
        ],
    ),
    includes = ["lib/Dialect/Test"],
    deps = [
        ":TestDialect",
        "//llvm:Support",
        "//mlir:AffineAnalysis",
        "//mlir:AffineDialect",
        "//mlir:Analysis",
        "//mlir:CallOpInterfaces",
        "//mlir:ControlFlowInterfaces",
        "//mlir:FuncDialect",
        "//mlir:FunctionInterfaces",
        "//mlir:IR",
        "//mlir:MemRefDialect",
        "//mlir:Pass",
        "//mlir:SideEffectInterfaces",
        "//mlir:Support",
    ],
)

td_library(
    name = "TestOpTdFiles",
    srcs = glob(["lib/Dialect/Test/*.td"]),
    deps = [
        "//mlir:BuiltinDialectTdFiles",
        "//mlir:CallInterfacesTdFiles",
        "//mlir:ControlFlowInterfacesTdFiles",
        "//mlir:CopyOpInterfaceTdFiles",
        "//mlir:DLTIDialectTdFiles",
        "//mlir:DataLayoutInterfacesTdFiles",
        "//mlir:DestinationStyleOpInterfaceTdFiles",
        "//mlir:FunctionInterfacesTdFiles",
        "//mlir:InferIntRangeInterfaceTdFiles",
        "//mlir:InferTypeOpInterfaceTdFiles",
        "//mlir:LinalgStructuredOpsTdFiles",
        "//mlir:MemorySlotInterfacesTdFiles",
        "//mlir:OpBaseTdFiles",
        "//mlir:PolynomialTdFiles",
        "//mlir:SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "TestOpsSyntaxIncGen",
    strip_include_prefix = "lib/Dialect/Test",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "lib/Dialect/Test/TestOpsSyntax.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "lib/Dialect/Test/TestOpsSyntax.cpp.inc",
        ),
    ],
    tblgen = "//mlir:mlir-tblgen",
    td_file = "lib/Dialect/Test/TestOpsSyntax.td",
    test = True,
    deps = [
        ":TestOpTdFiles",
    ],
)

gentbl_cc_library(
    name = "TestOpsIncGen",
    strip_include_prefix = "lib/Dialect/Test",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=test",
            ],
            "lib/Dialect/Test/TestOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=test",
            ],
            "lib/Dialect/Test/TestOpsDialect.cpp.inc",
        ),
        (
            ["-gen-rewriters"],
            "lib/Dialect/Test/TestPatterns.inc",
        ),
    ],
    tblgen = "//mlir:mlir-tblgen",
    td_file = "lib/Dialect/Test/TestOps.td",
    test = True,
    deps = [
        ":TestOpTdFiles",
    ],
)

gentbl_cc_library(
    name = "TestInterfacesIncGen",
    strip_include_prefix = "lib/Dialect/Test",
    tbl_outs = [
        (
            ["-gen-attr-interface-decls"],
            "lib/Dialect/Test/TestAttrInterfaces.h.inc",
        ),
        (
            ["-gen-attr-interface-defs"],
            "lib/Dialect/Test/TestAttrInterfaces.cpp.inc",
        ),
        (
            ["-gen-type-interface-decls"],
            "lib/Dialect/Test/TestTypeInterfaces.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "lib/Dialect/Test/TestTypeInterfaces.cpp.inc",
        ),
        (
            ["-gen-op-interface-decls"],
            "lib/Dialect/Test/TestOpInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "lib/Dialect/Test/TestOpInterfaces.cpp.inc",
        ),
    ],
    tblgen = "//mlir:mlir-tblgen",
    td_file = "lib/Dialect/Test/TestInterfaces.td",
    test = True,
    deps = [
        "//mlir:OpBaseTdFiles",
        "//mlir:SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "TestAttrDefsIncGen",
    strip_include_prefix = "lib/Dialect/Test",
    tbl_outs = [
        (
            [
                "-gen-attrdef-decls",
                "--attrdefs-dialect=test",
            ],
            "lib/Dialect/Test/TestAttrDefs.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "--attrdefs-dialect=test",
            ],
            "lib/Dialect/Test/TestAttrDefs.cpp.inc",
        ),
    ],
    tblgen = "//mlir:mlir-tblgen",
    td_file = "lib/Dialect/Test/TestOps.td",
    test = True,
    deps = [
        ":TestOpTdFiles",
    ],
)

gentbl_cc_library(
    name = "TestEnumDefsIncGen",
    strip_include_prefix = "lib/Dialect/Test",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "lib/Dialect/Test/TestOpEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "lib/Dialect/Test/TestOpEnums.cpp.inc",
        ),
    ],
    tblgen = "//mlir:mlir-tblgen",
    td_file = "lib/Dialect/Test/TestEnumDefs.td",
    test = True,
    deps = [
        ":TestOpTdFiles",
    ],
)

gentbl_cc_library(
    name = "TestTypeDefsIncGen",
    strip_include_prefix = "lib/Dialect/Test",
    tbl_outs = [
        (
            [
                "-gen-typedef-decls",
                "--typedefs-dialect=test",
            ],
            "lib/Dialect/Test/TestTypeDefs.h.inc",
        ),
        (
            [
                "-gen-typedef-defs",
                "--typedefs-dialect=test",
            ],
            "lib/Dialect/Test/TestTypeDefs.cpp.inc",
        ),
    ],
    tblgen = "//mlir:mlir-tblgen",
    td_file = "lib/Dialect/Test/TestTypeDefs.td",
    test = True,
    deps = [
        ":TestOpTdFiles",
        "//mlir:BuiltinDialectTdFiles",
    ],
)

cc_library(
    name = "TestTestDynDialect",
    srcs = glob([
        "lib/Dialect/TestDyn/*.cpp",
    ]),
    deps = [
        "//mlir:IR",
    ],
)

td_library(
    name = "TransformDialectTdFiles",
    srcs = glob(["lib/Dialect/Transform/*.td"]),
    deps = [
        "//mlir:OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "TestTransformDialectExtensionIncGen",
    strip_include_prefix = "lib/Dialect/Transform",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "lib/Dialect/Transform/TestTransformDialectExtension.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "lib/Dialect/Transform/TestTransformDialectExtension.cpp.inc",
        ),
        (
            [
                "-gen-typedef-decls",
                "-typedefs-dialect=transform",
            ],
            "lib/Dialect/Transform/TestTransformDialectExtensionTypes.h.inc",
        ),
        (
            [
                "-gen-typedef-defs",
                "-typedefs-dialect=transform",
            ],
            "lib/Dialect/Transform/TestTransformDialectExtensionTypes.cpp.inc",
        ),
    ],
    tblgen = "//mlir:mlir-tblgen",
    td_file = "lib/Dialect/Transform/TestTransformDialectExtension.td",
    test = True,
    deps = [
        ":TransformDialectTdFiles",
        "//mlir:PDLDialectTdFiles",
        "//mlir:TransformDialectTdFiles",
        "//mlir:TransformPDLExtension",
    ],
)

cc_library(
    name = "TestTransformDialect",
    srcs = glob(["lib/Dialect/Transform/*.cpp"]),
    hdrs = glob(["lib/Dialect/Transform/*.h"]),
    includes = ["lib/Dialect/Transform"],
    deps = [
        ":TestTransformDialectExtensionIncGen",
        "//llvm:Support",
        "//mlir:BytecodeOpInterface",
        "//mlir:IR",
        "//mlir:PDLDialect",
        "//mlir:Pass",
        "//mlir:TransformDebugExtension",
        "//mlir:TransformDialect",
        "//mlir:TransformDialectInterfaces",
        "//mlir:TransformDialectTransforms",
        "//mlir:TransformPDLExtension",
    ],
)

gentbl_sharded_ops(
    name = "TestDialectOpSrcs",
    hdr_out = "lib/Dialect/Test/TestOps.h.inc",
    shard_count = 20,
    sharder = "//mlir:mlir-src-sharder",
    src_file = "lib/Dialect/Test/TestOps.cpp",
    src_out = "lib/Dialect/Test/TestOps.cpp.inc",
    tblgen = "//mlir:mlir-tblgen",
    td_file = "lib/Dialect/Test/TestOps.td",
    test = True,
    deps = [":TestOpTdFiles"],
)

cc_library(
    name = "TestDialect",
    srcs = glob(
        ["lib/Dialect/Test/*.cpp"],
        exclude = ["lib/Dialect/Test/TestToLLVMIRTranslation.cpp"],
    ) + [":TestDialectOpSrcs"],
    hdrs = glob(["lib/Dialect/Test/*.h"]),
    includes = [
        "lib/Dialect/Test",
    ],
    deps = [
        ":TestAttrDefsIncGen",
        ":TestEnumDefsIncGen",
        ":TestInterfacesIncGen",
        ":TestOpsIncGen",
        ":TestOpsSyntaxIncGen",
        ":TestTypeDefsIncGen",
        "//llvm:Core",
        "//llvm:IRReader",
        "//llvm:Support",
        "//mlir:ArithDialect",
        "//mlir:BytecodeOpInterface",
        "//mlir:CallOpInterfaces",
        "//mlir:ControlFlowInterfaces",
        "//mlir:CopyOpInterface",
        "//mlir:DLTIDialect",
        "//mlir:DataLayoutInterfaces",
        "//mlir:DerivedAttributeOpInterface",
        "//mlir:DestinationStyleOpInterface",
        "//mlir:Dialect",
        "//mlir:DialectUtils",
        "//mlir:FromLLVMIRTranslation",
        "//mlir:FuncDialect",
        "//mlir:FuncTransforms",
        "//mlir:FunctionInterfaces",
        "//mlir:IR",
        "//mlir:InferIntRangeInterface",
        "//mlir:InferTypeOpInterface",
        "//mlir:InliningUtils",
        "//mlir:LLVMDialect",
        "//mlir:LLVMIRToLLVMTranslation",
        "//mlir:LinalgDialect",
        "//mlir:LoopLikeInterface",
        "//mlir:MemorySlotInterfaces",
        "//mlir:Pass",
        "//mlir:PolynomialDialect",
        "//mlir:Reducer",
        "//mlir:SideEffectInterfaces",
        "//mlir:Support",
        "//mlir:TensorDialect",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:TranslateLib",
        "//mlir:ValueBoundsOpInterface",
        "//mlir:ViewLikeInterface",
    ],
)

cc_library(
    name = "TestToLLVMIRTranslation",
    srcs = ["lib/Dialect/Test/TestToLLVMIRTranslation.cpp"],
    deps = [
        ":TestDialect",
        "//llvm:Core",
        "//llvm:Support",
        "//mlir:BuiltinToLLVMIRTranslation",
        "//mlir:IR",
        "//mlir:LLVMToLLVMIRTranslation",
        "//mlir:ToLLVMIRTranslation",
        "//mlir:TranslateLib",
    ],
)

cc_library(
    name = "TestIR",
    srcs = glob(["lib/IR/*.cpp"]),
    deps = [
        ":TestDialect",
        "//llvm:Support",
        "//mlir:Analysis",
        "//mlir:ArithDialect",
        "//mlir:BytecodeOpInterface",
        "//mlir:BytecodeReader",
        "//mlir:BytecodeWriter",
        "//mlir:FuncDialect",
        "//mlir:FunctionInterfaces",
        "//mlir:IR",
        "//mlir:LinalgDialect",
        "//mlir:Parser",
        "//mlir:Pass",
        "//mlir:Support",
    ],
)

cc_library(
    name = "TestLoopLikeInterface",
    srcs = glob(["lib/Interfaces/LoopLikeInterface/*.cpp"]),
    deps = [
        "//llvm:Support",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:LoopLikeInterface",
        "//mlir:Pass",
    ],
)

gentbl_cc_library(
    name = "TestTilingInterfaceTransformOpsIncGen",
    includes = ["lib/Interfaces/TilingInterface"],
    strip_include_prefix = "lib",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp.inc",
        ),
    ],
    tblgen = "//mlir:mlir-tblgen",
    td_file = "lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.td",
    deps = [
        "//mlir:SCFTdFiles",
        "//mlir:TransformDialectTdFiles",
    ],
)

cc_library(
    name = "TestTilingInterface",
    srcs = glob(["lib/Interfaces/TilingInterface/*.cpp"]),
    includes = ["lib/Interfaces/TilingInterface"],
    deps = [
        ":TestTilingInterfaceTransformOpsIncGen",
        "//llvm:Support",
        "//mlir:AffineDialect",
        "//mlir:ArithDialect",
        "//mlir:DialectUtils",
        "//mlir:FuncDialect",
        "//mlir:GPUDialect",
        "//mlir:IR",
        "//mlir:IndexDialect",
        "//mlir:LinalgDialect",
        "//mlir:LinalgTransforms",
        "//mlir:MemRefDialect",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:SCFTransforms",
        "//mlir:TensorDialect",
        "//mlir:TensorTilingInterfaceImpl",
        "//mlir:TilingInterface",
        "//mlir:TransformDialect",
        "//mlir:TransformDialectInterfaces",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestPass",
    srcs = glob(["lib/Pass/*.cpp"]),
    deps = [
        ":TestDialect",
        "//llvm:Support",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:Pass",
        "//mlir:Support",
    ],
)

cc_library(
    name = "TestRewrite",
    srcs = [
        "lib/Rewrite/TestPDLByteCode.cpp",
    ],
    deps = [
        "//mlir:IR",
        "//mlir:PDLInterpDialect",
        "//mlir:Pass",
        "//mlir:Support",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestReducer",
    srcs = [
        "lib/Reducer/MLIRTestReducer.cpp",
    ],
    deps = [
        "//mlir:IR",
        "//mlir:Pass",
        "//mlir:Support",
    ],
)

cc_library(
    name = "TestTransforms",
    srcs = glob(["lib/Transforms/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        ":TestDialect",
        ":TestDialectConversionPDLLPatternsIncGen",
        "//llvm:Support",
        "//mlir:AffineAnalysis",
        "//mlir:AffineDialect",
        "//mlir:Analysis",
        "//mlir:ArithDialect",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:InliningUtils",
        "//mlir:MathDialect",
        "//mlir:PDLDialect",
        "//mlir:PDLInterpDialect",
        "//mlir:Parser",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:SPIRVDialect",
        "//mlir:SideEffectInterfaces",
        "//mlir:Support",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestFuncToLLVM",
    srcs = glob(["lib/Conversion/FuncToLLVM/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        ":TestDialect",
        "//mlir:FuncDialect",
        "//mlir:FuncToLLVM",
        "//mlir:IR",
        "//mlir:LLVMCommonConversion",
        "//mlir:LLVMDialect",
        "//mlir:Pass",
    ],
)

cc_library(
    name = "TestOneToNTypeConversion",
    srcs = glob(["lib/Conversion/OneToNTypeConversion/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        ":TestDialect",
        "//mlir:FuncDialect",
        "//mlir:FuncTransforms",
        "//mlir:IR",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:SCFTransforms",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestVectorToSPIRV",
    srcs = glob(["lib/Conversion/VectorToSPIRV/*.cpp"]),
    deps = [
        "//mlir:ArithDialect",
        "//mlir:FuncDialect",
        "//mlir:Pass",
        "//mlir:SPIRVDialect",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:VectorDialect",
        "//mlir:VectorToSPIRV",
    ],
)

cc_library(
    name = "TestConvertToSPIRV",
    srcs = glob(["lib/Conversion/ConvertToSPIRV/*.cpp"]),
    deps = [
        "//mlir:ArithDialect",
        "//mlir:FuncDialect",
        "//mlir:Pass",
        "//mlir:SPIRVConversion",
        "//mlir:SPIRVDialect",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:VectorDialect",
        "//mlir:VectorTransforms",
    ],
)

cc_library(
    name = "TestAffine",
    srcs = glob([
        "lib/Dialect/Affine/*.cpp",
    ]),
    deps = [
        ":TestDialect",
        "//llvm:Support",
        "//mlir:AffineAnalysis",
        "//mlir:AffineDialect",
        "//mlir:AffineTransforms",
        "//mlir:AffineUtils",
        "//mlir:Analysis",
        "//mlir:ArithTransforms",
        "//mlir:DialectUtils",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:MemRefDialect",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:Support",
        "//mlir:TensorDialect",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:ValueBoundsOpInterface",
        "//mlir:VectorDialect",
        "//mlir:VectorUtils",
    ],
)

cc_library(
    name = "TestDLTI",
    srcs = glob(["lib/Dialect/DLTI/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        ":TestDialect",
        "//mlir:Analysis",
        "//mlir:DLTIDialect",
        "//mlir:IR",
        "//mlir:Pass",
    ],
)

cc_library(
    name = "TestGPU",
    srcs = glob(["lib/Dialect/GPU/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//llvm:NVPTXCodeGen",
        "//llvm:Support",
        "//mlir:AffineDialect",
        "//mlir:AffineToStandard",
        "//mlir:ArithDialect",
        "//mlir:ArithToLLVM",
        "//mlir:FuncDialect",
        "//mlir:FuncToLLVM",
        "//mlir:GPUDialect",
        "//mlir:GPUToGPURuntimeTransforms",
        "//mlir:GPUToNVVMTransforms",
        "//mlir:GPUTransforms",
        "//mlir:IR",
        "//mlir:IndexDialect",
        "//mlir:IndexToLLVM",
        "//mlir:LLVMDialect",
        "//mlir:LinalgTransforms",
        "//mlir:MathToLLVM",
        "//mlir:MemRefDialect",
        "//mlir:MemRefToLLVM",
        "//mlir:MemRefTransforms",
        "//mlir:NVGPUToNVVM",
        "//mlir:NVVMToLLVM",
        "//mlir:NVVMToLLVMIRTranslation",
        "//mlir:Pass",
        "//mlir:ROCDLToLLVMIRTranslation",
        "//mlir:ReconcileUnrealizedCasts",
        "//mlir:SCFDialect",
        "//mlir:SCFToControlFlow",
        "//mlir:SPIRVDialect",
        "//mlir:ToLLVMIRTranslation",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:VectorDialect",
        "//mlir:VectorToLLVM",
        "//mlir:VectorToSCF",
    ],
)

cc_library(
    name = "TestLinalg",
    srcs = glob(["lib/Dialect/Linalg/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//llvm:Support",
        "//mlir:AffineDialect",
        "//mlir:ArithDialect",
        "//mlir:ArithTransforms",
        "//mlir:BufferizationDialect",
        "//mlir:BufferizationTransforms",
        "//mlir:FuncDialect",
        "//mlir:FuncTransforms",
        "//mlir:GPUDialect",
        "//mlir:IR",
        "//mlir:LinalgDialect",
        "//mlir:LinalgTransforms",
        "//mlir:LinalgUtils",
        "//mlir:MemRefDialect",
        "//mlir:Parser",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:SCFTransforms",
        "//mlir:TensorDialect",
        "//mlir:TensorTransforms",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:VectorDialect",
        "//mlir:VectorToSCF",
        "//mlir:VectorTransforms",
    ],
)

cc_library(
    name = "TestLLVM",
    srcs = glob(["lib/Dialect/LLVM/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:AffineToStandard",
        "//mlir:FuncDialect",
        "//mlir:FuncToLLVM",
        "//mlir:IR",
        "//mlir:IndexToLLVM",
        "//mlir:LLVMDialect",
        "//mlir:LinalgTransforms",
        "//mlir:MathToLLVM",
        "//mlir:MemRefToLLVM",
        "//mlir:MemRefTransforms",
        "//mlir:Pass",
        "//mlir:ReconcileUnrealizedCasts",
        "//mlir:SCFToControlFlow",
        "//mlir:Transforms",
        "//mlir:VectorToLLVM",
        "//mlir:VectorToSCF",
    ],
)

cc_library(
    name = "TestMath",
    srcs = glob(["lib/Dialect/Math/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:ArithDialect",
        "//mlir:MathDialect",
        "//mlir:MathTransforms",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:VectorDialect",
        "//mlir:X86VectorDialect",
    ],
)

cc_library(
    name = "TestMathToVCIX",
    srcs = glob(["lib/Conversion/MathToVCIX/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:ArithDialect",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:MathDialect",
        "//mlir:Pass",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:VCIXDialect",
        "//mlir:VectorDialect",
    ],
)

cc_library(
    name = "TestMemRef",
    srcs = glob(["lib/Dialect/MemRef/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        ":TestDialect",
        "//mlir:AffineDialect",
        "//mlir:ArithDialect",
        "//mlir:ArithTransforms",
        "//mlir:FuncDialect",
        "//mlir:MemRefDialect",
        "//mlir:MemRefTransforms",
        "//mlir:Pass",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:VectorDialect",
        "//mlir:VectorTransforms",
    ],
)

cc_library(
    name = "TestMesh",
    srcs = glob(["lib/Dialect/Mesh/**/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        ":TestDialect",
        "//mlir:ArithDialect",
        "//mlir:DialectUtils",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:MeshDialect",
        "//mlir:MeshTransforms",
        "//mlir:Pass",
        "//mlir:SPIRVDialect",
        "//mlir:Support",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestNVGPU",
    srcs = glob(["lib/Dialect/NVGPU/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:AffineDialect",
        "//mlir:Analysis",
        "//mlir:FuncDialect",
        "//mlir:GPUDialect",
        "//mlir:IR",
        "//mlir:LLVMDialect",
        "//mlir:LinalgDialect",
        "//mlir:LinalgTransforms",
        "//mlir:MemRefDialect",
        "//mlir:NVGPUDialect",
        "//mlir:NVGPUTransforms",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:Support",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestSCF",
    srcs = glob(["lib/Dialect/SCF/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//llvm:Support",
        "//mlir:ArithDialect",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:MathDialect",
        "//mlir:MemRefDialect",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:SCFTransforms",
        "//mlir:SCFUtils",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestArith",
    srcs = glob(["lib/Dialect/Arith/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:ArithDialect",
        "//mlir:ArithTransforms",
        "//mlir:FuncDialect",
        "//mlir:LLVMDialect",
        "//mlir:MathDialect",
        "//mlir:Pass",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:VectorDialect",
    ],
)

cc_library(
    name = "TestArmNeon",
    srcs = glob(["lib/Dialect/ArmNeon/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:ArmNeonDialect",
        "//mlir:ArmNeonTransforms",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:Pass",
        "//mlir:Support",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestArmSME",
    srcs = glob(["lib/Dialect/ArmSME/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:ArithToArmSME",
        "//mlir:ArmSMEToLLVM",
        "//mlir:ArmSMEToSCF",
        "//mlir:ArmSMETransforms",
        "//mlir:ArmSVETransforms",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:Pass",
        "//mlir:SCFToControlFlow",
        "//mlir:Transforms",
        "//mlir:VectorToArmSME",
        "//mlir:VectorToSCF",
    ],
)

cc_library(
    name = "TestBufferization",
    srcs = glob(["lib/Dialect/Bufferization/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:BufferizationDialect",
        "//mlir:BufferizationTransforms",
        "//mlir:IR",
        "//mlir:Pass",
    ],
)

cc_library(
    name = "TestControlFlow",
    srcs = glob(["lib/Dialect/ControlFlow/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:ControlFlowDialect",
        "//mlir:ControlFlowToLLVM",
        "//mlir:FuncDialect",
        "//mlir:LLVMCommonConversion",
        "//mlir:LLVMDialect",
        "//mlir:Pass",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestShapeDialect",
    srcs = [
        "lib/Dialect/Shape/TestShapeFunctions.cpp",
        "lib/Dialect/Shape/TestShapeMappingAnalysis.cpp",
    ],
    deps = [
        "//llvm:Support",
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:InferTypeOpInterface",
        "//mlir:Pass",
        "//mlir:ShapeDialect",
        "//mlir:ShapeTransforms",
    ],
)

cc_library(
    name = "TestSPIRV",
    srcs = glob([
        "lib/Dialect/SPIRV/*.cpp",
    ]),
    deps = [
        "//mlir:FuncDialect",
        "//mlir:GPUDialect",
        "//mlir:IR",
        "//mlir:Pass",
        "//mlir:SPIRVConversion",
        "//mlir:SPIRVDialect",
        "//mlir:SPIRVModuleCombiner",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestFunc",
    srcs = glob(["lib/Dialect/Func/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        ":TestDialect",
        "//mlir:AffineDialect",
        "//mlir:FuncDialect",
        "//mlir:FuncTransforms",
        "//mlir:IR",
        "//mlir:Pass",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestTensor",
    srcs = glob(["lib/Dialect/Tensor/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:ArithDialect",
        "//mlir:LinalgDialect",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:TensorDialect",
        "//mlir:TensorTransforms",
        "//mlir:TransformDialect",
        "//mlir:TransformDialectInterfaces",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

cc_library(
    name = "TestVector",
    srcs = glob(["lib/Dialect/Vector/*.cpp"]),
    includes = ["lib/Dialect/Test"],
    deps = [
        "//mlir:AffineDialect",
        "//mlir:Analysis",
        "//mlir:ArithDialect",
        "//mlir:FuncDialect",
        "//mlir:GPUDialect",
        "//mlir:LLVMDialect",
        "//mlir:LinalgDialect",
        "//mlir:LinalgTransforms",
        "//mlir:MemRefDialect",
        "//mlir:NVGPUDialect",
        "//mlir:Pass",
        "//mlir:SCFDialect",
        "//mlir:Support",
        "//mlir:TensorDialect",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
        "//mlir:VectorDialect",
        "//mlir:VectorToSCF",
        "//mlir:VectorTransforms",
        "//mlir:X86VectorDialect",
    ],
)

cc_library(
    name = "TestTosaDialect",
    srcs = glob([
        "lib/Dialect/Tosa/*.cpp",
    ]),
    deps = [
        "//mlir:FuncDialect",
        "//mlir:IR",
        "//mlir:Pass",
        "//mlir:TensorDialect",
        "//mlir:TosaDialect",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)

gentbl_cc_library(
    name = "TestPDLLPatternsIncGen",
    includes = ["lib/Dialect/Test"],
    strip_include_prefix = "lib",
    tbl_outs = [
        (
            ["-x=cpp"],
            "lib/Tools/PDLL/TestPDLLPatterns.h.inc",
        ),
    ],
    tblgen = "//mlir:mlir-pdll",
    td_file = "lib/Tools/PDLL/TestPDLL.pdll",
    deps = [
        ":TestDialect",
        ":TestOpTdFiles",
    ],
)

gentbl_cc_library(
    name = "TestDialectConversionPDLLPatternsIncGen",
    includes = ["lib/Dialect/Test"],
    strip_include_prefix = "lib",
    tbl_outs = [
        (
            ["-x=cpp"],
            "lib/TestDialectConversionPDLLPatterns.h.inc",
        ),
    ],
    tblgen = "//mlir:mlir-pdll",
    td_file = "lib/Transforms/TestDialectConversion.pdll",
    deps = [
        ":TestDialect",
        ":TestOpTdFiles",
        "//mlir:DialectConversionPdllFiles",
    ],
)

cc_library(
    name = "TestPDLL",
    srcs = ["lib/Tools/PDLL/TestPDLL.cpp"],
    includes = ["lib/Tools/PDLL"],
    deps = [
        ":TestDialect",
        ":TestPDLLPatternsIncGen",
        "//mlir:CastInterfaces",
        "//mlir:IR",
        "//mlir:PDLDialect",
        "//mlir:PDLInterpDialect",
        "//mlir:Parser",
        "//mlir:Pass",
        "//mlir:Support",
        "//mlir:TransformUtils",
        "//mlir:Transforms",
    ],
)