436 lines · plain
1# This file is licensed under the Apache License v2.0 with LLVM Exceptions.2# See https://llvm.org/LICENSE.txt for license information.3# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception4 5load("@rules_cc//cc:defs.bzl", "cc_test")6load("//mlir:tblgen.bzl", "gentbl_cc_library")7 8package(9 default_visibility = ["//visibility:public"],10 features = ["layering_check"],11)12 13licenses(["notice"])14 15cc_test(16 name = "debug_tests",17 size = "small",18 srcs = glob([19 "Debug/*.cpp",20 ]),21 deps = [22 "//llvm:Support",23 "//llvm:TestingSupport",24 "//mlir:Debug",25 "//mlir:IR",26 "//mlir:Support",27 "//third-party/unittest:gmock",28 "//third-party/unittest:gtest",29 "//third-party/unittest:gtest_main",30 ],31)32 33cc_test(34 name = "ir_tests",35 size = "small",36 srcs = glob([37 "IR/*.cpp",38 ]),39 deps = [40 "//llvm:Core",41 "//llvm:Remarks",42 "//llvm:Support",43 "//mlir:BytecodeReader",44 "//mlir:CallOpInterfaces",45 "//mlir:FunctionInterfaces",46 "//mlir:IR",47 "//mlir:MemRefDialect",48 "//mlir:Parser",49 "//mlir:RemarkStreamer",50 "//mlir:Support",51 "//mlir/test:TestDialect",52 "//third-party/unittest:gmock",53 "//third-party/unittest:gtest",54 "//third-party/unittest:gtest_main",55 ],56)57 58cc_test(59 name = "interface_tests",60 size = "small",61 srcs = glob([62 "Interfaces/*.cpp",63 ]),64 deps = [65 "//llvm:Support",66 "//llvm:TestingSupport",67 "//mlir:ArithDialect",68 "//mlir:BytecodeReader",69 "//mlir:ControlFlowInterfaces",70 "//mlir:DLTIDialect",71 "//mlir:DataLayoutInterfaces",72 "//mlir:FuncDialect",73 "//mlir:IR",74 "//mlir:InferIntRangeInterface",75 "//mlir:InferTypeOpInterface",76 "//mlir:Parser",77 "//third-party/unittest:gtest",78 "//third-party/unittest:gtest_main",79 ],80)81 82cc_test(83 name = "support_tests",84 size = "small",85 srcs = glob([86 "Support/*.cpp",87 ]),88 deps = [89 "//llvm:Support",90 "//llvm:TestingSupport",91 "//mlir:Support",92 "//third-party/unittest:gmock",93 "//third-party/unittest:gtest_main",94 ],95)96 97cc_test(98 name = "pass_tests",99 size = "small",100 srcs = glob([101 "Pass/*.cpp",102 ]),103 deps = [104 "//llvm:Support",105 "//llvm:TestingSupport",106 "//mlir:Analysis",107 "//mlir:Debug",108 "//mlir:FuncDialect",109 "//mlir:IR",110 "//mlir:Pass",111 "//third-party/unittest:gtest",112 "//third-party/unittest:gtest_main",113 ],114)115 116cc_test(117 name = "rewrite_tests",118 size = "small",119 srcs = glob([120 "Rewrite/*.cpp",121 ]),122 deps = [123 "//mlir:IR",124 "//mlir:Rewrite",125 "//mlir:SideEffectInterfaces",126 "//third-party/unittest:gtest",127 "//third-party/unittest:gtest_main",128 ],129)130 131cc_test(132 name = "dialect_tests",133 size = "small",134 srcs = glob([135 "Dialect/*.cpp",136 ]),137 deps = [138 "//llvm:Support",139 "//mlir:Dialect",140 "//third-party/unittest:gmock",141 "//third-party/unittest:gtest_main",142 ],143)144 145cc_test(146 name = "amdgpu_tests",147 size = "small",148 srcs = glob([149 "Dialect/AMDGPU/*.cpp",150 ]),151 deps = [152 "//mlir:AMDGPUUtils",153 "//third-party/unittest:gtest",154 "//third-party/unittest:gtest_main",155 ],156)157 158cc_test(159 name = "memref_tests",160 size = "small",161 srcs = glob([162 "Dialect/MemRef/*.cpp",163 ]),164 deps = [165 "//llvm:TestingSupport",166 "//mlir:IR",167 "//mlir:MemRefDialect",168 "//mlir:SideEffectInterfaces",169 "//third-party/unittest:gtest",170 "//third-party/unittest:gtest_main",171 ],172)173 174cc_test(175 name = "scf_tests",176 size = "small",177 srcs = glob([178 "Dialect/SCF/*.cpp",179 ]),180 deps = [181 "//mlir:AffineDialect",182 "//mlir:ArithDialect",183 "//mlir:DialectUtils",184 "//mlir:FuncDialect",185 "//mlir:IR",186 "//mlir:LoopLikeInterface",187 "//mlir:Parser",188 "//mlir:SCFDialect",189 "//mlir:SCFUtils",190 "//mlir:SideEffectInterfaces",191 "//third-party/unittest:gtest",192 "//third-party/unittest:gtest_main",193 ],194)195 196cc_test(197 name = "sparse_tensor_tests",198 size = "small",199 srcs = glob([200 "Dialect/SparseTensor/*.cpp",201 ]),202 deps = [203 "//llvm:Support",204 "//llvm:TestingSupport",205 "//mlir:SideEffectInterfaces",206 "//mlir:SparseTensorUtils",207 "//third-party/unittest:gmock",208 "//third-party/unittest:gtest",209 "//third-party/unittest:gtest_main",210 ],211)212 213cc_test(214 name = "spirv_tests",215 size = "small",216 srcs = glob([217 "Dialect/SPIRV/*.cpp",218 ]),219 deps = [220 "//llvm:Support",221 "//llvm:TestingSupport",222 "//mlir:IR",223 "//mlir:SPIRVBinaryUtils",224 "//mlir:SPIRVDeserialization",225 "//mlir:SPIRVDialect",226 "//mlir:SPIRVSerialization",227 "//third-party/unittest:gmock",228 "//third-party/unittest:gtest_main",229 ],230)231 232cc_test(233 name = "transform_dialect_tests",234 size = "small",235 srcs = glob([236 "Dialect/Transform/*.cpp",237 ]),238 deps = [239 "//llvm:Support",240 "//llvm:TestingSupport",241 "//mlir:BytecodeReader",242 "//mlir:FuncDialect",243 "//mlir:IR",244 "//mlir:MlirOptLib",245 "//mlir:Parser",246 "//mlir:Pass",247 "//mlir:Support",248 "//mlir:TransformDebugExtension",249 "//mlir:TransformDialect",250 "//mlir:TransformDialectTransforms",251 "//mlir/test:TestTransformDialect",252 "//third-party/unittest:gtest",253 "//third-party/unittest:gtest_main",254 ],255)256 257cc_test(258 name = "dialect_utils_tests",259 size = "small",260 srcs = glob([261 "Dialect/Utils/*.cpp",262 ]),263 deps = [264 "//llvm:Support",265 "//llvm:TestingSupport",266 "//mlir:DialectUtils",267 "//mlir:IR",268 "//third-party/unittest:gmock",269 "//third-party/unittest:gtest",270 "//third-party/unittest:gtest_main",271 ],272)273 274gentbl_cc_library(275 name = "EnumsIncGen",276 tbl_outs = {277 "TableGen/EnumsGenTest.h.inc": ["-gen-enum-decls"],278 "TableGen/EnumsGenTest.cpp.inc": ["-gen-enum-defs"],279 },280 tblgen = "//mlir:mlir-tblgen",281 td_file = "TableGen/enums.td",282 deps = [283 "//mlir:OpBaseTdFiles",284 ],285)286 287gentbl_cc_library(288 name = "PassIncGen",289 tbl_outs = {"TableGen/PassGenTest.h.inc": ["-gen-pass-decls"]},290 tblgen = "//mlir:mlir-tblgen",291 td_file = "TableGen/passes.td",292 deps = [293 "//mlir:PassBaseTdFiles",294 "//mlir:RewritePassBaseTdFiles",295 ],296)297 298cc_test(299 name = "tablegen_tests",300 size = "small",301 srcs = glob([302 "TableGen/*.cpp",303 ]) + [304 "TableGen/EnumsGenTest.cpp.inc",305 "TableGen/EnumsGenTest.h.inc",306 ],307 includes = ["TableGen/"],308 deps = [309 ":EnumsIncGen",310 ":PassIncGen",311 "//llvm:Support",312 "//llvm:TestingSupport",313 "//mlir:IR",314 "//mlir:Pass",315 "//mlir:Support",316 "//mlir:TableGen",317 "//mlir/test:TestDialect",318 "//third-party/unittest:gmock",319 "//third-party/unittest:gtest_main",320 ],321)322 323cc_test(324 name = "transforms_test",325 size = "small",326 srcs = glob([327 "Transforms/*.cpp",328 ]),329 deps = [330 "//mlir:AffineAnalysis",331 "//mlir:BytecodeReader",332 "//mlir:IR",333 "//mlir:Parser",334 "//mlir:Pass",335 "//mlir:SideEffectInterfaces",336 "//mlir:TransformUtils",337 "//mlir:Transforms",338 "//third-party/unittest:gtest",339 "//third-party/unittest:gtest_main",340 ],341)342 343cc_test(344 name = "analysis_tests",345 size = "small",346 srcs = glob([347 "Analysis/*/*.cpp",348 "Analysis/*/*.h",349 ]),350 deps = [351 "//llvm:TestingSupport",352 "//mlir:AffineAnalysis",353 "//mlir:Analysis",354 "//mlir:AsmParser",355 "//mlir:IR",356 "//mlir:Parser",357 "//mlir:Support",358 "//third-party/unittest:gmock",359 "//third-party/unittest:gtest",360 "//third-party/unittest:gtest_main",361 ],362)363 364cc_test(365 name = "bytecode_tests",366 size = "small",367 srcs = glob([368 "Bytecode/*.cpp",369 ]),370 deps = [371 "//llvm:Support",372 "//mlir:BytecodeReader",373 "//mlir:BytecodeWriter",374 "//mlir:IR",375 "//mlir:Parser",376 "//mlir:SideEffectInterfaces",377 "//third-party/unittest:gmock",378 "//third-party/unittest:gtest",379 "//third-party/unittest:gtest_main",380 ],381)382 383cc_test(384 name = "conversion_tests",385 size = "small",386 srcs = glob([387 "Conversion/*/*.cpp",388 ]),389 deps = [390 "//mlir:ArithDialect",391 "//mlir:IR",392 "//mlir:PDLToPDLInterp",393 "//third-party/unittest:gtest",394 "//third-party/unittest:gtest_main",395 ],396)397 398cc_test(399 name = "execution_engine_tests",400 size = "small",401 srcs = glob([402 "ExecutionEngine/*.cpp",403 ]),404 tags = [405 # MSAN does not work with JIT.406 "nomsan",407 ],408 deps = [409 "//llvm:Support",410 "//llvm:TestingSupport",411 "//mlir:AllPassesAndDialects",412 "//mlir:Analysis",413 "//mlir:ArithToLLVM",414 "//mlir:BuiltinToLLVMIRTranslation",415 "//mlir:BytecodeReader",416 "//mlir:ExecutionEngine",417 "//mlir:FuncDialect",418 "//mlir:FuncToLLVM",419 "//mlir:IR",420 "//mlir:LLVMToLLVMIRTranslation",421 "//mlir:LinalgTransforms",422 "//mlir:MemRefToLLVM",423 "//mlir:Parser",424 "//mlir:Pass",425 "//mlir:ReconcileUnrealizedCasts",426 "//mlir:RegisterAllDialects",427 "//mlir:ToLLVMIRTranslation",428 "//mlir:VectorToLLVM",429 "//mlir:VectorToSCF",430 "//mlir:mlir_c_runner_utils",431 "//mlir:mlir_runner_utils",432 "//third-party/unittest:gmock",433 "//third-party/unittest:gtest_main",434 ],435)436