Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LLVM target detection when cross-compiling. #57182

Merged
merged 1 commit into from
Aug 19, 2022

Conversation

hawkinsp
Copy link
Contributor

Conditions like @bazel_tools//src/conditions:linux_aarch64 do not
appear to be triggered correctly when cross-compiling on Linux. I'm
guessing this is because TensorFlow does not yet use Bazel platforms and
instead uses the older --cpu and --crosstool_top features.

This means that we fall through to the default condition and end up
building an x86-targeting LLVM even though we intended to target, say,
aarch64. The symptom this causes is errors like:
'neoverse-n1' is not a recognized processor for this target (ignoring
processor)
'+neon' is not a recognized feature for this target (ignoring feature)
'+fp-armv8' is not a recognized feature for this target (ignoring
feature)
'+crypto' is not a recognized feature for this target (ignoring feature)
'+lse' is not a recognized feature for this target (ignoring feature)
'+crc' is not a recognized feature for this target (ignoring feature)
from XLA:CPU compilation.

Take the same approach that has previously been used for Darwin ARM64
builds and add a new config_setting() for LLVM architecture detection
that mirrors the definitions in //tensorflow/BUILD.

Change tested both under x86->aarch64 cross compilation and aarch64
self-hosted compilation.

Conditions like @bazel_tools//src/conditions:linux_aarch64 do not
appear to be triggered correctly when cross-compiling on Linux. I'm
guessing this is because TensorFlow does not yet use Bazel platforms and
instead uses the older --cpu and --crosstool_top features.

This means that we fall through to the default condition and end up
building an x86-targeting LLVM even though we intended to target, say,
aarch64. The symptom this causes is errors like:
'neoverse-n1' is not a recognized processor for this target (ignoring
processor)
'+neon' is not a recognized feature for this target (ignoring feature)
'+fp-armv8' is not a recognized feature for this target (ignoring
feature)
'+crypto' is not a recognized feature for this target (ignoring feature)
'+lse' is not a recognized feature for this target (ignoring feature)
'+crc' is not a recognized feature for this target (ignoring feature)
from XLA:CPU compilation.

Take the same approach that has previously been used for Darwin ARM64
builds and add a new config_setting() for LLVM architecture detection
that mirrors the definitions in //tensorflow/BUILD.

Change tested both under x86->aarch64 cross compilation and aarch64
self-hosted compilation.
@hawkinsp hawkinsp requested a review from chsigg August 16, 2022 15:39
@google-ml-butler google-ml-butler bot added the size:M CL Change Size: Medium label Aug 16, 2022
@google-ml-butler google-ml-butler bot added the awaiting review Pull request awaiting review label Aug 16, 2022
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Aug 17, 2022
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Aug 19, 2022
PR Queue automation moved this from Assigned Reviewer to Approved by Reviewer Aug 19, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Aug 19, 2022
@copybara-service copybara-service bot merged commit 5f8ae63 into tensorflow:master Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review Pull request awaiting review ready to pull PR ready for merge process size:M CL Change Size: Medium
Projects
PR Queue
  
Approved by Reviewer
Development

Successfully merging this pull request may close these issues.

None yet

4 participants