Skip to content

[XLA] [macOS] tfcompile via tf_library does not work on macOS #10060

Closed

Description

@fwinnen

I am trying to compile a model using XLA on macOS. I know the XLA is still in experimental stage, but I would be happy to help fix the problem. The problem can be reproduced from supplied tests, i.e: tensorflow/compiler/aot/tests:test_graph_tfadd.

Environment

OS: macOS Sierra 10.12.4
Tensorflow source: v1.1.0-rc2
Bazel: bazel release 0.4.5-homebrew

Describe the problem

The generated object file from the graph seems to be invalid or is not recognized by libtool:

libtool: file: bazel-out/local-opt/genfiles/tensorflow/compiler/aot/tests/test_graph_tfadd.o is not an object file (not allowed in a library)

file bazel-out/local-opt/genfiles/tensorflow/compiler/aot/tests/test_graph_tfadd.o bazel-out/local-opt/genfiles/tensorflow/compiler/aot/tests/test_graph_tfadd.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

How to reproduce the problem

The problem can be reproduced on a fresh checkout issuing the following commands:
bazel build //tensorflow/compiler/aot/tests:test_graph_tfadd

If you need more information, I am happy to provide it!

Activity

  1. fwinnen commented on May 20, 2017

    @fwinnen
    ContributorAuthor

    Ok, I found the Problem:

    file: tensorflow/compiler/aot/tfcompile.bzl:277

    def target_llvm_triple():
      """Returns the target LLVM triple to be used for compiling the target."""
      # TODO(toddw): Add target_triple for other targets.  For details see:
      # http://llvm.org/docs/doxygen/html/Triple_8h_source.html
      return select({
          "//tensorflow:android_arm": "armv7-none-android",
          "//tensorflow:android_arm64": "aarch64-none-android",
          "//tensorflow:android_x86": "i686-none-android",
          "//tensorflow:linux_ppc64le": "ppc64le-ibm-linux-gnu",
          "//conditions:default": "x86_64-pc-linux",
      })
    

    Adding

    "//tensorflow:darwin": "x86_64-none-darwin",
    

    fixes the problem. I can provide a pull request for that, but it seems there are more targets missing.
    Maybe someone with more overview of supported platforms (@tatatodd ?) can take a look here.

  2. gunan commented on May 22, 2017

    @gunan
    Contributor

    I think we may have missed this, as XLA is still listed as experimental.
    Your fix looks correct to me.
    Would you like to contribute the fix with a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions