add basic test

This commit is contained in:
colin.liang 2021-08-11 15:41:34 +08:00
parent 95fc37ffa8
commit e88366b851
3 changed files with 44 additions and 2 deletions

32
BUILD
View File

@ -129,6 +129,20 @@ cc_binary(
"tools/mlir-tblgen-builder/*.cpp", "tools/mlir-tblgen-builder/*.cpp",
"tools/mlir-tblgen-builder/TableGen/*.h", "tools/mlir-tblgen-builder/TableGen/*.h",
"tools/mlir-tblgen-builder/TableGen/*.cpp", "tools/mlir-tblgen-builder/TableGen/*.cpp",
]),
deps = [
"@llvm-project//mlir:MlirTableGenMain",
"@llvm-project//mlir:Support",
"@llvm-project//mlir:IR",
"@llvm-project//llvm:Support",
"@llvm-project//llvm:TableGen",
"@llvm-project//llvm:config",
],
)
cc_library(
name = "mlir-hlo-builder",
srcs = glob([
"tools/mlir-tblgen-builder/Builder/*.h", "tools/mlir-tblgen-builder/Builder/*.h",
"tools/mlir-tblgen-builder/Builder/*.cpp", "tools/mlir-tblgen-builder/Builder/*.cpp",
]), ]),
@ -142,6 +156,23 @@ cc_binary(
], ],
) )
cc_test(
name = "mlir-tblgen-builder-basic",
srcs = [
"tests/mlir-tblgen-builder/test_basic.cpp",
],
deps = [
":hlo_ops_builder_gen",
":mlir-hlo-builder",
"@llvm-project//mlir:MlirTableGenMain",
"@llvm-project//mlir:Support",
"@llvm-project//mlir:IR",
"@llvm-project//llvm:Support",
"@llvm-project//llvm:TableGen",
"@llvm-project//llvm:config",
],
)
gentbl_cc_library( gentbl_cc_library(
name = "hlo_ops_builder_gen", name = "hlo_ops_builder_gen",
strip_include_prefix = "include", strip_include_prefix = "include",
@ -561,7 +592,6 @@ cc_library(
":hlo_ops_base_structs", ":hlo_ops_base_structs",
":hlo_ops_common", ":hlo_ops_common",
":hlo_ops_inc_gen", ":hlo_ops_inc_gen",
":hlo_ops_builder_gen",
":hlo_ops_pattern_gen", ":hlo_ops_pattern_gen",
":infer_fusibility_op_interface", ":infer_fusibility_op_interface",
"@llvm-project//llvm:Support", "@llvm-project//llvm:Support",

View File

@ -0,0 +1,12 @@
#include "include/mlir-hlo/Dialect/mhlo/IR/hlo_builder.h.inc"
#include "tools/mlir-tblgen-builder/Builder/Attribute.h"
#include "tools/mlir-tblgen-builder/Builder/Builder.h"
#include "tools/mlir-tblgen-builder/Builder/Op.h"
#include "tools/mlir-tblgen-builder/Builder/PrimitiveType.h"
#include "tools/mlir-tblgen-builder/Builder/Shape.h"
#include "tools/mlir-tblgen-builder/Builder/Tensor.h"
int main() {
builder::Integer i(322);
return 0;
}

View File

@ -11,7 +11,7 @@ class Op {
private: private:
std::shared_ptr<Impl> impl_; std::shared_ptr<Impl> impl_;
} };
} // namespace builder } // namespace builder
#endif #endif