Build Tensorflow XLA AOT Shared Library:
Add the following code into tensorflow/compiler/aot/BUILD in TensorFlow source:
Build it:
P.S:
I try to build XLA AOT static library but it seems Bazel doesn't support it:
Add the following code into tensorflow/compiler/aot/BUILD in TensorFlow source:
cc_binary(
name = "libxlaaot.so",
deps = [":embedded_protocol_buffers",
"//tensorflow/compiler/tf2xla:xla_jit_compiled_cpu_function",
"//tensorflow/compiler/tf2xla",
"//tensorflow/compiler/tf2xla:cpu_function_runtime",
"//tensorflow/compiler/tf2xla:tf2xla_proto",
"//tensorflow/compiler/tf2xla:tf2xla_util",
"//tensorflow/compiler/tf2xla:xla_compiler",
"//tensorflow/compiler/tf2xla/kernels:xla_cpu_only_ops",
"//tensorflow/compiler/tf2xla/kernels:xla_dummy_ops",
"//tensorflow/compiler/tf2xla/kernels:xla_ops",
"//tensorflow/compiler/xla:shape_util",
"//tensorflow/compiler/xla:statusor",
"//tensorflow/compiler/xla:util",
"//tensorflow/compiler/xla:xla_data_proto",
"//tensorflow/compiler/xla/client:client_library",
"//tensorflow/compiler/xla/client:compile_only_client",
"//tensorflow/compiler/xla/client:xla_computation",
"//tensorflow/compiler/xla/service:compiler",
"//tensorflow/compiler/xla/service/cpu:buffer_info_util",
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
"//tensorflow/core:core_cpu_internal",
"//tensorflow/core:framework_internal",
"//tensorflow/core:lib",
"//tensorflow/core:lib_internal",
"//tensorflow/core:protos_all_cc",
":tfcompile_lib",
"//tensorflow/compiler/xla/legacy_flags:debug_options_flags",
"//tensorflow/core:core_cpu",
"//tensorflow/core:framework",
"//tensorflow/core:graph",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
],
linkopts=["-shared -Wl,--whole-archive" ],
linkshared=1
)
Build it:
bazel build --config opt //tensorflow/compiler/aot:libxlaaot.so --cxxopt="-std=c++11" --copt="-O3"
P.S:
I try to build XLA AOT static library but it seems Bazel doesn't support it:
cc_binary(
name = "libxlaaot.a",
deps = [":embedded_protocol_buffers",
"//tensorflow/compiler/tf2xla:xla_jit_compiled_cpu_function",
"//tensorflow/compiler/tf2xla",
"//tensorflow/compiler/tf2xla:cpu_function_runtime",
"//tensorflow/compiler/tf2xla:tf2xla_proto",
"//tensorflow/compiler/tf2xla:tf2xla_util",
"//tensorflow/compiler/tf2xla:xla_compiler",
"//tensorflow/compiler/tf2xla/kernels:xla_cpu_only_ops",
"//tensorflow/compiler/tf2xla/kernels:xla_dummy_ops",
"//tensorflow/compiler/tf2xla/kernels:xla_ops",
"//tensorflow/compiler/xla:shape_util",
"//tensorflow/compiler/xla:statusor",
"//tensorflow/compiler/xla:util",
"//tensorflow/compiler/xla:xla_data_proto",
"//tensorflow/compiler/xla/client:client_library",
"//tensorflow/compiler/xla/client:compile_only_client",
"//tensorflow/compiler/xla/client:xla_computation",
"//tensorflow/compiler/xla/service:compiler",
"//tensorflow/compiler/xla/service/cpu:buffer_info_util",
"//tensorflow/compiler/xla/service/cpu:cpu_compiler",
"//tensorflow/core:core_cpu_internal",
"//tensorflow/core:framework_internal",
"//tensorflow/core:lib",
"//tensorflow/core:lib_internal",
"//tensorflow/core:protos_all_cc",
":tfcompile_lib",
"//tensorflow/compiler/xla/legacy_flags:debug_options_flags",
"//tensorflow/core:core_cpu",
"//tensorflow/core:framework",
"//tensorflow/core:graph",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
],
linkstatic = 1,
linkshared = 0,
linkopts=[" -static -Wl,--whole-archive -nostartfiles " ],
No comments:
Post a Comment