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