-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unstack_and_unshard for SparseCore
PiperOrigin-RevId: 714073293
- Loading branch information
1 parent
48edd8d
commit 8fd28a4
Showing
21 changed files
with
1,367 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Build and test | ||
|
||
on: | ||
# Only run workflow on pushes to main (includes PR merge), and on | ||
# opened pull-requests. | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build_and_test: | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
|
||
- name: Display Python version | ||
run: python -c "import sys; print(sys.version)" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
. build/install_bazelisk.sh | ||
# Load different caches depending on if this is a pull-request or merge. | ||
# If merge (or push commit), use a read-write cache based on the python | ||
# version, branch, and commit-sha. | ||
# If pull-request, use a read-only cache based on the target python | ||
# version, branch, and PR base sha. | ||
- if: github.event_name != 'pull_request' | ||
name: Mount bazel cache (main) | ||
uses: actions/cache@v4 | ||
with: | ||
path: "/home/runner/.cache/bazel" | ||
key: bazel-${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }} | ||
restore-keys: | | ||
bazel-${{ matrix.python-version }}-${{ github.ref_name }} | ||
bazel-${{ matrix.python-version }}- | ||
bazel- | ||
- if: github.event_name == 'pull_request' | ||
name: Mount bazel cache (pull-request) | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: "/home/runner/.cache/bazel" | ||
key: bazel-${{ matrix.python-version }}-${{ github.base_ref }}-${{ github.event.pull_request.base.sha }} | ||
restore-keys: | | ||
bazel-${{ matrix.python-version }}-${{ github.base_ref }} | ||
bazel-${{ matrix.python-version }}- | ||
bazel- | ||
- name: Build all targets | ||
run: | | ||
export HERMETIC_PYTHON_VERSION=${{ matrix.python-version }} | ||
bazel build //... | ||
- name: Build pip wheel | ||
run: | | ||
bazel run //build:build_pip_package -- $PWD | ||
- name: Run CPU tests | ||
run: | | ||
bazel test --config=cpu --test_output=errors --keep_going //... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,9 @@ poetry.lock | |
|
||
# PyCharm | ||
.idea | ||
|
||
# Bazel | ||
/bazel-* | ||
|
||
# Built wheels. | ||
/*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Copyright 2024 The JAX SC Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
load("//third_party/bazel/python:pypi.bzl", "pypi_requirement") | ||
load("//third_party/bazel/python:pytype.bzl", "pytype_strict_library") | ||
|
||
package( | ||
default_applicable_licenses = ["//:license"], | ||
default_visibility = [ | ||
"//jax_tpu_embedding/sparsecore:__subpackages__", | ||
], | ||
) | ||
|
||
pytype_strict_library( | ||
name = "utils", | ||
srcs = ["utils.py"], | ||
deps = [pypi_requirement("jax")], | ||
) | ||
|
||
pytype_strict_library( | ||
name = "decompose", | ||
srcs = ["decompose.py"], | ||
deps = [ | ||
":preprocess", | ||
":utils", | ||
pypi_requirement("jax"), | ||
], | ||
) | ||
|
||
pytype_strict_library( | ||
name = "preprocess", | ||
srcs = ["preprocess.py"], | ||
deps = [ | ||
":utils", | ||
pypi_requirement("jax"), | ||
], | ||
) | ||
|
||
pytype_strict_library( | ||
name = "auto_pipelining", | ||
srcs = ["auto_pipelining.py"], | ||
deps = [ | ||
":decompose", | ||
pypi_requirement("jax"), | ||
], | ||
) |
Oops, something went wrong.