forked from tensorflow/tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[XLA:GPU][Emitters] Create
xla_ops
dialect for the platform-indepen…
…dent ops. PiperOrigin-RevId: 703082625
- Loading branch information
1 parent
d6ccc6a
commit 1c3c327
Showing
123 changed files
with
2,904 additions
and
2,279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") | ||
load("//xla/tests:build_defs.bzl", "xla_test") | ||
|
||
package( | ||
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"], | ||
default_visibility = [":friends"], | ||
licenses = ["notice"], | ||
) | ||
|
||
package_group( | ||
name = "friends", | ||
includes = [ | ||
"//xla:friends", | ||
], | ||
) | ||
|
||
td_library( | ||
name = "xla_td_files", | ||
srcs = glob(["*.td"]), | ||
includes = ["."], | ||
deps = [ | ||
"@llvm-project//mlir:BuiltinDialectTdFiles", | ||
"@llvm-project//mlir:CallInterfacesTdFiles", | ||
"@llvm-project//mlir:ControlFlowInterfacesTdFiles", | ||
"@llvm-project//mlir:InferTypeOpInterfaceTdFiles", | ||
"@llvm-project//mlir:OpBaseTdFiles", | ||
"@llvm-project//mlir:SideEffectInterfacesTdFiles", | ||
], | ||
) | ||
|
||
gentbl_cc_library( | ||
name = "xla_dialect_inc_gen", | ||
strip_include_prefix = ".", | ||
tbl_outs = [ | ||
( | ||
["-gen-dialect-decls"], | ||
"xla_dialect.h.inc", | ||
), | ||
( | ||
["-gen-dialect-defs"], | ||
"xla_dialect.cc.inc", | ||
), | ||
], | ||
tblgen = "@llvm-project//mlir:mlir-tblgen", | ||
td_file = "xla_dialect.td", | ||
deps = [":xla_td_files"], | ||
) | ||
|
||
gentbl_cc_library( | ||
name = "xla_ops_inc_gen", | ||
strip_include_prefix = ".", | ||
tbl_outs = [ | ||
( | ||
["-gen-op-decls"], | ||
"xla_ops.h.inc", | ||
), | ||
( | ||
["-gen-op-defs"], | ||
"xla_ops.cc.inc", | ||
), | ||
], | ||
tblgen = "@llvm-project//mlir:mlir-tblgen", | ||
td_file = "xla_ops.td", | ||
deps = [":xla_td_files"], | ||
) | ||
|
||
gentbl_cc_library( | ||
name = "xla_attrs_inc_gen", | ||
strip_include_prefix = ".", | ||
tbl_outs = [ | ||
( | ||
["-gen-enum-decls"], | ||
"xla_enums.h.inc", | ||
), | ||
( | ||
["-gen-enum-defs"], | ||
"xla_enums.cc.inc", | ||
), | ||
( | ||
[ | ||
"-gen-attrdef-decls", | ||
], | ||
"xla_attrs.h.inc", | ||
), | ||
( | ||
[ | ||
"-gen-attrdef-defs", | ||
], | ||
"xla_attrs.cc.inc", | ||
), | ||
], | ||
tblgen = "@llvm-project//mlir:mlir-tblgen", | ||
td_file = "xla_attrs.td", | ||
deps = [":xla_td_files"], | ||
) | ||
|
||
cc_library( | ||
name = "xla", | ||
srcs = [ | ||
"xla_attrs.cc", | ||
"xla_dialect.cc", | ||
"xla_ops.cc", | ||
], | ||
hdrs = ["xla_ops.h"], | ||
deps = [ | ||
":xla_attrs_inc_gen", | ||
":xla_dialect_inc_gen", | ||
":xla_ops_inc_gen", | ||
"//xla:status_macros", | ||
"//xla/hlo/analysis:indexing_analysis", | ||
"@com_google_absl//absl/status", | ||
"@com_google_absl//absl/status:statusor", | ||
"@com_google_absl//absl/strings", | ||
"@llvm-project//llvm:Support", | ||
"@llvm-project//mlir:ArithDialect", | ||
"@llvm-project//mlir:BytecodeOpInterface", | ||
"@llvm-project//mlir:CallOpInterfaces", | ||
"@llvm-project//mlir:FuncDialect", | ||
"@llvm-project//mlir:IR", | ||
"@llvm-project//mlir:InferTypeOpInterface", | ||
"@llvm-project//mlir:InliningUtils", | ||
"@llvm-project//mlir:SideEffectInterfaces", | ||
"@llvm-project//mlir:Support", | ||
], | ||
) | ||
|
||
xla_test( | ||
name = "xla_ops_test", | ||
srcs = ["xla_ops_test.cc"], | ||
backends = ["cpu"], | ||
deps = [ | ||
":xla", | ||
"//xla/hlo/analysis:indexing_analysis", | ||
"//xla/hlo/analysis:indexing_test_utils", | ||
"//xla/tests:hlo_test_base", | ||
"//xla/tests:xla_internal_test_main", | ||
"@com_google_absl//absl/strings", | ||
"@com_google_absl//absl/strings:str_format", | ||
"@com_google_googletest//:gtest", | ||
"@llvm-project//llvm:Support", | ||
"@local_tsl//tsl/platform:test", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("//xla:lit.bzl", "lit_test_suite") | ||
|
||
package( | ||
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"], | ||
licenses = ["notice"], | ||
) | ||
|
||
lit_test_suite( | ||
name = "tests", | ||
srcs = glob(["*.mlir"]), | ||
cfg = "//xla:lit.cfg.py", | ||
tools = [ | ||
"//xla/codegen/tools:emitters_opt", | ||
"@llvm-project//llvm:FileCheck", | ||
], | ||
) |
Oops, something went wrong.