Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions third_party/hwloc/hwloc.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ cc_library(
"hwloc/topology-linux.c",
"include/hwloc/linux.h",
],
"@xla//xla/tsl:linux_riscv64": [
"hwloc/topology-linux.c",
"include/hwloc/linux.h",
],
"@xla//xla/tsl:linux_s390x": [
"hwloc/topology-linux.c",
"include/hwloc/linux.h",
Expand Down
1 change: 1 addition & 0 deletions third_party/mkl_dnn/mkldnn_v1.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ cc_library(
"@xla//xla/tsl:linux_aarch64": ["-lrt"],
"@xla//xla/tsl:linux_x86_64": ["-lrt"],
"@xla//xla/tsl:linux_ppc64le": ["-lrt"],
"@xla//xla/tsl:linux_riscv64": ["-lrt"],
"//conditions:default": [],
}),
textual_hdrs = _TEXTUAL_HDRS_LIST,
Expand Down
5 changes: 5 additions & 0 deletions xla/backends/cpu/codegen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ load(
"//xla/tsl/platform:build_config_root.bzl",
"if_llvm_aarch64_available",
"if_llvm_powerpc_available",
"if_llvm_riscv_available",
"if_llvm_system_z_available",
"if_llvm_x86_available",
)
Expand Down Expand Up @@ -164,6 +165,8 @@ xla_cc_test(
"@llvm-project//llvm:AArch64CodeGen", # fixdeps: keep
]) + if_llvm_powerpc_available([
"@llvm-project//llvm:PowerPCCodeGen", # fixdeps: keep
]) + if_llvm_riscv_available([
"@llvm-project//llvm:RISCVCodeGen", # fixdeps: keep
]) + if_llvm_system_z_available([
"@llvm-project//llvm:SystemZCodeGen", # fixdeps: keep
]) + if_llvm_x86_available([
Expand Down Expand Up @@ -286,6 +289,8 @@ cc_library(
"@llvm-project//llvm:AArch64CodeGen", # fixdeps: keep
]) + if_llvm_powerpc_available([
"@llvm-project//llvm:PowerPCCodeGen", # fixdeps: keep
]) + if_llvm_riscv_available([
"@llvm-project//llvm:RISCVCodeGen", # fixdeps: keep
]) + if_llvm_system_z_available([
"@llvm-project//llvm:SystemZCodeGen", # fixdeps: keep
]) + if_llvm_x86_available([
Expand Down
3 changes: 3 additions & 0 deletions xla/backends/cpu/codegen/tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ load(
"//xla/tsl/platform:build_config_root.bzl",
"if_llvm_aarch64_available",
"if_llvm_powerpc_available",
"if_llvm_riscv_available",
"if_llvm_system_z_available",
"if_llvm_x86_available",
)
Expand Down Expand Up @@ -38,6 +39,8 @@ cc_library(
"@llvm-project//llvm:AArch64CodeGen", # fixdeps: keep
]) + if_llvm_powerpc_available([
"@llvm-project//llvm:PowerPCCodeGen", # fixdeps: keep
]) + if_llvm_riscv_available([
"@llvm-project//llvm:RISCVCodeGen", # fixdeps: keep
]) + if_llvm_system_z_available([
"@llvm-project//llvm:SystemZCodeGen", # fixdeps: keep
]) + if_llvm_x86_available([
Expand Down
4 changes: 4 additions & 0 deletions xla/codegen/intrinsic/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load(
"//xla/tsl/platform:build_config_root.bzl",
"if_llvm_aarch64_available",
"if_llvm_powerpc_available",
"if_llvm_riscv_available",
"if_llvm_system_z_available",
"if_llvm_x86_available",
)
Expand Down Expand Up @@ -149,6 +150,9 @@ cc_library(
]) + if_llvm_powerpc_available([
"@llvm-project//llvm:PowerPCAsmParser", # fixdeps: keep
"@llvm-project//llvm:PowerPCCodeGen", # fixdeps: keep
]) + if_llvm_riscv_available([
"@llvm-project//llvm:RISCVAsmParser", # fixdeps: keep
"@llvm-project//llvm:RISCVCodeGen", # fixdeps: keep
]) + if_llvm_system_z_available([
"@llvm-project//llvm:SystemZAsmParser", # fixdeps: keep
"@llvm-project//llvm:SystemZCodeGen", # fixdeps: keep
Expand Down
5 changes: 5 additions & 0 deletions xla/service/cpu/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ load(
"//xla/tsl/platform:build_config_root.bzl",
"if_llvm_aarch64_available",
"if_llvm_powerpc_available",
"if_llvm_riscv_available",
"if_llvm_system_z_available",
"if_llvm_x86_available",
)
Expand Down Expand Up @@ -392,6 +393,8 @@ cc_library(
"@llvm-project//llvm:AArch64CodeGen", # fixdeps: keep
]) + if_llvm_powerpc_available([
"@llvm-project//llvm:PowerPCCodeGen", # fixdeps: keep
]) + if_llvm_riscv_available([
"@llvm-project//llvm:RISCVCodeGen", # fixdeps: keep
]) + if_llvm_system_z_available([
"@llvm-project//llvm:SystemZCodeGen", # fixdeps: keep
]) + if_llvm_x86_available([
Expand Down Expand Up @@ -2120,6 +2123,8 @@ cc_library(
"@llvm-project//llvm:AArch64CodeGen", # fixdeps: keep
]) + if_llvm_powerpc_available([
"@llvm-project//llvm:PowerPCCodeGen", # fixdeps: keep
]) + if_llvm_riscv_available([
"@llvm-project//llvm:RISCVCodeGen", # fixdeps: keep
]) + if_llvm_system_z_available([
"@llvm-project//llvm:SystemZCodeGen", # fixdeps: keep
]) + if_llvm_x86_available([
Expand Down
3 changes: 3 additions & 0 deletions xla/service/cpu/test_target_triple_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ static const char kTargetTripleForHost[] = "aarch64-unknown-linux-gnu";
defined(__ppc__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
static const char kTargetCpuForHost[] = "ppc";
static const char kTargetTripleForHost[] = "ppc64le-ibm-linux-gnu";
#elif defined(__riscv) && (__riscv_xlen == 64)
static const char kTargetCpuForHost[] = "";
static const char kTargetTripleForHost[] = "riscv64-unknown-linux-gnu";
#elif defined(__s390x__)
static const char kTargetCpuForHost[] = "s390x";
static const char kTargetTripleForHost[] = "systemz-none-linux-gnu";
Expand Down
20 changes: 20 additions & 0 deletions xla/tsl/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,16 @@ config_setting(
visibility = ["//visibility:public"],
)

config_setting(
name = "linux_riscv64",
constraint_values =
[
"@platforms//cpu:riscv64",
"@platforms//os:linux",
],
visibility = ["//visibility:public"],
)

config_setting(
name = "linux_s390x",
constraint_values =
Expand Down Expand Up @@ -382,6 +392,15 @@ selects.config_setting_group(
visibility = ["//visibility:public"],
)

selects.config_setting_group(
name = "riscv64_or_cross",
match_any = [
":linux_riscv64",
":with_cross_compiler_support",
],
visibility = ["//visibility:public"],
)

selects.config_setting_group(
name = "s390x_or_cross",
match_any = [
Expand Down Expand Up @@ -453,6 +472,7 @@ selects.config_setting_group(
":linux_aarch64",
":linux_armhf",
":linux_ppc64le",
":linux_riscv64",
":linux_s390x",
":linux_x86_64",
],
Expand Down
2 changes: 2 additions & 0 deletions xla/tsl/framework/contraction/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ cc_library(
"//xla/tsl:fuchsia_x86_64": [],
"//xla/tsl:ios": [],
"//xla/tsl:linux_ppc64le": [],
"//xla/tsl:linux_riscv64": [],
"//xla/tsl:linux_s390x": [],
"//xla/tsl:macos_arm64": [],
"//conditions:default": [
Expand All @@ -132,6 +133,7 @@ cc_library(
"//xla/tsl:fuchsia_x86_64": [],
"//xla/tsl:ios": [],
"//xla/tsl:linux_ppc64le": [],
"//xla/tsl:linux_riscv64": [],
"//xla/tsl:linux_s390x": [],
"//xla/tsl:macos_arm64": [],
"//conditions:default": ["//xla/tsl/mkl:onednn"],
Expand Down
2 changes: 2 additions & 0 deletions xla/tsl/platform/build_config_root.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ load(
_if_llvm_aarch64_available = "if_llvm_aarch64_available",
_if_llvm_arm_available = "if_llvm_arm_available",
_if_llvm_powerpc_available = "if_llvm_powerpc_available",
_if_llvm_riscv_available = "if_llvm_riscv_available",
_if_llvm_system_z_available = "if_llvm_system_z_available",
_if_llvm_x86_available = "if_llvm_x86_available",
_if_pywrap = "if_pywrap",
Expand All @@ -32,6 +33,7 @@ if_llvm_aarch32_available = _if_llvm_aarch32_available
if_llvm_aarch64_available = _if_llvm_aarch64_available
if_llvm_arm_available = _if_llvm_arm_available
if_llvm_powerpc_available = _if_llvm_powerpc_available
if_llvm_riscv_available = _if_llvm_riscv_available
if_llvm_system_z_available = _if_llvm_system_z_available
if_llvm_x86_available = _if_llvm_x86_available
if_static = _if_static
Expand Down
6 changes: 6 additions & 0 deletions xla/tsl/platform/default/build_config_root.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ def if_llvm_powerpc_available(then, otherwise = []):
"//conditions:default": otherwise,
})

def if_llvm_riscv_available(then, otherwise = []):
return select({
str(Label("//xla/tsl:riscv64_or_cross")): then,
"//conditions:default": otherwise,
})

def if_llvm_system_z_available(then, otherwise = []):
return select({
str(Label("//xla/tsl:s390x_or_cross")): then,
Expand Down
Loading