Skip to content

Commit c3bddbd

Browse files
jdduketensorflower-gardener
authored andcommitted
Reland "Fix issues with 32-bit ARM builds"
PiperOrigin-RevId: 324293928 Change-Id: Ifc28dc29cd33af42f7d80c9f87f27692cc505854
1 parent 0bf6bb6 commit c3bddbd

File tree

4 files changed

+46
-14
lines changed

4 files changed

+46
-14
lines changed

tensorflow/BUILD

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,36 @@ config_setting(
260260
visibility = ["//visibility:public"],
261261
)
262262

263+
config_setting(
264+
name = "armeabi",
265+
values = {"cpu": "armeabi"},
266+
visibility = ["//visibility:public"],
267+
)
268+
269+
config_setting(
270+
name = "armeabi-v7a",
271+
values = {"cpu": "armeabi-v7a"},
272+
visibility = ["//visibility:public"],
273+
)
274+
275+
config_setting(
276+
name = "arm64-v8a",
277+
values = {"cpu": "arm64-v8a"},
278+
visibility = ["//visibility:public"],
279+
)
280+
281+
selects.config_setting_group(
282+
name = "arm_any",
283+
match_any = [
284+
":arm",
285+
":armeabi",
286+
":armeabi-v7a",
287+
":arm64-v8a",
288+
":linux_aarch64",
289+
":linux_armhf",
290+
],
291+
)
292+
263293
config_setting(
264294
name = "freebsd",
265295
values = {"cpu": "freebsd"},

tensorflow/core/kernels/BUILD

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,9 @@ cc_library(
810810
srcs = ["eigen_contraction_kernel.cc"],
811811
hdrs = ["eigen_contraction_kernel.h"],
812812
defines = select({
813-
"//tensorflow:android": [],
814-
"//tensorflow:arm": [],
813+
"//tensorflow:android_x86": [],
814+
"//tensorflow:arm_any": [],
815815
"//tensorflow:ios": [],
816-
"//tensorflow:linux_aarch64": [],
817816
"//tensorflow:linux_ppc64le": [],
818817
"//conditions:default": [
819818
"TENSORFLOW_USE_CUSTOM_CONTRACTION_KERNEL",
@@ -825,10 +824,9 @@ cc_library(
825824
"//third_party/eigen3",
826825
"//tensorflow/core/platform:dynamic_annotations",
827826
] + select({
828-
"//tensorflow:android": [],
829-
"//tensorflow:arm": [],
827+
"//tensorflow:android_x86": [],
828+
"//tensorflow:arm_any": [],
830829
"//tensorflow:ios": [],
831-
"//tensorflow:linux_aarch64": [],
832830
"//tensorflow:linux_ppc64le": [],
833831
"//conditions:default": ["@mkl_dnn//:mkldnn_single_threaded"],
834832
}),
@@ -3179,8 +3177,8 @@ tf_cc_test(
31793177
name = "eigen_mkldnn_contraction_kernel_test",
31803178
size = "small",
31813179
srcs = select({
3182-
"//tensorflow:android": [],
3183-
"//tensorflow:arm": [],
3180+
"//tensorflow:android_x86": [],
3181+
"//tensorflow:arm_any": [],
31843182
"//tensorflow:ios": [],
31853183
"//tensorflow:linux_ppc64le": [],
31863184
":no_mkldnn_contraction_kernel": [],

tensorflow/core/platform/platform.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,22 @@ limitations under the License.
4141
#elif defined(_WIN32)
4242
#define PLATFORM_WINDOWS
4343

44-
#elif defined(__arm__)
45-
#define PLATFORM_POSIX
46-
4744
#elif defined(__EMSCRIPTEN__)
4845
#define PLATFORM_PORTABLE_GOOGLE
4946
#define PLATFORM_POSIX
47+
// EMSCRIPTEN builds are considered "mobile" for the sake of portability.
48+
#define IS_MOBILE_PLATFORM
49+
50+
#elif defined(__arm__) || defined(__aarch64__)
51+
// If no platform specified, use:
52+
#define PLATFORM_POSIX
5053

5154
// Require an outside macro to tell us if we're building for Raspberry Pi or
5255
// another ARM device that's not a mobile platform.
53-
#if !defined(RASPBERRY_PI) && !defined(ARM_NON_MOBILE)
56+
#if !defined(RASPBERRY_PI) && !defined(ARM_NON_MOBILE) && \
57+
!defined(PLATFORM_GOOGLE)
5458
#define IS_MOBILE_PLATFORM
55-
#endif // !defined(RASPBERRY_PI) && !defined(ARM_NON_MOBILE)
59+
#endif
5660

5761
#else
5862
// If no platform specified, use:

tensorflow/tensorflow.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def if_not_mobile(a):
220220

221221
# Config setting selector used when building for products
222222
# which requires restricted licenses to be avoided.
223-
def if_not_lgpl_restricted(a):
223+
def if_not_mobile_or_arm_or_lgpl_restricted(a):
224224
_ = (a,)
225225
return select({
226226
"//conditions:default": [],

0 commit comments

Comments
 (0)