Giter Site home page Giter Site logo

amanda-barbara / xla Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openxla/xla

0.0 0.0 0.0 144.53 MB

A community-driven and modular open source compiler for ML.

License: Apache License 2.0

Shell 0.04% C++ 83.68% Python 0.70% C 0.38% SourcePawn 0.04% Smarty 0.27% CMake 0.15% LLVM 0.02% Batchfile 0.01% Cython 0.01% MLIR 8.10% Starlark 6.61%

xla's Introduction

OpenXLA, a community-driven and modular open-source compiler (actively migrating from tensorflow/xla).

The OpenXLA compiler is a community-driven and modular ML compiler. It will enable efficient optimization and deployment of ML models from most major frameworks to any hardware backend notably CPUs, GPUs, and ML ASICs.

Warning This repo is currently being migrated from TensorFlow. Until the migration is complete, this repo will not be accepting PRs.

It is currently in the process of being created from the code currently inside tensorflow, under the OpenXLA SIG governance.

If you want to use XLA with your ML project, refer to the corresponding documentation for your ML framework:

Everything else in this repo is intended for XLA developers and integrators (to debug or add support for ML frontends and hardware backends).

Get started

Here's how you can start developing in the XLA compiler:

Note: If you're not contributing code to the XLA compiler, you shouldn't clone and build this repo. To simply compile a model with XLA, see the links above to use one of the supported ML frameworks.

To build XLA, you will need to install Bazel. Bazelisk is an easy way to install Bazel and automatically downloads the correct Bazel version for XLA. If Bazelisk is unavailable, you can manually install Bazel instead.

Clone this repository:

git clone https://github.com/openxla/xla && cd xla

We recommend using a suitable docker container to build/test XLA, such as TensorFlow's docker container:

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

Run an end to end test using an example StableHLO module:

docker exec xla bazel test xla/examples/axpy:stablehlo_compile_test --nocheck_visibility --test_output=all

This will take quite a while your first time because it must build the entire stack, including MLIR, StableHLO, XLA, and more.

When it's done, you should see output like this:

==================== Test output for //xla/examples/axpy:stablehlo_compile_test:
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from StableHloAxpyTest
[ RUN      ] StableHloAxpyTest.LoadAndRunCpuExecutable
Loaded StableHLO program from xla/examples/axpy/stablehlo_axpy.mlir:
func.func @main(
  %alpha: tensor<f32>, %x: tensor<4xf32>, %y: tensor<4xf32>
) -> tensor<4xf32> {
  %0 = stablehlo.broadcast_in_dim %alpha, dims = []
    : (tensor<f32>) -> tensor<4xf32>
  %1 = stablehlo.multiply %0, %x : tensor<4xf32>
  %2 = stablehlo.add %1, %y : tensor<4xf32>
  func.return %2: tensor<4xf32>
}

Computation inputs:
        alpha:f32[] 3.14
        x:f32[4] {1, 2, 3, 4}
        y:f32[4] {10.5, 20.5, 30.5, 40.5}
Computation output: f32[4] {13.64, 26.78, 39.920002, 53.06}
[       OK ] StableHloAxpyTest.LoadAndRunCpuExecutable (264 ms)
[----------] 1 test from StableHloAxpyTest (264 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (264 ms total)
[  PASSED  ] 1 test.

Contacts

  • For questions, contact Thea Lamkin - thealamkin at google

Resources

Code of Conduct

While under TensorFlow governance, all community spaces for SIG OpenXLA are subject to the TensorFlow Code of Conduct.

xla's People

Contributors

akuegel avatar berkinilbeyi avatar bixia1 avatar blakehechtman avatar cheshire avatar chr1sj0nes avatar chsigg avatar d0k avatar ddunl avatar dimvar avatar ezhulenev avatar hanbinyoon avatar hawkinsp avatar jblespiau avatar joker-eph avatar jreiffers avatar jurahul avatar majnemer avatar meheffernan avatar mkuperst avatar nouiz avatar pifon2a avatar samuelmarks avatar skye avatar tensorflower-gardener avatar timshen91 avatar trentlo avatar ukoxyz avatar yunxing avatar zhangqiaorjc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.