Skip to content

Commit

Permalink
[xla:cpu] NFC: Move FunctionLibrary from codegen to runtime
Browse files Browse the repository at this point in the history
In preparation for removing Thunk::FunctionRegistry move FunctionLibrary to runtime.

PiperOrigin-RevId: 701409378
  • Loading branch information
ezhulenev authored and Google-ML-Automation committed Nov 30, 2024
1 parent 65d0b40 commit 533eb56
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
16 changes: 2 additions & 14 deletions xla/backends/cpu/codegen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ cc_library(
],
)

cc_library(
name = "function_library",
srcs = ["function_library.cc"],
hdrs = ["function_library.h"],
deps = [
"//xla:util",
"//xla/tsl/lib/gtl:int_type",
"@com_google_absl//absl/status:statusor",
"@tsl//tsl/platform:statusor",
],
)

cc_library(
name = "ir_compiler",
srcs = ["ir_compiler.cc"],
Expand Down Expand Up @@ -96,9 +84,9 @@ cc_library(
deps = [
":contiguous_section_memory_manager",
":cpu_features",
":function_library",
":ir_compiler",
"//xla:util",
"//xla/backends/cpu/runtime:function_library",
"//xla/service/cpu:orc_jit_memory_mapper",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:flat_hash_map",
Expand Down Expand Up @@ -138,9 +126,9 @@ xla_cc_test(
name = "jit_compiler_test",
srcs = ["jit_compiler_test.cc"],
deps = [
":function_library",
":jit_compiler",
"//xla:util",
"//xla/backends/cpu/runtime:function_library",
"//xla/tsl/lib/core:status_test_util",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
Expand Down
2 changes: 1 addition & 1 deletion xla/backends/cpu/codegen/jit_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ limitations under the License.
#include "llvm/TargetParser/Host.h"
#include "xla/backends/cpu/codegen/contiguous_section_memory_manager.h"
#include "xla/backends/cpu/codegen/cpu_features.h"
#include "xla/backends/cpu/codegen/function_library.h"
#include "xla/backends/cpu/codegen/ir_compiler.h"
#include "xla/backends/cpu/runtime/function_library.h"
#include "xla/service/cpu/orc_jit_memory_mapper.h"
#include "xla/util.h"
#include "tsl/platform/cpu_info.h"
Expand Down
2 changes: 1 addition & 1 deletion xla/backends/cpu/codegen/jit_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ limitations under the License.
#include "llvm/Support/CodeGen.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "xla/backends/cpu/codegen/function_library.h"
#include "xla/backends/cpu/codegen/ir_compiler.h"
#include "xla/backends/cpu/runtime/function_library.h"
#include "tsl/platform/cpu_info.h"

namespace xla::cpu {
Expand Down
2 changes: 1 addition & 1 deletion xla/backends/cpu/codegen/jit_compiler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ limitations under the License.
#include "llvm/Support/SourceMgr.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "xla/backends/cpu/codegen/function_library.h"
#include "xla/backends/cpu/runtime/function_library.h"
#include "xla/tsl/lib/core/status_test_util.h"
#include "xla/util.h"
#include "tsl/platform/env.h"
Expand Down
12 changes: 12 additions & 0 deletions xla/backends/cpu/runtime/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ xla_cc_test(
],
)

cc_library(
name = "function_library",
srcs = ["function_library.cc"],
hdrs = ["function_library.h"],
deps = [
"//xla:util",
"//xla/tsl/lib/gtl:int_type",
"@com_google_absl//absl/status:statusor",
"@tsl//tsl/platform:statusor",
],
)

cc_library(
name = "thunk",
srcs = ["thunk.cc"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include "xla/backends/cpu/codegen/function_library.h"
#include "xla/backends/cpu/runtime/function_library.h"

#include <atomic>
#include <cstdint>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef XLA_BACKENDS_CPU_CODEGEN_FUNCTION_LIBRARY_H_
#define XLA_BACKENDS_CPU_CODEGEN_FUNCTION_LIBRARY_H_
#ifndef XLA_BACKENDS_CPU_RUNTIME_FUNCTION_LIBRARY_H_
#define XLA_BACKENDS_CPU_RUNTIME_FUNCTION_LIBRARY_H_

#include <cstdint>
#include <string>
Expand Down Expand Up @@ -81,4 +81,4 @@ class FunctionLibrary {

} // namespace xla::cpu

#endif // XLA_BACKENDS_CPU_CODEGEN_FUNCTION_LIBRARY_H_
#endif // XLA_BACKENDS_CPU_RUNTIME_FUNCTION_LIBRARY_H_
4 changes: 2 additions & 2 deletions xla/service/cpu/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ cc_library(
"//xla:xla_data_proto_cc",
"//xla:xla_proto_cc",
"//xla/backends/cpu/codegen:cpu_features",
"//xla/backends/cpu/codegen:function_library",
"//xla/backends/cpu/codegen:ir_compiler",
"//xla/backends/cpu/codegen:jit_compiler",
"//xla/backends/cpu/codegen:target_machine_features",
"//xla/backends/cpu/runtime:function_library",
"//xla/backends/cpu/runtime:thunk",
"//xla/hlo/analysis:hlo_ordering",
"//xla/hlo/analysis:indexed_array_analysis",
Expand Down Expand Up @@ -587,8 +587,8 @@ cc_library(
"//xla:status_macros",
"//xla:util",
"//xla:xla_data_proto_cc",
"//xla/backends/cpu/codegen:function_library",
"//xla/backends/cpu/runtime:buffer_allocations",
"//xla/backends/cpu/runtime:function_library",
"//xla/backends/cpu/runtime:thread_pool_task_runner",
"//xla/backends/cpu/runtime:thunk",
"//xla/backends/cpu/runtime:thunk_executor",
Expand Down
2 changes: 1 addition & 1 deletion xla/service/cpu/cpu_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ limitations under the License.
#include "mlir/Target/LLVMIR/Export.h"
#include "mlir/Transforms/DialectConversion.h"
#include "xla/backends/cpu/codegen/cpu_features.h"
#include "xla/backends/cpu/codegen/function_library.h"
#include "xla/backends/cpu/codegen/ir_compiler.h"
#include "xla/backends/cpu/codegen/jit_compiler.h"
#include "xla/backends/cpu/codegen/target_machine_features.h"
#include "xla/backends/cpu/runtime/function_library.h"
#include "xla/backends/cpu/runtime/thunk.h"
#include "xla/cpu_function_runtime.h"
#include "xla/hlo/analysis/hlo_ordering.h"
Expand Down
2 changes: 1 addition & 1 deletion xla/service/cpu/cpu_executable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ limitations under the License.
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h"
#include "llvm/IR/Mangler.h"
#include "llvm/Support/Error.h"
#include "xla/backends/cpu/codegen/function_library.h"
#include "xla/backends/cpu/runtime/buffer_allocations.h"
#include "xla/backends/cpu/runtime/function_library.h"
#include "xla/backends/cpu/runtime/thread_pool_task_runner.h"
#include "xla/backends/cpu/runtime/thunk.h"
#include "xla/backends/cpu/runtime/thunk_executor.h"
Expand Down
2 changes: 1 addition & 1 deletion xla/service/cpu/cpu_executable.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ limitations under the License.
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/types/span.h"
#include "xla/backends/cpu/codegen/function_library.h"
#include "xla/backends/cpu/runtime/function_library.h"
#include "xla/backends/cpu/runtime/thunk.h"
#include "xla/backends/cpu/runtime/thunk_executor.h"
#include "xla/executable_run_options.h"
Expand Down

0 comments on commit 533eb56

Please sign in to comment.