Skip to content

Latest commit

 

History

History
78 lines (56 loc) · 2.55 KB

developer_guide.md

File metadata and controls

78 lines (56 loc) · 2.55 KB

XLA developer guide

This guide shows you how to get started developing the XLA project.

Before you begin, complete the following prerequisites:

  1. Go to CONTRIBUTING.md and review the contribution process.
  2. If you haven't already done so, sign the Contributor License Agreement.
  3. Install or configure the following dependencies:

Then follow the steps below to get the source code, set up an environment, build the repository, and create a pull request.

Get the code

  1. Create a fork of the XLA repository.
  2. Clone your fork of the repo, replacing <USER> with your GitHub username:
    git clone https://github.com/<USER>/xla.git
  3. Change into the xla directory: cd xla
  4. Configure the remote upstream repo:
    git remote add upstream https://github.com/openxla/xla.git

Set up an environment

  1. Install Bazel.

    To build XLA, you must have Bazel installed. The recommended way to install Bazel is using Bazelisk, which automatically downloads the correct Bazel version for XLA. If Bazelisk is unavailable, you can install Bazel manually.

  2. Create and run a TensorFlow Docker container.

    To get the TensorFlow Docker image for both CPU and GPU building, run the following command:

    docker run --name xla -w /xla -it -d --rm -v $PWD:/xla tensorflow/build:latest-python3.9 bash

Build

Build for CPU:

docker exec xla ./configure.py --backend=CPU
docker exec xla bazel build --test_output=all --spawn_strategy=sandboxed //xla/...

Build for GPU:

docker exec xla ./configure.py --backend=CUDA
docker exec xla bazel build --test_output=all --spawn_strategy=sandboxed //xla/...

Your first build will take quite a while because it has to build the entire stack, including XLA, MLIR, and StableHLO.

To learn more about building XLA, see Build from source.

Create a pull request

When you're ready to send changes for review, create a pull request.

To learn about the XLA code review philosophy, see Code reviews.