forked from OSchip/llvm-project
[Bazel] Add lit tests to bazel builds.
Add BUILD.bazel files for most of the MLIR tests and lit tests itself. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D133455
This commit is contained in:
parent
03a102e3b2
commit
70ac466676
|
@ -0,0 +1,49 @@
|
|||
# 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
|
||||
"""Rules for running lit tests."""
|
||||
|
||||
load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||
|
||||
def lit_test(
|
||||
name,
|
||||
srcs,
|
||||
args = None,
|
||||
data = None,
|
||||
**kwargs):
|
||||
"""Runs a single test file with LLVM's lit tool.
|
||||
|
||||
Args:
|
||||
name: string. the name of the generated test target.
|
||||
srcs: label list. The files on which to run lit.
|
||||
args: string list. Additional arguments to pass to lit.
|
||||
Note that `-v` and the 'srcs' paths are added automatically.
|
||||
data: label list. Additional data dependencies of the test.
|
||||
Note that 'srcs' targets are added automatically.
|
||||
**kwargs: additional keyword arguments.
|
||||
|
||||
See https://llvm.org/docs/CommandGuide/lit.html for details on lit.
|
||||
"""
|
||||
|
||||
args = args or []
|
||||
data = data or []
|
||||
|
||||
native.py_test(
|
||||
name = name,
|
||||
srcs = ["//llvm:lit"],
|
||||
main = "//llvm:utils/lit/lit.py",
|
||||
args = args + ["-v"] + ["$(execpath %s)" % src for src in srcs],
|
||||
data = data + srcs,
|
||||
legacy_create_init = False,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def package_path(label):
|
||||
"""Returns the path to the package of 'label'.
|
||||
|
||||
Args:
|
||||
label: label. The label to return the package path of.
|
||||
|
||||
For example, package_path("@foo//bar:BUILD") returns 'external/foo/bar'.
|
||||
"""
|
||||
return paths.join(Label(label).workspace_root, Label(label).package)
|
|
@ -0,0 +1,37 @@
|
|||
# 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("//llvm:template_rule.bzl", "template_rule")
|
||||
load("//llvm:lit_test.bzl", "lit_test", "package_path")
|
||||
|
||||
template_rule(
|
||||
name = "lit_site_cfg",
|
||||
testonly = True,
|
||||
src = "lit.site.cfg.in",
|
||||
out = "lit.site.cfg",
|
||||
substitutions = {
|
||||
"@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.",
|
||||
"@LLVM_LIT_TOOLS_DIR@": package_path("//llvm/utils/lit:BUILD"),
|
||||
"@LLVM_SOURCE_DIR@": package_path("//llvm:BUILD"),
|
||||
"@LLVM_BINARY_DIR@": package_path("//llvm:BUILD"),
|
||||
"@LLVM_TOOLS_DIR@": package_path("//llvm:BUILD"),
|
||||
},
|
||||
)
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
args = ["--path %s" % package_path("//llvm:BUILD")],
|
||||
data = [
|
||||
"lit.cfg",
|
||||
"lit.site.cfg",
|
||||
"check-tested-lit-timeout-ability",
|
||||
"//llvm:FileCheck",
|
||||
"//llvm:count",
|
||||
"//llvm:not",
|
||||
] + glob(["Inputs/**"]),
|
||||
)
|
||||
for src in glob(["*/*.py"])
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Description:
|
||||
# MLIR Tutorial
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
cc_binary(
|
||||
name = "toyc-ch1",
|
||||
srcs = [
|
||||
"toyc.cpp",
|
||||
"parser/AST.cpp",
|
||||
] + glob(["include/toy/*"]),
|
||||
includes = ["include/"],
|
||||
deps = [
|
||||
"//llvm:Support",
|
||||
"//mlir:Support",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,66 @@
|
|||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
td_library(
|
||||
name = "ToyOpsTdFiles",
|
||||
srcs = [
|
||||
"include/toy/Ops.td",
|
||||
],
|
||||
includes = ["include"],
|
||||
deps = [
|
||||
"//mlir:FunctionInterfacesTdFiles",
|
||||
"//mlir:OpBaseTdFiles",
|
||||
"//mlir:SideEffectInterfacesTdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyOpsIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-decls"],
|
||||
"include/toy/Ops.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-defs"],
|
||||
"include/toy/Ops.cpp.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-decls"],
|
||||
"include/toy/Dialect.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-defs"],
|
||||
"include/toy/Dialect.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/Ops.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "toyc-ch2",
|
||||
srcs = [
|
||||
"toyc.cpp",
|
||||
"parser/AST.cpp",
|
||||
"mlir/MLIRGen.cpp",
|
||||
"mlir/Dialect.cpp",
|
||||
] + glob(["include/toy/*.h"]),
|
||||
includes = ["include/"],
|
||||
deps = [
|
||||
":ToyOpsIncGen",
|
||||
"//llvm:Support",
|
||||
"//mlir:Analysis",
|
||||
"//mlir:IR",
|
||||
"//mlir:Parser",
|
||||
"//mlir:SideEffectInterfaces",
|
||||
"//mlir:Support",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,84 @@
|
|||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
td_library(
|
||||
name = "ToyOpsTdFiles",
|
||||
srcs = [
|
||||
"include/toy/Ops.td",
|
||||
],
|
||||
includes = ["include"],
|
||||
deps = [
|
||||
"//mlir:FunctionInterfacesTdFiles",
|
||||
"//mlir:OpBaseTdFiles",
|
||||
"//mlir:SideEffectInterfacesTdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyOpsIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-decls"],
|
||||
"include/toy/Ops.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-defs"],
|
||||
"include/toy/Ops.cpp.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-decls"],
|
||||
"include/toy/Dialect.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-defs"],
|
||||
"include/toy/Dialect.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/Ops.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyCombineIncGen",
|
||||
strip_include_prefix = "mlir",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-rewriters"],
|
||||
"mlir/ToyCombine.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "mlir/ToyCombine.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "toyc-ch3",
|
||||
srcs = [
|
||||
"toyc.cpp",
|
||||
"parser/AST.cpp",
|
||||
"mlir/MLIRGen.cpp",
|
||||
"mlir/Dialect.cpp",
|
||||
"mlir/ToyCombine.cpp",
|
||||
] + glob(["include/toy/*.h"]),
|
||||
includes = ["include/"],
|
||||
deps = [
|
||||
":ToyCombineIncGen",
|
||||
":ToyOpsIncGen",
|
||||
"//llvm:Support",
|
||||
"//mlir:Analysis",
|
||||
"//mlir:IR",
|
||||
"//mlir:Parser",
|
||||
"//mlir:Pass",
|
||||
"//mlir:SideEffectInterfaces",
|
||||
"//mlir:Support",
|
||||
"//mlir:Transforms",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,108 @@
|
|||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
td_library(
|
||||
name = "ToyOpsTdFiles",
|
||||
srcs = [
|
||||
"include/toy/Ops.td",
|
||||
"include/toy/ShapeInferenceInterface.td",
|
||||
],
|
||||
includes = ["include"],
|
||||
deps = [
|
||||
"//mlir:CallInterfacesTdFiles",
|
||||
"//mlir:CastInterfacesTdFiles",
|
||||
"//mlir:FunctionInterfacesTdFiles",
|
||||
"//mlir:OpBaseTdFiles",
|
||||
"//mlir:SideEffectInterfacesTdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyInterfacesIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-interface-decls"],
|
||||
"include/toy/ShapeInferenceOpInterfaces.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-interface-defs"],
|
||||
"include/toy/ShapeInferenceOpInterfaces.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/ShapeInferenceInterface.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyOpsIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-decls"],
|
||||
"include/toy/Ops.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-defs"],
|
||||
"include/toy/Ops.cpp.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-decls"],
|
||||
"include/toy/Dialect.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-defs"],
|
||||
"include/toy/Dialect.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/Ops.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyCombineIncGen",
|
||||
strip_include_prefix = "mlir",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-rewriters"],
|
||||
"mlir/ToyCombine.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "mlir/ToyCombine.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "toyc-ch4",
|
||||
srcs = [
|
||||
"toyc.cpp",
|
||||
"parser/AST.cpp",
|
||||
"mlir/MLIRGen.cpp",
|
||||
"mlir/Dialect.cpp",
|
||||
"mlir/ToyCombine.cpp",
|
||||
"mlir/ShapeInferencePass.cpp",
|
||||
] + glob(["include/toy/*.h"]),
|
||||
includes = ["include/"],
|
||||
deps = [
|
||||
":ToyCombineIncGen",
|
||||
":ToyInterfacesIncGen",
|
||||
":ToyOpsIncGen",
|
||||
"//llvm:Support",
|
||||
"//mlir:Analysis",
|
||||
"//mlir:CastOpInterfaces",
|
||||
"//mlir:IR",
|
||||
"//mlir:Parser",
|
||||
"//mlir:Pass",
|
||||
"//mlir:SideEffectInterfaces",
|
||||
"//mlir:Support",
|
||||
"//mlir:TransformUtils",
|
||||
"//mlir:Transforms",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,115 @@
|
|||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
td_library(
|
||||
name = "ToyOpsTdFiles",
|
||||
srcs = [
|
||||
"include/toy/Ops.td",
|
||||
"include/toy/ShapeInferenceInterface.td",
|
||||
],
|
||||
includes = ["include"],
|
||||
deps = [
|
||||
"//mlir:CallInterfacesTdFiles",
|
||||
"//mlir:CastInterfacesTdFiles",
|
||||
"//mlir:FunctionInterfacesTdFiles",
|
||||
"//mlir:OpBaseTdFiles",
|
||||
"//mlir:SideEffectInterfacesTdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyInterfacesIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-interface-decls"],
|
||||
"include/toy/ShapeInferenceOpInterfaces.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-interface-defs"],
|
||||
"include/toy/ShapeInferenceOpInterfaces.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/ShapeInferenceInterface.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyOpsIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-decls"],
|
||||
"include/toy/Ops.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-defs"],
|
||||
"include/toy/Ops.cpp.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-decls"],
|
||||
"include/toy/Dialect.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-defs"],
|
||||
"include/toy/Dialect.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/Ops.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyCombineIncGen",
|
||||
strip_include_prefix = "mlir",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-rewriters"],
|
||||
"mlir/ToyCombine.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "mlir/ToyCombine.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "toyc-ch5",
|
||||
srcs = [
|
||||
"toyc.cpp",
|
||||
"parser/AST.cpp",
|
||||
"mlir/MLIRGen.cpp",
|
||||
"mlir/Dialect.cpp",
|
||||
"mlir/LowerToAffineLoops.cpp",
|
||||
"mlir/ToyCombine.cpp",
|
||||
"mlir/ShapeInferencePass.cpp",
|
||||
] + glob(["include/toy/*.h"]),
|
||||
includes = ["include/"],
|
||||
deps = [
|
||||
":ToyCombineIncGen",
|
||||
":ToyInterfacesIncGen",
|
||||
":ToyOpsIncGen",
|
||||
"//llvm:Support",
|
||||
"//mlir:AffineDialect",
|
||||
"//mlir:AffineTransforms",
|
||||
"//mlir:AllPassesAndDialects",
|
||||
"//mlir:Analysis",
|
||||
"//mlir:ArithmeticDialect",
|
||||
"//mlir:CastOpInterfaces",
|
||||
"//mlir:FuncDialect",
|
||||
"//mlir:IR",
|
||||
"//mlir:MemRefDialect",
|
||||
"//mlir:Parser",
|
||||
"//mlir:Pass",
|
||||
"//mlir:SideEffectInterfaces",
|
||||
"//mlir:Support",
|
||||
"//mlir:TransformUtils",
|
||||
"//mlir:Transforms",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,130 @@
|
|||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
td_library(
|
||||
name = "ToyOpsTdFiles",
|
||||
srcs = [
|
||||
"include/toy/Ops.td",
|
||||
"include/toy/ShapeInferenceInterface.td",
|
||||
],
|
||||
includes = ["include"],
|
||||
deps = [
|
||||
"//mlir:CallInterfacesTdFiles",
|
||||
"//mlir:CastInterfacesTdFiles",
|
||||
"//mlir:FunctionInterfacesTdFiles",
|
||||
"//mlir:OpBaseTdFiles",
|
||||
"//mlir:SideEffectInterfacesTdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyInterfacesIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-interface-decls"],
|
||||
"include/toy/ShapeInferenceOpInterfaces.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-interface-defs"],
|
||||
"include/toy/ShapeInferenceOpInterfaces.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/ShapeInferenceInterface.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyOpsIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-decls"],
|
||||
"include/toy/Ops.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-defs"],
|
||||
"include/toy/Ops.cpp.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-decls"],
|
||||
"include/toy/Dialect.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-defs"],
|
||||
"include/toy/Dialect.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/Ops.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyCombineIncGen",
|
||||
strip_include_prefix = "mlir",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-rewriters"],
|
||||
"mlir/ToyCombine.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "mlir/ToyCombine.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "toyc-ch6",
|
||||
srcs = [
|
||||
"toyc.cpp",
|
||||
"parser/AST.cpp",
|
||||
"mlir/MLIRGen.cpp",
|
||||
"mlir/Dialect.cpp",
|
||||
"mlir/LowerToAffineLoops.cpp",
|
||||
"mlir/LowerToLLVM.cpp",
|
||||
"mlir/ToyCombine.cpp",
|
||||
"mlir/ShapeInferencePass.cpp",
|
||||
] + glob(["include/toy/*.h"]),
|
||||
includes = ["include/"],
|
||||
deps = [
|
||||
":ToyCombineIncGen",
|
||||
":ToyInterfacesIncGen",
|
||||
":ToyOpsIncGen",
|
||||
"//llvm:Core",
|
||||
"//llvm:Support",
|
||||
"//mlir:AffineDialect",
|
||||
"//mlir:AffineToStandard",
|
||||
"//mlir:AffineTransforms",
|
||||
"//mlir:AllPassesAndDialects",
|
||||
"//mlir:Analysis",
|
||||
"//mlir:ArithmeticDialect",
|
||||
"//mlir:ArithmeticToLLVM",
|
||||
"//mlir:CastOpInterfaces",
|
||||
"//mlir:ControlFlowToLLVM",
|
||||
"//mlir:ExecutionEngine",
|
||||
"//mlir:ExecutionEngineUtils",
|
||||
"//mlir:FuncDialect",
|
||||
"//mlir:FuncToLLVM",
|
||||
"//mlir:IR",
|
||||
"//mlir:LLVMCommonConversion",
|
||||
"//mlir:LLVMDialect",
|
||||
"//mlir:LLVMToLLVMIRTranslation",
|
||||
"//mlir:MemRefDialect",
|
||||
"//mlir:MemRefToLLVM",
|
||||
"//mlir:Parser",
|
||||
"//mlir:Pass",
|
||||
"//mlir:SCFDialect",
|
||||
"//mlir:SCFToControlFlow",
|
||||
"//mlir:SideEffectInterfaces",
|
||||
"//mlir:Support",
|
||||
"//mlir:ToLLVMIRTranslation",
|
||||
"//mlir:TransformUtils",
|
||||
"//mlir:Transforms",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,130 @@
|
|||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
td_library(
|
||||
name = "ToyOpsTdFiles",
|
||||
srcs = [
|
||||
"include/toy/Ops.td",
|
||||
"include/toy/ShapeInferenceInterface.td",
|
||||
],
|
||||
includes = ["include"],
|
||||
deps = [
|
||||
"//mlir:CallInterfacesTdFiles",
|
||||
"//mlir:CastInterfacesTdFiles",
|
||||
"//mlir:FunctionInterfacesTdFiles",
|
||||
"//mlir:OpBaseTdFiles",
|
||||
"//mlir:SideEffectInterfacesTdFiles",
|
||||
],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyInterfacesIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-interface-decls"],
|
||||
"include/toy/ShapeInferenceOpInterfaces.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-interface-defs"],
|
||||
"include/toy/ShapeInferenceOpInterfaces.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/ShapeInferenceInterface.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyOpsIncGen",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-op-decls"],
|
||||
"include/toy/Ops.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-op-defs"],
|
||||
"include/toy/Ops.cpp.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-decls"],
|
||||
"include/toy/Dialect.h.inc",
|
||||
),
|
||||
(
|
||||
["-gen-dialect-defs"],
|
||||
"include/toy/Dialect.cpp.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "include/toy/Ops.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
gentbl_cc_library(
|
||||
name = "ToyCombineIncGen",
|
||||
strip_include_prefix = "mlir",
|
||||
tbl_outs = [
|
||||
(
|
||||
["-gen-rewriters"],
|
||||
"mlir/ToyCombine.inc",
|
||||
),
|
||||
],
|
||||
tblgen = "//mlir:mlir-tblgen",
|
||||
td_file = "mlir/ToyCombine.td",
|
||||
deps = [":ToyOpsTdFiles"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "toyc-ch7",
|
||||
srcs = [
|
||||
"toyc.cpp",
|
||||
"parser/AST.cpp",
|
||||
"mlir/MLIRGen.cpp",
|
||||
"mlir/Dialect.cpp",
|
||||
"mlir/LowerToAffineLoops.cpp",
|
||||
"mlir/LowerToLLVM.cpp",
|
||||
"mlir/ToyCombine.cpp",
|
||||
"mlir/ShapeInferencePass.cpp",
|
||||
] + glob(["include/toy/*.h"]),
|
||||
includes = ["include/"],
|
||||
deps = [
|
||||
":ToyCombineIncGen",
|
||||
":ToyInterfacesIncGen",
|
||||
":ToyOpsIncGen",
|
||||
"//llvm:Core",
|
||||
"//llvm:Support",
|
||||
"//mlir:AffineDialect",
|
||||
"//mlir:AffineToStandard",
|
||||
"//mlir:AffineTransforms",
|
||||
"//mlir:AllPassesAndDialects",
|
||||
"//mlir:Analysis",
|
||||
"//mlir:ArithmeticDialect",
|
||||
"//mlir:ArithmeticToLLVM",
|
||||
"//mlir:CastOpInterfaces",
|
||||
"//mlir:ControlFlowToLLVM",
|
||||
"//mlir:ExecutionEngine",
|
||||
"//mlir:ExecutionEngineUtils",
|
||||
"//mlir:FuncDialect",
|
||||
"//mlir:FuncToLLVM",
|
||||
"//mlir:IR",
|
||||
"//mlir:LLVMCommonConversion",
|
||||
"//mlir:LLVMDialect",
|
||||
"//mlir:LLVMToLLVMIRTranslation",
|
||||
"//mlir:MemRefDialect",
|
||||
"//mlir:MemRefToLLVM",
|
||||
"//mlir:Parser",
|
||||
"//mlir:Pass",
|
||||
"//mlir:SCFDialect",
|
||||
"//mlir:SCFToControlFlow",
|
||||
"//mlir:SideEffectInterfaces",
|
||||
"//mlir:Support",
|
||||
"//mlir:ToLLVMIRTranslation",
|
||||
"//mlir:TransformUtils",
|
||||
"//mlir:Transforms",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,17 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(["**/*.mlir"])
|
||||
]
|
|
@ -3,6 +3,8 @@
|
|||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
load("//llvm:lit_test.bzl", "package_path")
|
||||
load("//llvm:template_rule.bzl", "template_rule")
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
|
@ -11,6 +13,48 @@ package(
|
|||
|
||||
licenses(["notice"])
|
||||
|
||||
template_rule(
|
||||
name = "lit_site_cfg_py",
|
||||
testonly = True,
|
||||
src = "lit.site.cfg.py.in",
|
||||
out = "lit.site.cfg.py",
|
||||
substitutions = {
|
||||
"@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.",
|
||||
"@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",
|
||||
"@MLIR_ENABLE_CUDA_CONVERSIONS@": "0",
|
||||
"@MLIR_ENABLE_CUDA_RUNNER@": "0",
|
||||
"@MLIR_ENABLE_ROCM_CONVERSIONS@": "0",
|
||||
"@MLIR_ENABLE_ROCM_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_X86VECTOR_TESTS@": "0",
|
||||
"@MLIR_RUN_CUDA_TENSOR_CORE_TESTS@": "0",
|
||||
"@MLIR_INCLUDE_INTEGRATION_TESTS@": "0",
|
||||
},
|
||||
)
|
||||
|
||||
# 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"],
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(
|
||||
include = ["**/*.mlir"],
|
||||
exclude = ["GPUToROCm/lower-rocdl-kernel-to-hsaco.mlir"],
|
||||
)
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//llvm:llvm-symbolizer",
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(["**/*.mlir"])
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(["**/*.mlir"])
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(["**/*.mlir"])
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(["**/*.mlir"])
|
||||
]
|
|
@ -0,0 +1,21 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir:mlir-translate",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob([
|
||||
"**/*.mlir",
|
||||
"**/*.ll",
|
||||
])
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(["**/*.mlir"])
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:LinalgStructuredOpsTdFiles",
|
||||
"//mlir:mlir-linalg-ods-yaml-gen",
|
||||
"//mlir:mlir-tblgen",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(["**/*.yaml"])
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:mlir-lsp-server",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(["**/*.test"])
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob(["**/*.mlir"])
|
||||
]
|
|
@ -0,0 +1,22 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = glob(["Parser/include/**"]) + glob(["CodeGen/MLIR/include/**"]) + [
|
||||
"//mlir/test:lit_data",
|
||||
"//mlir:mlir-pdll",
|
||||
"//mlir:include/mlir/IR/OpBase.td",
|
||||
"//mlir:include/mlir/IR/DialectBase.td",
|
||||
],
|
||||
)
|
||||
for src in glob(
|
||||
include = ["**/*.pdll"],
|
||||
exclude = ["Parser/include/included.pdll"],
|
||||
)
|
||||
]
|
|
@ -0,0 +1,32 @@
|
|||
load("//llvm:lit_test.bzl", "lit_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
[
|
||||
lit_test(
|
||||
name = "%s.test" % src,
|
||||
srcs = [src],
|
||||
data = [
|
||||
"//llvm:include/llvm/CodeGen/SDNodeProperties.td",
|
||||
"//llvm:include/llvm/CodeGen/ValueTypes.td",
|
||||
"//llvm:include/llvm/Frontend/Directive/DirectiveBase.td",
|
||||
"//llvm:include/llvm/IR/Intrinsics.td",
|
||||
"//mlir:SideEffectInterfacesTdFiles",
|
||||
"//mlir:include/mlir/Bindings/Python/Attributes.td",
|
||||
"//mlir:include/mlir/Dialect/LLVMIR/LLVMOpBase.td",
|
||||
"//mlir:include/mlir/Dialect/LLVMIR/LLVMOpsInterfaces.td",
|
||||
"//mlir:include/mlir/IR/OpBase.td",
|
||||
"//mlir:include/mlir/Interfaces/InferTypeOpInterface.td",
|
||||
"//mlir:include/mlir/Interfaces/SideEffectInterfaces.td",
|
||||
"//mlir:mlir-opt",
|
||||
"//mlir:mlir-tblgen",
|
||||
"//mlir/test:lit_data",
|
||||
],
|
||||
)
|
||||
for src in glob([
|
||||
"**/*.mlir",
|
||||
"**/*.td",
|
||||
])
|
||||
]
|
Loading…
Reference in New Issue