Skip to content

Commit 3f13308

Browse files
kanglantjax authors
authored andcommitted
Add an experimental build-only continuous cross compile build for MacOS x86
PiperOrigin-RevId: 617611779
1 parent 9862236 commit 3f13308

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

.bazelrc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,31 @@ build:rbe_cross_compile_base --strategy_regexp='Executing genrule @llvm-project.
320320
build:rbe_cross_compile_linux_arm64 --config=cross_compile_linux_arm64
321321
build:rbe_cross_compile_linux_arm64 --config=rbe_cross_compile_base
322322
# END LINUX AARCH64 CROSS-COMPILE CONFIGS
323+
324+
# START MACOS CROSS-COMPILE CONFIGS
325+
build:cross_compile_macos_x86 --config=cross_compile_base
326+
build:cross_compile_macos_x86 --config=nonccl
327+
# Target Catalina (10.15) as the minimum supported OS
328+
build:cross_compile_macos_x86 --action_env MACOSX_DEPLOYMENT_TARGET=10.15
329+
330+
# Set the target CPU to Darwin x86
331+
build:cross_compile_macos_x86 --platforms=@xla//tools/toolchains/cross_compile/config:darwin_x86_64
332+
build:cross_compile_macos_x86 --cpu=darwin
333+
build:cross_compile_macos_x86 --crosstool_top=@xla//tools/toolchains/cross_compile/cc:cross_compile_toolchain_suite
334+
# When RBE cross-compiling for macOS, we need to explicitly register the
335+
# toolchain. Otherwise, oddly, RBE complains that a "docker container must be
336+
# specified".
337+
build:cross_compile_macos_x86 --extra_toolchains=@xla//tools/toolchains/cross_compile/config:macos-x86-cross-compile-cc-toolchain
338+
# Map --platforms=darwin_x86_64 to --cpu=darwin and vice-versa to make selects()
339+
# and transistions that use these flags work. The flag --platform_mappings needs
340+
# to be set to a file that exists relative to the package path roots.
341+
build:cross_compile_macos_x86 --platform_mappings=platform_mappings
342+
343+
# RBE cross-compile configs for Darwin x86
344+
build:rbe_cross_compile_macos_x86 --config=cross_compile_macos_x86
345+
build:rbe_cross_compile_macos_x86 --config=rbe_cross_compile_base
346+
# END MACOS CROSS-COMPILE CONFIGS
347+
323348
# END CROSS-COMPILE CONFIGS
324349

325350
#############################################################################

jax/oss/platform_mappings

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
platforms:
2+
# Maps "--platforms=//tools/toolchains/cross_compile/config:darwin_x86_64"
3+
# to "--cpu=darwin".
4+
//tools/toolchains/cross_compile/config:darwin_x86_64
5+
--cpu=darwin
6+
7+
flags:
8+
# Maps "--cpu=darwin" to
9+
# "--platforms=//tools/toolchains/cross_compile/config:darwin_x86_64".
10+
--cpu=darwin
11+
//tools/toolchains/cross_compile/config:darwin_x86_64

0 commit comments

Comments
 (0)