| 1 |
# Description: |
| 2 |
# MLIR Tutorial |
| 3 |
|
| 4 |
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") |
| 5 |
|
| 6 |
licenses(["notice"]) |
| 7 |
|
| 8 |
package(default_visibility = ["//visibility:public"]) |
| 9 |
|
| 10 |
td_library( |
| 11 |
name = "ToyOpsTdFiles", |
| 12 |
srcs = [ |
| 13 |
"include/toy/Ops.td", |
| 14 |
"include/toy/ShapeInferenceInterface.td", |
| 15 |
], |
| 16 |
includes = ["include"], |
| 17 |
deps = [ |
| 18 |
"//mlir:CallInterfacesTdFiles", |
| 19 |
"//mlir:CastInterfacesTdFiles", |
| 20 |
"//mlir:FunctionInterfacesTdFiles", |
| 21 |
"//mlir:OpBaseTdFiles", |
| 22 |
"//mlir:SideEffectInterfacesTdFiles", |
| 23 |
], |
| 24 |
) |
| 25 |
|
| 26 |
gentbl_cc_library( |
| 27 |
name = "ToyInterfacesIncGen", |
| 28 |
tbl_outs = { |
| 29 |
"include/toy/ShapeInferenceOpInterfaces.h.inc": ["-gen-op-interface-decls"], |
| 30 |
"include/toy/ShapeInferenceOpInterfaces.cpp.inc": ["-gen-op-interface-defs"], |
| 31 |
}, |
| 32 |
tblgen = "//mlir:mlir-tblgen", |
| 33 |
td_file = "include/toy/ShapeInferenceInterface.td", |
| 34 |
deps = [":ToyOpsTdFiles"], |
| 35 |
) |
| 36 |
|
| 37 |
gentbl_cc_library( |
| 38 |
name = "ToyOpsIncGen", |
| 39 |
tbl_outs = { |
| 40 |
"include/toy/Ops.h.inc": ["-gen-op-decls"], |
| 41 |
"include/toy/Ops.cpp.inc": ["-gen-op-defs"], |
| 42 |
"include/toy/Dialect.h.inc": ["-gen-dialect-decls"], |
| 43 |
"include/toy/Dialect.cpp.inc": ["-gen-dialect-defs"], |
| 44 |
}, |
| 45 |
tblgen = "//mlir:mlir-tblgen", |
| 46 |
td_file = "include/toy/Ops.td", |
| 47 |
deps = [":ToyOpsTdFiles"], |
| 48 |
) |
| 49 |
|
| 50 |
gentbl_cc_library( |
| 51 |
name = "ToyCombineIncGen", |
| 52 |
strip_include_prefix = "mlir", |
| 53 |
tbl_outs = {"mlir/ToyCombine.inc": ["-gen-rewriters"]}, |
| 54 |
tblgen = "//mlir:mlir-tblgen", |
| 55 |
td_file = "mlir/ToyCombine.td", |
| 56 |
deps = [":ToyOpsTdFiles"], |
| 57 |
) |
| 58 |
|
| 59 |
cc_binary( |
| 60 |
name = "toyc-ch6", |
| 61 |
srcs = [ |
| 62 |
"mlir/Dialect.cpp", |
| 63 |
"mlir/LowerToAffineLoops.cpp", |
| 64 |
"mlir/LowerToLLVM.cpp", |
| 65 |
"mlir/MLIRGen.cpp", |
| 66 |
"mlir/ShapeInferencePass.cpp", |
| 67 |
"mlir/ToyCombine.cpp", |
| 68 |
"parser/AST.cpp", |
| 69 |
"toyc.cpp", |
| 70 |
] + glob(["include/toy/*.h"]), |
| 71 |
includes = ["include/"], |
| 72 |
deps = [ |
| 73 |
":ToyCombineIncGen", |
| 74 |
":ToyInterfacesIncGen", |
| 75 |
":ToyOpsIncGen", |
| 76 |
"//llvm:Core", |
| 77 |
"//llvm:OrcJIT", |
| 78 |
"//llvm:Support", |
| 79 |
"//mlir:AffineDialect", |
| 80 |
"//mlir:AffineToStandard", |
| 81 |
"//mlir:AffineTransforms", |
| 82 |
"//mlir:AllPassesAndDialects", |
| 83 |
"//mlir:Analysis", |
| 84 |
"//mlir:ArithDialect", |
| 85 |
"//mlir:ArithToLLVM", |
| 86 |
"//mlir:BuiltinToLLVMIRTranslation", |
| 87 |
"//mlir:BytecodeReader", |
| 88 |
"//mlir:CallOpInterfaces", |
| 89 |
"//mlir:CastInterfaces", |
| 90 |
"//mlir:ControlFlowToLLVM", |
| 91 |
"//mlir:ExecutionEngine", |
| 92 |
"//mlir:ExecutionEngineUtils", |
| 93 |
"//mlir:FuncDialect", |
| 94 |
"//mlir:FuncExtensions", |
| 95 |
"//mlir:FuncToLLVM", |
| 96 |
"//mlir:FunctionInterfaces", |
| 97 |
"//mlir:IR", |
| 98 |
"//mlir:InliningUtils", |
| 99 |
"//mlir:LLVMCommonConversion", |
| 100 |
"//mlir:LLVMDialect", |
| 101 |
"//mlir:LLVMIRTransforms", |
| 102 |
"//mlir:LLVMToLLVMIRTranslation", |
| 103 |
"//mlir:MemRefDialect", |
| 104 |
"//mlir:MemRefToLLVM", |
| 105 |
"//mlir:Parser", |
| 106 |
"//mlir:Pass", |
| 107 |
"//mlir:SCFDialect", |
| 108 |
"//mlir:SCFToControlFlow", |
| 109 |
"//mlir:SideEffectInterfaces", |
| 110 |
"//mlir:Support", |
| 111 |
"//mlir:ToLLVMIRTranslation", |
| 112 |
"//mlir:TransformUtils", |
| 113 |
"//mlir:Transforms", |
| 114 |
], |
| 115 |
) |