Skip to content

Commit

Permalink
[HLO Componentization] Create hlo/tools sub-component (Phase I).
Browse files Browse the repository at this point in the history
This CL takes care of
1. Migrating xla/tools --> xla/hlo/tools
2. As there are no header or target dependencies of these tools, no aliases are setup.

Phase II will take care of migration of external projects dependencies from  xla/tools --> xla/hlo/tools

PiperOrigin-RevId: 681674893
  • Loading branch information
sdasgup3 authored and Google-ML-Automation committed Oct 3, 2024
1 parent 54fdf8a commit 0b26e71
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 131 deletions.
155 changes: 155 additions & 0 deletions xla/hlo/tools/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Tools and utilities that aid in XLA development and usage.

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load(
"//xla:xla.bzl",
"xla_cc_binary",
)
load("//xla/tsl:tsl.default.bzl", "filegroup")

package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
default_visibility = ["//xla:internal"],
licenses = ["notice"],
)

# Filegroup used to collect source files for dependency checking.
filegroup(
name = "c_srcs",
data = glob([
"**/*.cc",
"**/*.h",
]),
visibility = ["//xla:internal"],
)

build_test(
name = "hex_floats_to_packed_literal_build_test",
targets = [
":hex_floats_to_packed_literal",
],
)

xla_cc_binary(
name = "hex_floats_to_packed_literal",
srcs = ["hex_floats_to_packed_literal.cc"],
deps = [
"//xla/tsl/lib/io:buffered_inputstream",
"//xla/tsl/lib/io:random_inputstream",
"//xla/tsl/util:command_line_flags",
"@com_google_absl//absl/base",
"@com_google_absl//absl/strings",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:status",
],
)

build_test(
name = "show_literal_build_test",
targets = [
":show_literal",
],
)

xla_cc_binary(
name = "show_literal",
srcs = ["show_literal.cc"],
deps = [
"//xla:literal",
"//xla:types",
"//xla:xla_data_proto_cc",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:status",
],
)

build_test(
name = "convert_computation_build_test",
targets = [
":convert_computation",
],
)

xla_cc_binary(
name = "convert_computation",
srcs = ["convert_computation.cc"],
deps = [
"//xla/service:hlo_proto_cc",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:protobuf",
"@tsl//tsl/platform:status",
],
)

build_test(
name = "hlo_module_metadata_processor_build_test",
targets = [
":hlo_module_metadata_processor",
],
)

xla_cc_binary(
name = "hlo_module_metadata_processor",
srcs = ["hlo_module_metadata_processor.cc"],
deps = [
"//xla/service:hlo_proto_cc",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:protobuf",
"@tsl//tsl/platform:status",
],
)

build_test(
name = "show_text_literal_build_test",
targets = [
":show_text_literal",
],
)

xla_cc_binary(
name = "show_text_literal",
srcs = ["show_text_literal.cc"],
deps = [
"//xla:literal",
"//xla:text_literal_reader",
"//xla:types",
"//xla:xla_data_proto_cc",
"@com_google_absl//absl/status:statusor",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:protobuf",
],
)

build_test(
name = "hlo_proto_to_json_build_test",
targets = [
":hlo_proto_to_json",
],
)

xla_cc_binary(
name = "hlo_proto_to_json",
srcs = ["hlo_proto_to_json.cc"],
deps = [
"//xla:util",
"//xla/service:hlo_proto_cc",
"//xla/tsl/util:command_line_flags",
"@com_google_absl//absl/status:statusor",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:status",
],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
131 changes: 0 additions & 131 deletions xla/tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,6 @@ filegroup(
visibility = ["//xla:internal"],
)

build_test(
name = "hex_floats_to_packed_literal_build_test",
targets = [
":hex_floats_to_packed_literal",
],
)

xla_cc_binary(
name = "hex_floats_to_packed_literal",
srcs = ["hex_floats_to_packed_literal.cc"],
deps = [
"//xla/tsl/lib/io:buffered_inputstream",
"//xla/tsl/lib/io:random_inputstream",
"//xla/tsl/util:command_line_flags",
"@com_google_absl//absl/base",
"@com_google_absl//absl/strings",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:status",
],
)

build_test(
name = "show_signature_build_test",
targets = [
Expand All @@ -94,92 +71,6 @@ xla_cc_binary(
],
)

build_test(
name = "show_literal_build_test",
targets = [
":show_literal",
],
)

xla_cc_binary(
name = "show_literal",
srcs = ["show_literal.cc"],
deps = [
"//xla:literal",
"//xla:types",
"//xla:xla_data_proto_cc",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:status",
],
)

build_test(
name = "convert_computation_build_test",
targets = [
":convert_computation",
],
)

xla_cc_binary(
name = "convert_computation",
srcs = ["convert_computation.cc"],
deps = [
"//xla/service:hlo_proto_cc",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:protobuf",
"@tsl//tsl/platform:status",
],
)

build_test(
name = "hlo_module_metadata_processor_build_test",
targets = [
":hlo_module_metadata_processor",
],
)

xla_cc_binary(
name = "hlo_module_metadata_processor",
srcs = ["hlo_module_metadata_processor.cc"],
deps = [
"//xla/service:hlo_proto_cc",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:protobuf",
"@tsl//tsl/platform:status",
],
)

build_test(
name = "show_text_literal_build_test",
targets = [
":show_text_literal",
],
)

xla_cc_binary(
name = "show_text_literal",
srcs = ["show_text_literal.cc"],
deps = [
"//xla:literal",
"//xla:text_literal_reader",
"//xla:types",
"//xla:xla_data_proto_cc",
"@com_google_absl//absl/status:statusor",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:protobuf",
],
)

build_test(
name = "dumped_computation_to_text_build_test",
targets = [
Expand Down Expand Up @@ -245,28 +136,6 @@ xla_cc_binary(
],
)

build_test(
name = "hlo_proto_to_json_build_test",
targets = [
":hlo_proto_to_json",
],
)

xla_cc_binary(
name = "hlo_proto_to_json",
srcs = ["hlo_proto_to_json.cc"],
deps = [
"//xla:util",
"//xla/service:hlo_proto_cc",
"//xla/tsl/util:command_line_flags",
"@com_google_absl//absl/status:statusor",
"@tsl//tsl/platform:env",
"@tsl//tsl/platform:logging",
"@tsl//tsl/platform:platform_port",
"@tsl//tsl/platform:status",
],
)

xla_cc_test(
name = "hlo_extractor_test",
srcs = ["hlo_extractor_test.cc"],
Expand Down

0 comments on commit 0b26e71

Please sign in to comment.